"use client"; import { Handle, Position, type NodeProps } from "@xyflow/react"; import { AlertTriangle } from "lucide-react"; import { lookup } from "@/lib/node-catalog"; import { cn } from "@/lib/utils"; import type { FlowNodeData } from "@/lib/pipeline-graph"; export function FlowNode({ data, selected }: NodeProps) { const pn = (data as FlowNodeData).pipelineNode; const entry = lookup(pn.type); const Icon = entry?.icon ?? AlertTriangle; const outputs = entry?.outputs ?? 1; const isTrigger = pn.type === "flow-nodes-base.trigger"; return (
{entry?.label ?? "Unsupported"}
{pn.name}
{pn.type}
{/* Input handle: triggers have no inputs */} {!isTrigger && ( )} {/* Output handle(s) */} {Array.from({ length: outputs }).map((_, i) => { const top = outputs === 1 ? "50%" : `${((i + 1) / (outputs + 1)) * 100}%`; return ( ); })}
); }