"use client"; import { PHASES, phaseIndexOf, type CaseStatus, type PhaseKey } from "@/lib/api/case-status"; import { STATUS_LABELS, STATUS_ICONS, STATUS_DESCRIPTIONS } from "@/components/cases/status-badge"; import { FolderInput, ClipboardList, Brain, PenLine, CheckCircle2, } from "lucide-react"; import type { LucideIcon } from "lucide-react"; /* * Vertical RTL workflow timeline. Phases + their statuses come from the SSoT * (@/lib/api/case-status); only the per-phase icon is a view-layer concern and * stays here. The user sees "where am I in the process" rather than micro-steps. */ const PHASE_ICONS: Record = { intake: FolderInput, prep: ClipboardList, thinking: Brain, writing: PenLine, done: CheckCircle2, }; export function WorkflowTimeline({ status }: { status?: CaseStatus }) { const currentIdx = phaseIndexOf(status); return (
    {PHASES.map((phase, i) => { const state = currentIdx === -1 ? "pending" : i < currentIdx ? "done" : i === currentIdx ? "current" : "pending"; const dotTone = state === "done" ? "bg-success [box-shadow:0_0_0_1px_var(--color-success)]" : state === "current" ? "bg-gold [box-shadow:0_0_0_1px_var(--color-gold)]" : "bg-rule"; const labelTone = state === "done" ? "text-ink-soft" : state === "current" ? "text-navy font-semibold" : "text-ink-muted"; const iconTone = state === "done" ? "text-success" : state === "current" ? "text-gold-deep" : "text-ink-muted/50"; const PhaseIcon = PHASE_ICONS[phase.key]; const isLast = i === PHASES.length - 1; return (
  1. {/* connector line below the dot (mockup .tl .line) */} {!isLast && ( )}
    {phase.label} {state === "current" ? "כעת" : state === "done" ? "✓" : "—"}
  2. ); })} {/* current micro-status detail under the active phase */} {currentIdx !== -1 && status && (
  3. {STATUS_ICONS[status] && (() => { const Icon = STATUS_ICONS[status]; return ; })()} {STATUS_LABELS[status]} {STATUS_DESCRIPTIONS[status] && ( {STATUS_DESCRIPTIONS[status]} )}
  4. )}
); }