import { useMemo } from "react"; import ReactFlow, { Background, Controls, type NodeMouseHandler, ReactFlowProvider, } from "reactflow"; import "reactflow/dist/style.css"; import type { StateResponse, Topology } from "../api"; import { layout } from "../layout"; import { MapNode } from "./MapNode"; const nodeTypes = { pipeline: MapNode }; interface Props { topology: Topology; state: StateResponse | null; pathNodeIds: Set | null; onNodeClick: (nodeId: string) => void; } // The center pipeline map. Nodes are dagre-laid from the topology; live state // colors them; clicking a node filters the task list. Multiple trees (processes // off intake) lay out as separate lanes automatically. export function PipelineMap({ topology, state, pathNodeIds, onNodeClick }: Props) { const { nodes, edges } = useMemo( () => layout(topology, state?.nodes ?? {}, pathNodeIds), [topology, state, pathNodeIds], ); const handleNodeClick: NodeMouseHandler = (_evt, node) => onNodeClick(node.id); return (
); }