"use client"; import type { CaseStatus } from "@/lib/api/cases"; 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 showing the 13-status case pipeline. * Groups the raw statuses into the 5 visual phases used across the app * (intake → prep → thinking → writing → done) so the user sees * "where am I in the process" rather than 13 micro-steps. */ type Phase = { key: string; label: string; icon: LucideIcon; statuses: CaseStatus[]; }; const PHASES: Phase[] = [ { key: "intake", label: "קליטה ועיבוד", icon: FolderInput, statuses: ["new", "uploading", "processing"] }, { key: "prep", label: "הכנת תיק", icon: ClipboardList, statuses: ["documents_ready", "analyst_verified", "research_complete", "outcome_set"] }, { key: "thinking", label: "ניתוח וכיוון", icon: Brain, statuses: ["brainstorming", "direction_approved", "analysis_enriched", "ready_for_writing"] }, { key: "writing", label: "כתיבת טיוטה", icon: PenLine, statuses: ["drafting", "qa_review", "drafted"] }, { key: "done", label: "סגירה", icon: CheckCircle2, statuses: ["exported", "reviewed", "final"] }, ]; function phaseIndexOf(status?: CaseStatus): number { if (!status) return -1; return PHASES.findIndex((p) => p.statuses.includes(status)); } 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 border-success" : state === "current" ? "bg-gold border-gold shadow-[0_0_0_4px_color-mix(in_oklab,var(--color-gold)_20%,transparent)]" : "bg-surface border-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.icon; const StatusIcon = status ? STATUS_ICONS[status] : null; return (
  1. {phase.label} {state === "current" && status && ( {StatusIcon && } {STATUS_LABELS[status]} )} {state === "current" && status && STATUS_DESCRIPTIONS[status] && ( {STATUS_DESCRIPTIONS[status]} )}
  2. ); })}
); }