ADR-0024: App shell and design system v2¶
Status: Accepted, 2026-09-30. Supersedes ADR-0012.
Decision owners: Owner.
Scope: everything under frontend/src/; the contract is docs/DESIGN.md.
Context¶
The interface grew screen by screen: a navy gradient bar with the section
links, a left sidebar that was global navigation on one page and a document
panel on another, a tall upload box above the document list, projects as
tall cards with two numbers, serif text in menus and forms, orange as the
colour of every link and focus ring, and a dozen local variants of buttons,
menus and inputs. The owner judged the result generic and hard to use and
wrote a new design contract (docs/DESIGN.md, version 2.1).
Problem¶
Rebuild every screen on one structure without changing permissions, API calls or document handling, and choose how the contract maps onto the existing React/Vite/Tailwind 4 code.
Decision¶
- One shell, mounted once.
components/shell/AppShellwraps every signed-in route inApp.tsxat the same tree position, so the sidebar, its scroll and folded groups survive navigation. The reader and share views render inside the same element withme = nulluntil the session is known; children never remount when the chrome appears. Pages declare their breadcrumb withPageContext(a portal into the shell's slot) and their width withPage. - Navigation lives in the sidebar only. Documents (All, Mine, Shared with me, Favourites), Projects (the five most recently opened, then all) and Administration for admins. 256 px expanded or a 64 px rail by a remembered preference on desktop, the rail on tablets, a drawer on phones. The global bar holds search (command palette, Cmd/Ctrl+K), the inbox and the account menu with theme and language.
- Scope and filters are separate. The sidebar picks the scope of the
document list (
?f=state:mineand friends, old links keep working); kind, sharing, source, project, doc type, freshness and tags are toolbar filters that combine (OR within a kind, AND across kinds). The reference mock-up showed kinds and states in the sidebar; the contract (section 7) wins. - Tokens are the only palette.
styles/theme.cssswitches off the stock Tailwind colours, sizes, radii and shadows, so a straybg-blue-500renders nothing, andstyles/designTokens.test.tsnames it. Old token names (paper,ink,rule,navy,font-display) were migrated, not aliased. Theme preference islight,darkorsystem, resolved before first paint byindex.html. - Typography. The UI uses the platform face; Source Serif 4 is only for
document prose, JetBrains Mono for code. Both are self-hosted
(
styles/fonts.css, Latin and Latin Extended subsets only, to stay inside the 10 MiB bundle budget); Mona Sans and the Google Fonts request are gone. - One component per pattern.
components/ui/holds the primitives. AMenuActionlist is rendered as the dropdown on wider screens and the bottom sheet on phones, so an action cannot exist in one and not the other; document rows, the reader's…menu and the phone sheet sharebuildAssetMenuActions. - Reader. The document takes the page. One toolbar (edit, share, focus
mode, inspector,
…) and one inspector with Files (collections), Contents, Details and History: docked at 1280 px and wider, a drawer below. The inspector starts closed, a collection opens on its files, a user's choice is remembered per kind. The old left management panel is gone. - Motion. Anime.js 4 through its WAAPI module, only in
lib/motion.ts(menus, dialogs, drawers, sheets, sidebar tree, badge bump), transform and opacity only, skipped underprefers-reduced-motionand without WAAPI, never awaited by state changes.
Options considered¶
| Option | Cost | Outcome |
|---|---|---|
| Reskin the existing components | Low | Keeps two navigations and the panel sprawl the contract forbids |
| New UI framework (shadcn, Radix) | Medium, new dependencies | Contract asks to reuse what exists; not needed for the primitives used |
| Own shell and primitives on the current stack | High, one pass over every screen | One model everywhere, no new framework, Anime.js as the only addition |
Reactivation trigger¶
Revisit when a screen needs a pattern the primitives cannot express (for example bulk selection in admin tables), or when the bundle budget forces a different font strategy.
Consequences¶
ViewerChrome,AppNav,UserMenu,SidebarShell,SidebarNav,CollectionLayout,AssetRow,AssetList,UploadCard,UploadStrip,AssetToolbar,useViewerToolbar,useSidebar,MenuButton, the oldModal,ButtonandPageHeader,BackgroundGraphandEditableProjectHeaderwere removed.- A new page renders
PageContextandPage, usescomponents/ui/, and adds its routes tonavModelonly when they are navigation. - Uploads start from one "Upload" action (dialog with the audience choice) or a drag over the page; there is no permanent drop zone.
- Admin screens have no tab strip; the sidebar links them.