import type { DirectiveStep, StepStatus } from "../../lib/api"; const STATUS_COLORS: Record = { pending: { bg: "bg-[#1a2540]", border: "border-[#2a3a5a]", text: "text-[#7788aa]" }, ready: { bg: "bg-[#2a2a10]", border: "border-[#4a4a20]", text: "text-yellow-400" }, running: { bg: "bg-[#0a2a1a]", border: "border-[#1a5a3a]", text: "text-green-400" }, completed: { bg: "bg-[#0a2a2a]", border: "border-[#1a5a5a]", text: "text-emerald-400" }, failed: { bg: "bg-[#2a1a1a]", border: "border-[#5a2a2a]", text: "text-red-400" }, skipped: { bg: "bg-[#1a1a2a]", border: "border-[#2a2a4a]", text: "text-[#7788aa]" }, }; const STATUS_LABELS: Record = { pending: "PENDING", ready: "READY", running: "RUNNING", completed: "DONE", failed: "FAILED", skipped: "SKIP", }; interface StepNodeProps { step: DirectiveStep; onComplete?: () => void; onFail?: () => void; onSkip?: () => void; onViewTask?: (taskId: string) => void; } export function StepNode({ step, onComplete, onFail, onSkip, onViewTask }: StepNodeProps) { const colors = STATUS_COLORS[step.status] || STATUS_COLORS.pending; const label = STATUS_LABELS[step.status] || step.status.toUpperCase(); const isContractBacked = !!step.contractType; return (
{step.name} {label}
{isContractBacked && (
CONTRACT {step.contractType}
)} {step.description && (

{step.description}

)} {step.contractId && ( {step.status === "running" ? "Contract running..." : "View contract"} )} {step.taskId && !step.contractId && ( )} {(step.status === "running" || step.status === "ready") && (
{onComplete && ( )} {onFail && ( )} {onSkip && ( )}
)}
); }