+ {hasNextNode
+ ? 'This action will navigate to the linked node.'
+ : 'Select a node to navigate to after this action, or save to create a new placeholder.'}
- ) : (
-
- Save to create a placeholder for the next step.
-
- )}
+
)
}
diff --git a/frontend/src/store/treeEditorStore.ts b/frontend/src/store/treeEditorStore.ts
index 11c84b70..271df0ba 100644
--- a/frontend/src/store/treeEditorStore.ts
+++ b/frontend/src/store/treeEditorStore.ts
@@ -123,6 +123,25 @@ export const findNodeInTree = (
return null
}
+/** Collect all nodes in the tree as a flat list with depth info. */
+export function collectAllNodesFlat(
+ root: TreeStructure | null
+): Array<{ id: string; label: string; type: string; depth: number }> {
+ if (!root) return []
+ const result: Array<{ id: string; label: string; type: string; depth: number }> = []
+
+ function walk(node: TreeStructure, depth: number) {
+ const label = node.type === 'decision'
+ ? (node.question || 'Untitled Decision')
+ : (node.title || `Untitled ${node.type}`)
+ result.push({ id: node.id, label, type: node.type, depth })
+ node.children?.forEach(child => walk(child, depth + 1))
+ }
+
+ walk(root, 0)
+ return result
+}
+
// Helper to find parent of a node
const findParentNode = (
nodeId: string,