Fix Visual Manager for Base UI: layout, tree load, no nested dialogs.
Local Build and Deploy / deploy (push) Successful in 1m9s

Move trigger outside Dialog.Root, use portal confirms and inline create forms, and load the catalog tree atomically so the manager matches the designed full-viewport UX.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-17 21:21:40 +02:00
1 parent 2ff5b47104
commit f6871807c9
5 files changed
+240 -162

No files matched your search

@@ -68,6 +68,7 @@ export type CatalogAction =
| { type: "EXPAND_PATH"; ids: number[] }
| { type: "COLLAPSE_ALL" }
| { type: "SET_NODES"; nodes: TreeNodeData[] }
| { type: "SET_FULL_TREE"; nodes: TreeNodeData[] }
| { type: "SET_CHILDREN"; parentId: number; children: TreeNodeData[] }
| { type: "UPDATE_NODE"; update: TreeNodeUpdate }
| { type: "REMOVE_NODE"; id: number }
@@ -138,6 +139,24 @@ function reducer(
for (const n of action.nodes) next.set(n.id, n);
return { ...state, nodes: next };
}
case "SET_FULL_TREE": {
const nodes = new Map<number, TreeNodeData>();
const childrenMap = new Map<number, number[]>();
for (const n of action.nodes) {
nodes.set(n.id, n);
const siblings = childrenMap.get(n.parentId) || [];
siblings.push(n.id);
childrenMap.set(n.parentId, siblings);
}
for (const [parentId, ids] of childrenMap) {
ids.sort(
(a, b) =>
(nodes.get(a)?.orderNum ?? 0) - (nodes.get(b)?.orderNum ?? 0),
);
childrenMap.set(parentId, ids);
}
return { ...state, nodes, childrenMap };
}
case "SET_CHILDREN": {
const nextNodes = new Map(state.nodes);
const nextChildren = new Map(state.childrenMap);