diff --git a/src/components/AddConnectionWizard/AddConnectionWizard.tsx b/src/components/AddConnectionWizard/AddConnectionWizard.tsx index ca5dbac..10fe952 100644 --- a/src/components/AddConnectionWizard/AddConnectionWizard.tsx +++ b/src/components/AddConnectionWizard/AddConnectionWizard.tsx @@ -209,7 +209,7 @@ export const AddConnectionWizard: React.FC = ({ onClose(); }; - const STEP_LABELS = ['Anbieter', 'Zustimmung', 'Einstellungen', 'Übersicht']; + const STEP_LABELS = ['Anbieter', 'Zustimmung', 'Einstellungen', 'Übersicht'] as const; const visibleSteps = state.knowledgeEnabled ? [0, 1, 2, 3] : [0, 1, 3]; diff --git a/src/components/FormGenerator/FormGeneratorTable/FormGeneratorTable.tsx b/src/components/FormGenerator/FormGeneratorTable/FormGeneratorTable.tsx index b63d245..20f9789 100644 --- a/src/components/FormGenerator/FormGeneratorTable/FormGeneratorTable.tsx +++ b/src/components/FormGenerator/FormGeneratorTable/FormGeneratorTable.tsx @@ -154,28 +154,6 @@ function _treeMoveItemsToGroup(tree: TableGroupNode[], itemIds: string[], groupI if (groupId) for (const id of itemIds) t = _treeAddItemToGroup(t, groupId, id); return t; } -function _treeReorder(tree: TableGroupNode[], groupId: string, dir: 'up' | 'down'): TableGroupNode[] { - const _at = (nodes: TableGroupNode[]): TableGroupNode[] => { - const idx = nodes.findIndex(n => n.id === groupId); - if (idx === -1) return nodes.map(n => ({ ...n, subGroups: _at(n.subGroups) })); - const arr = [...nodes]; - if (dir === 'up' && idx > 0) [arr[idx - 1], arr[idx]] = [arr[idx], arr[idx - 1]]; - if (dir === 'down' && idx < arr.length - 1) [arr[idx], arr[idx + 1]] = [arr[idx + 1], arr[idx]]; - return arr; - }; - return _at(tree); -} -function _treeFlatten(tree: TableGroupNode[]): Array<{ node: TableGroupNode; depth: number; parentId: string | null }> { - const result: Array<{ node: TableGroupNode; depth: number; parentId: string | null }> = []; - const _walk = (nodes: TableGroupNode[], depth: number, parentId: string | null) => { - nodes.forEach(n => { - result.push({ node: n, depth, parentId }); - _walk(n.subGroups, depth + 1, n.id); - }); - }; - _walk(tree, 0, null); - return result; -} /** Returns the id of the group that directly contains `itemId`, or null. */ function _treeGetItemDirectGroupId(tree: TableGroupNode[], itemId: string): string | null { for (const n of tree) { @@ -891,12 +869,12 @@ export function FormGeneratorTable>({ }, [hookData, activeGroupId]); /** Enter a group scope — refetch with groupId filter. */ - const _enterGroup = useCallback((groupId: string) => { - setActiveGroupId(groupId); + const _enterGroup = (_groupId: string) => { + setActiveGroupId(_groupId); if (!hookData?.refetch) return; const s = tableStateRef.current; - hookData.refetch({ page: 1, pageSize: s.pageSize, groupId }); - }, [hookData]); + hookData.refetch({ page: 1, pageSize: s.pageSize, groupId: _groupId }); + }; /** Exit group scope — refetch without groupId. */ const _exitGroup = useCallback(() => { @@ -1024,7 +1002,7 @@ export function FormGeneratorTable>({ const parentGroup = _treeGetGroupParentId(tree, curGroup); actions.moveItemsToGroup([rowId], parentGroup); // Keep the source group collapsed after the move - setExpandedGroupsRef.current(prev => { + setExpandedGroupsRef.current?.(prev => { const next = new Set(prev); next.add(`collapsed-${curGroup}`); return next; @@ -1039,7 +1017,7 @@ export function FormGeneratorTable>({ actions.moveGroupToParent(gId, grandParentId); // Keep the parent group collapsed after the move if (parentId) { - setExpandedGroupsRef.current(prev => { + setExpandedGroupsRef.current?.(prev => { const next = new Set(prev); next.add(`collapsed-${parentId}`); return next; diff --git a/src/components/FormGenerator/GroupingManager/GroupRow.tsx b/src/components/FormGenerator/GroupingManager/GroupRow.tsx index ca13e4f..fb97bef 100644 --- a/src/components/FormGenerator/GroupingManager/GroupRow.tsx +++ b/src/components/FormGenerator/GroupingManager/GroupRow.tsx @@ -85,7 +85,7 @@ export function GroupFolderRow({ onGroupDragLeave, }: GroupFolderRowProps) { const { t } = useLanguage(); - const { confirm, ConfirmDialog } = useConfirm(); + const { ConfirmDialog } = useConfirm(); const inputRef = useRef(null); const totalCount = node.itemIds.length;