import { Check, Loader2, AlertTriangle, Clock } from "lucide-react"; import { cn } from "@/lib/utils"; type Stage = "queued" | "analyzing" | "completed" | "failed"; const STAGES: { key: Stage; label: string }[] = [ { key: "queued", label: "Queued" }, { key: "analyzing", label: "Analyzing" }, { key: "completed", label: "Completed" }, ]; function mapStatus(status: string): Stage { if (status === "complete" || status === "completed") return "completed"; if (status === "analyzing" || status === "processing") return "analyzing"; if (status === "failed") return "failed"; return "queued"; } export function StatusTimeline({ status }: { status: string }) { const current = mapStatus(status); const failed = current === "failed"; const currentIdx = failed ? 1 : STAGES.findIndex((s) => s.key === current); return (
Pipeline status
{STAGES.map((stage, i) => { const done = i < currentIdx; const active = i === currentIdx && !failed; const isFailed = failed && i === 1; const Icon = isFailed ? AlertTriangle : done ? Check : active ? Loader2 : Clock; return (
{isFailed ? "Failed" : stage.label}
{i < STAGES.length - 1 && (
)}
); })}
); }