feat: add node picker dropdown to action node form for cross-references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-28 19:47:10 -05:00
parent b0347bacd4
commit 663919d928
2 changed files with 79 additions and 10 deletions

View File

@@ -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,