'use client'; import { Background, ReactFlow, type Edge, type Node, type NodeMouseHandler, type NodeTypes, } from '@xyflow/react'; import type { BlockedChainAnalysis } from '../../lib/graph-view'; import type { GraphNodeData } from './graph-node-card'; /** Props for the GraphSection component. */ interface GraphSectionProps { /** ReactFlow nodes with layout positions applied. */ nodes: Node[]; /** ReactFlow edges connecting the nodes. */ edges: Edge[]; /** Map of custom node type names to their React components. */ nodeTypes: NodeTypes; /** Default edge rendering options. */ defaultEdgeOptions: { type: 'smoothstep'; zIndex: number; interactionWidth: number; }; /** Callback fired when a node is clicked in the graph. */ onNodeClick: NodeMouseHandler; /** Optional blocker summary for the currently selected task. */ blockerAnalysis?: BlockedChainAnalysis | null; /** Whether closed items are hidden from the graph workspace. */ hideClosed?: boolean; } /** * Renders the ReactFlow graph with status-lane layout. * Shows a compact legend and full graph viewport. * Nodes are positioned in columns by status: Done | In Progress | Ready | Blocked. */ export function GraphSection({ nodes, edges, nodeTypes, defaultEdgeOptions, onNodeClick, blockerAnalysis, hideClosed = false, }: GraphSectionProps) { return (
{/* Compact legend + tip */}

Legend {' '} {!hideClosed ? ( <> Done {' \u2192 '} ) : null} In Progress {' \u2192 '} Ready {' \u2192 '} Blocked

Click a task to see details •{' '} = blocks

{blockerAnalysis ? (

Open blockers: {blockerAnalysis.openBlockerCount} {' | '} In progress blockers: {blockerAnalysis.inProgressBlockerCount}

) : null}

Read left to right:{' '} Left = blockers, middle = selected task, Right = work unblocked by this task.

{/* ReactFlow graph viewport */}
); }