"use client"; import { Handle, Position } from "@xyflow/react"; import type { PhaseStatus } from "@/lib/api"; import { cn } from "@/lib/utils"; interface NodeData { label: string; status?: PhaseStatus; index?: number; isActive?: boolean; phaseIndex?: number; } export function PhaseNode({ data }: { data: NodeData }) { const status = data.status ?? "pending"; return (
{/* 4-side handles so the snake-pattern grid (row 0 → right, row 1 → left, row 2 → right) can connect cleanly: vertical hops use top/bottom; horizontal hops use left/right. Each side exposes both a source and a target handle with an explicit id so edges can pick the right one. */}
{typeof data.index === "number" ? `STEP ${data.index.toString().padStart(2, "0")}` : "STEP"}
{data.label}
{status}
); }