feat: wire FlowCanvas and NodeEditorPanel into TreeEditorLayout
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { lazy, Suspense } from 'react'
|
import { lazy, Suspense } from 'react'
|
||||||
import { TreePreviewPanel } from '@/components/tree-preview/TreePreviewPanel'
|
import { TreePreviewPanel } from '@/components/tree-preview/TreePreviewPanel'
|
||||||
import { TreeCanvas } from './TreeCanvas'
|
import { FlowCanvas } from './FlowCanvas'
|
||||||
|
import { NodeEditorPanel } from './NodeEditorPanel'
|
||||||
import { MetadataSidePanel } from './MetadataSidePanel'
|
import { MetadataSidePanel } from './MetadataSidePanel'
|
||||||
import { useTreeEditorStore } from '@/store/treeEditorStore'
|
import { useTreeEditorStore } from '@/store/treeEditorStore'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
@@ -14,12 +15,18 @@ interface TreeEditorLayoutProps {
|
|||||||
isMobile?: boolean
|
isMobile?: boolean
|
||||||
isMetadataOpen?: boolean
|
isMetadataOpen?: boolean
|
||||||
onCloseMetadata?: () => void
|
onCloseMetadata?: () => void
|
||||||
|
editingNodeId: string | null
|
||||||
|
onNodeSelect: (nodeId: string | null) => void
|
||||||
|
onSelectAnswerType: (nodeId: string, type: 'decision' | 'action' | 'solution') => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TreeEditorLayout({
|
export function TreeEditorLayout({
|
||||||
isMobile = false,
|
isMobile = false,
|
||||||
isMetadataOpen = false,
|
isMetadataOpen = false,
|
||||||
onCloseMetadata = () => {},
|
onCloseMetadata = () => {},
|
||||||
|
editingNodeId,
|
||||||
|
onNodeSelect,
|
||||||
|
onSelectAnswerType,
|
||||||
}: TreeEditorLayoutProps) {
|
}: TreeEditorLayoutProps) {
|
||||||
const editorMode = useTreeEditorStore(s => s.editorMode)
|
const editorMode = useTreeEditorStore(s => s.editorMode)
|
||||||
|
|
||||||
@@ -56,16 +63,31 @@ export function TreeEditorLayout({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{/* Flow Mode: Full-width visual canvas */}
|
{/* Flow Mode: React Flow canvas + side panels */}
|
||||||
<div className="flex-1 overflow-hidden">
|
<div className="flex-1 overflow-hidden">
|
||||||
<TreeCanvas />
|
<FlowCanvas
|
||||||
|
selectedNodeId={editingNodeId}
|
||||||
|
onNodeSelect={onNodeSelect}
|
||||||
|
onSelectAnswerType={onSelectAnswerType}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Metadata side panel — overlays the canvas from the right */}
|
{/* Node editor panel — takes real layout space */}
|
||||||
<MetadataSidePanel
|
{editingNodeId && (
|
||||||
isOpen={isMetadataOpen}
|
<NodeEditorPanel
|
||||||
onClose={onCloseMetadata}
|
nodeId={editingNodeId}
|
||||||
/>
|
onClose={() => onNodeSelect(null)}
|
||||||
|
onSelectType={onSelectAnswerType}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Metadata side panel — only show when node editor is closed */}
|
||||||
|
{!editingNodeId && (
|
||||||
|
<MetadataSidePanel
|
||||||
|
isOpen={isMetadataOpen}
|
||||||
|
onClose={onCloseMetadata}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user