import type { ReactNode } from "react"; import Link from "next/link"; import { Badge } from "@/components/ui/badge"; import { StatusBadge } from "@/components/cases/status-badge"; import { StatusRail } from "@/components/cases/status-rail"; 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 { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Users } from "lucide-react"; import type { CaseDetail } from "@/lib/api/cases"; /** * 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({ caseNumber, data, actions, tabs, }: { caseNumber: string; data?: CaseDetail; actions?: ReactNode; tabs?: ReactNode; }) { const appellants = data?.appellants?.filter(Boolean) ?? []; const respondents = data?.respondents?.filter(Boolean) ?? []; const hasParties = appellants.length > 0 || respondents.length > 0; const isBlam = data?.proceeding_type === 'בל"מ' || isBlamSubtype(data?.appeal_subtype); return (
{/* title block + metadata on one row — no wrap, so the metadata dl stays parallel to the H1 and a long parties line can't push it below. */}
{/* title row — H1 + status/type/blam chips inline (mockup .band h1) */}

{data?.proceeding_type ?? "ערר"} {data?.case_number ?? "—"} {/* case subject on the same line, smaller font (chair request) */} {data?.title && ( {data.title} )} {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 actions — parties now live in a popover (chair request) so they don't push the tab content down the page. */}
{hasParties && ( {appellants.length > 0 && (
עוררים
    {appellants.map((a, i) =>
  • {a}
  • )}
)} {respondents.length > 0 && (
משיבים
    {respondents.map((r, i) =>
  • {r}
  • )}
)}
)} {data?.case_number && ( )} {actions}
{/* ★ integrated status rail — visible on every tab (banner A, X17) */} {/* tab strip anchored to band bottom */} {tabs ?
{tabs}
: null}
); }