import { memo } from "react"; import { Handle, Position, type NodeProps } from "reactflow"; import { Lock, RotateCcw } from "lucide-react"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; 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 canLoop = loopBackTo.length > 0; return (
{/* Count badge — top-right corner */} {count > 0 && ( {count} )} {/* Label row */}
{meta.label} {meta.kind === "gate" && ( )} {canLoop && ( can send work back to {loopBackTo.join(", ")} )}
{/* Agent name */}
{meta.agent}
); } export const MapNode = memo(MapNodeImpl);