PR: #367: feat(documents): Documents Work Mode shell (option-J chrome) [Story-1509] by @ankitmaheshwari-com
View PR →
Story 1509 · DOCS-CHROME · supersedes Story 529

Documents Work Mode shell — the option-J chrome

This is the frame counsel sees when they open a matter's Documents section: a serif “Documents” heading with a live subtitle, the saved-view folder-pill bar (with a searchable More overflow), and the right-aligned Filter · ⚙ View · Upload cluster. It is the chrome that wraps the Documents Register — built and verified Storybook-first, ahead of the register table, view-state engine, popovers, and upload sheet that its sibling tickets land into the same shell.

Mode 1 (deterministic) Presentational · callback-driven

What shipped

A new co-located component family under src/components/matter-detail/documents/, each a leaf with a co-located *.stories.tsx (the AC: story before live wiring):

ComponentRoleStory
DocumentViewPill One saved-view folder-pill — folder glyph, optional amber star, active crimson fill, unsaved dot. Default / Active / Starred / Active+starred / Active+edited
DocumentsViewPills The pill bar. Pins active + starred inline, overflows the rest into a searchable More popover, trails a New view affordance. Default / Few (no overflow) / Many (searchable) / Edited
DocumentsWorkModeActions Right-aligned Filter trigger · ⚙ View (unsaved dot) · Upload (brand-filled). Default / View edited / With active filters
DocumentsWorkModeHeader The composite shell: heading + live subtitle + pill bar + actions. Default / Many views / Edited / First run (empty)

Pure logic lives in presentation.ts (splitSavedViews, filterSavedViews, DocumentSavedViewVm) with unit tests in presentation.test.ts — no presentation logic in client files.

Worknav vs. views — visually distinct (AC)

The matter Worknav (section tabs — Brief, Strategy, Documents…) and the saved-view bar are two different axes of navigation and must never read as the same control. They are deliberately rendered with different shapes:

BriefStrategyDocumentsFilingsChronology
Documents
142 files · grouped by Document type
📁 All documents ★ 📁 Financial evidence 📁 Unfiled 📁 Needs review More · 3 ▾ + New view

The More overflow (AC: “overflow More menu works”)

At 30+ views the bar would blow out. splitSavedViews keeps the active view and every starred view inline, fills the bar to a cap (default 5), and spills the tail into a Radix Popover: a search box + scroll list, filtered live by filterSavedViews, with an explicit empty state when nothing matches. Selecting a view fires onSelectView, closes the popover, and resets the query. Keyboard-operable and focus-managed via the shared primitive.

Scope boundary — what this ticket does NOT own

DOCS-CHROME is the shell. The triggers fire callbacks; the surfaces they open belong to sibling EPIC-1489 tickets that wire into this same chrome:

The saved-view shape is the canonical generated DTO — DocumentSavedViewVm = Pick<DocumentSavedViewListItem, …> imported from @/gen — so the chrome can never drift from the backend contract. Live-data seam: the live Documents route renders this header with views from useAppListDocumentSavedViews and a real documentCount once SAVEDVIEWS-WIRE lands; until then the shell is exercised through Storybook with fixture views.

Mode discipline: AI-filled fields (suggested name, AI document type/tags) are EPIC-009 (Mode 2/3) — out of this chrome entirely. Tenancy: saved views carry firmId/matterId on the generated DTO (firm-scoped + RLS on the backend). No new executable domain operation is introduced here, so no manual span is added (ADR-124 — presentational UI).

i18n & tokens

Verification

Files changed

13 file(s), +805 / -0 lines

Path Role + -
messages/en.jsonConfig+16-0
messages/hi.jsonConfig+16-0
src/components/matter-detail/documents/document-view-pill.stories.tsxComponent+49-0
src/components/matter-detail/documents/document-view-pill.tsxComponent+74-0
src/components/matter-detail/documents/documents-story-fixtures.tsComponent+21-0
src/components/matter-detail/documents/documents-view-pills.stories.tsxComponent+70-0
src/components/matter-detail/documents/documents-view-pills.tsxComponent+136-0
src/components/matter-detail/documents/documents-work-mode-actions.stories.tsxComponent+43-0
src/components/matter-detail/documents/documents-work-mode-actions.tsxComponent+79-0
src/components/matter-detail/documents/documents-work-mode-header.stories.tsxComponent+86-0
src/components/matter-detail/documents/documents-work-mode-header.tsxComponent+88-0
src/components/matter-detail/documents/presentation.test.tsComponent+68-0
src/components/matter-detail/documents/presentation.tsComponent+59-0