"use client"; import { PHASES, type CaseStatus } from "@/lib/api/case-status"; import { statusLabel } from "@/lib/api/case-status"; import { StatusChanger } from "@/components/cases/status-changer"; import { StatusGuide } from "@/components/cases/status-guide"; import { AgentStatusWidget } from "@/components/cases/agent-status-widget"; import { expectedOutcomes } from "@/lib/schemas/case"; import { formatDate } from "@/lib/format-date"; import type { CaseDetail } from "@/lib/api/cases"; /* * StatusHero — the single, prominent home for case status (mockup 18b, INV-IA1). * Renders the horizontal pipeline stepper, the current-stage chip, the manual * status changer, and a meta strip. This is the ONLY surface in the app that * owns the status changer / pipeline timeline (status was removed from the * compose editor and the other case tabs). Reuses the shared StatusChanger, * StatusGuide and AgentStatusWidget so no parallel status path is created (G2). */ const EXPECTED_OUTCOME_LABELS: Record = Object.fromEntries( expectedOutcomes.map((o) => [o.value, o.label]), ); function phaseIndexOf(status?: CaseStatus): number { if (!status) return -1; return PHASES.findIndex((p) => p.statuses.includes(status)); } /** Horizontal RTL stepper over the 5 lifecycle phases (mockup 18b .stepper). */ function HorizontalStepper({ status }: { status?: CaseStatus }) { const currentIdx = phaseIndexOf(status); return (
    {PHASES.map((phase, i) => { const state = currentIdx === -1 ? "pending" : i < currentIdx ? "done" : i === currentIdx ? "now" : "pending"; const isLast = i === PHASES.length - 1; const knobTone = state === "done" ? "bg-success [box-shadow:0_0_0_1px_var(--color-success)]" : state === "now" ? "bg-gold [box-shadow:0_0_0_2px_var(--color-gold-wash),0_0_0_3px_var(--color-gold)]" : "bg-rule [box-shadow:0_0_0_1px_var(--color-rule)]"; const labelTone = state === "done" ? "text-ink-soft" : state === "now" ? "text-navy font-bold" : "text-ink-muted"; // connector runs toward the next (earlier-completed) phase; in RTL the // line sits to the start side. Coloured when this phase is done. const segTone = state === "done" ? "bg-success" : "bg-rule"; return (
  1. {!isLast && ( )} {phase.label} {state === "now" ? "כעת" : state === "done" ? "✓" : "—"}
  2. ); })}
); } export function StatusHero({ caseNumber, data, }: { caseNumber: string; data?: CaseDetail; }) { const status = data?.status; const expectedOutcomeLabel = data?.expected_outcome ? EXPECTED_OUTCOME_LABELS[data.expected_outcome] ?? data.expected_outcome : null; return (
{/* hero top — title + current stage chip + manual changer */}

סטטוס התיק

{status && ( כעת: {statusLabel(status)} )}
{/* manual status changer — the SINGLE manual-status surface (INV-IA1) */}
{/* horizontal pipeline */} {/* meta strip below the stepper (mockup 18b .hero-meta) */}
תוצאה צפויה {expectedOutcomeLabel ? ( {expectedOutcomeLabel} ) : ( לא נקבע )}
תאריך דיון {formatDate(data?.hearing_date)}
עודכן לאחרונה {formatDate(data?.updated_at)}
{/* agents activity + status-map progressive disclosure (INV-IA6) */}
); }