import type { ReactNode } from "react"; import Link from "next/link"; import { Badge } from "@/components/ui/badge"; import { StatusBadge } from "@/components/cases/status-badge"; import { SyncIndicator } from "@/components/cases/sync-indicator"; import { CaseArchiveAction } from "@/components/cases/case-archive-action"; import { CreateRepoButton } from "@/components/cases/create-repo-button"; import { PRACTICE_AREA_LABELS, APPEAL_SUBTYPE_LABELS, isBlamSubtype, } from "@/lib/practice-area"; import type { CaseDetail } from "@/lib/api/cases"; function formatDate(iso?: string | null) { if (!iso) return "—"; try { return new Date(iso).toLocaleDateString("he-IL", { day: "2-digit", month: "2-digit", year: "numeric", }); } catch { return iso ?? "—"; } } function partiesLine(data?: CaseDetail): string | null { const appellant = data?.appellants?.filter(Boolean) ?? []; const respondent = data?.respondents?.filter(Boolean) ?? []; const parts: string[] = []; if (appellant.length) parts.push(`עוררת: ${appellant.join(", ")}`); if (respondent.length) parts.push(`משיבה: ${respondent.join(", ")}`); return parts.length ? parts.join(" · ") : null; } /** * Case header — parchment band (IA-redesign mockup 17): full-bleed band with * the case title + status/type chips inline, a parties line, the case actions * (edit / archive / repo / sync), and a metadata strip. The `tabs` slot renders * the tab strip inside the band, anchored to its bottom edge. */ export function CaseHeader({ data, actions, tabs, }: { data?: CaseDetail; actions?: ReactNode; tabs?: ReactNode; }) { const parties = partiesLine(data); const isBlam = data?.proceeding_type === 'בל"מ' || isBlamSubtype(data?.appeal_subtype); return (
{/* title row — H1 + status/type/blam chips inline (mockup .band h1) */}

{data?.proceeding_type ?? "ערר"} {data?.case_number ?? "—"} {data?.status && } {data?.archived_at && ( בארכיון )} {data?.practice_area && ( {PRACTICE_AREA_LABELS[data.practice_area]} {data.appeal_subtype && data.appeal_subtype !== "unknown" && ( <> · {APPEAL_SUBTYPE_LABELS[data.appeal_subtype]} )} )} {isBlam && ( בל"מ )}

{/* case title / subject under the heading */} {data?.title && (

{data.title}

)} {/* parties line (mockup .parties) */} {parties ? (

{parties}

) : data?.subject ? (

{data.subject}

) : null} {/* case actions — kept verbatim, moved into the band */}
{data?.case_number && ( )} {actions}
{/* metadata strip — hearing date / updated / sync */}
תאריך דיון
{formatDate(data?.hearing_date)}
עודכן
{formatDate(data?.updated_at)}
סנכרון
{/* tab strip anchored to band bottom (mockup .tabs) */} {tabs ?
{tabs}
: null}
); }