import { memo } from "react"; import { Handle, Position, type NodeProps } from "reactflow"; import type { RFData } from "../layout"; // One pipeline stage on the map. Color encodes live state; a badge shows the // live task count; gated (P3/inert) nodes render dimmed with a tag. ARIA role + // label keep the map reachable for screen readers / keyboard users. function MapNodeImpl({ data }: NodeProps) { const { meta, state, count, dimmed, onPath, loopBackTo } = data; const cls = [ "node", `state-${state}`, meta.gated ? "gated" : "", dimmed ? "dimmed" : "", onPath ? "on-path" : "", ] .filter(Boolean) .join(" "); const canLoop = loopBackTo.length > 0; return (
{meta.label} {meta.kind === "gate" && ( ⛋ )} {canLoop && ( ↺ )}
{meta.agent}
{count > 0 && ( {count} )} {meta.gated && inert}
); } export const MapNode = memo(MapNodeImpl);