Files
legal-ai/web-ui/src/components/header-context.ts
Chaim cca17689de
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 32s
feat(ui): redesign header to two rows with grouped nav (Phase B)
Splits the AppShell header into:
  Row 1 — brand: logo + dynamic context subtitle (route-aware) +
          global search + agent boards dropdown
  Row 2 — nav:   work group (בית · ארכיון) | knowledge group (ספריית
          פסיקה · אימון · מתודולוגיה) + admin dropdown (⚙) on the left

Three changes from the previous flat 8-item nav:

1. Grouping reflects intent. Daily-driver pages are in "work", corpus
   pages in "knowledge"; system pages (skills · diagnostics · settings)
   move into a single ⚙ dropdown so they stop competing for attention.

2. Subtitle is now dynamic. `headerSubtitle(pathname)` resolves the
   current section so the user always sees where they are without
   scanning the nav row. Case routes show the case number explicitly
   ("ערר 1234-24" / "ערר 1234-24 · ניסוח").

3. The gold-underline active state is preserved and the admin trigger
   inherits it whenever any admin route is active.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 18:15:20 +00:00

32 lines
1.4 KiB
TypeScript

/**
* Resolves the dynamic subtitle shown next to the brand in the AppShell
* header. Reflects the current section so the user always sees where they
* are without scanning the nav row.
*
* Special-cases case routes (`/cases/{caseNumber}` and `/compose`) so the
* subtitle includes the case number — the most useful piece of context
* during decision drafting.
*/
export function headerSubtitle(pathname: string): string {
if (pathname === "/") return "בית";
if (pathname.startsWith("/cases/")) {
const [, , slug] = pathname.split("/");
if (!slug || slug === "new") return "תיק חדש";
const isCompose = pathname.includes("/compose");
const decoded = decodeURIComponent(slug);
return isCompose ? `ערר ${decoded} · ניסוח` : `ערר ${decoded}`;
}
if (pathname.startsWith("/archive")) return "ארכיון";
if (pathname.startsWith("/training")) return "אימון סגנון";
if (pathname.startsWith("/precedents")) return "ספריית פסיקה";
if (pathname.startsWith("/methodology")) return "מתודולוגיה";
if (pathname.startsWith("/skills")) return "מיומנויות";
if (pathname.startsWith("/diagnostics")) return "אבחון";
if (pathname.startsWith("/settings")) return "הגדרות";
if (pathname.startsWith("/feedback")) return "הערות יו״ר";
return "ניהול תיקים";
}