11 KiB
Application shell, ribbon and Quick Access
The authenticated, non-marketing branch of _Layout.cshtml renders _ApplicationShell.cshtml. It contains one title/Quick Access/context row, a command category row and a compact grouped command surface. Public pages retain _ApplicationNavigation and their existing styling/theme behaviour. Feature page layouts and business logic are unchanged; the Series Dashboard (Projects/Details) is the Phase 1 reference workspace.
Navigation and permissions
ApplicationNavigation continues to resolve project context through the current user's project repository and restrict book choices to that project's non-archived books. Project switching still leads to Projects; the project and book dropdowns retain the existing actions. Account, subscription, admin, logout and Word Companion status controls remain available.
ApplicationRibbon.Categories defines categories, groups and commands. Most commands refer to ToolbarCommands by stable key and share its icon, destination and context rules. Ribbon-only commands specify controller/action, scope (global, project ID, route id, book ID, or chapter creation's bookId) and owner-only visibility. Destination controllers retain their own authorisation checks. An unavailable command has no href and exposes aria-disabled; no book is silently selected.
| Category | Groups and commands |
|---|---|
| Project | Workspace: Overview, Projects, Writer, Import. Project: Edit project, Add book, Activity. Manage: Collaborators, Backup, Restore points. |
| Book | Selected book: Book overview, Edit book, Add chapter. Manuscript review: Review Centre. Library: Overview, Add book. |
| Story | Story structure: Timeline, Calendar, Threads, At This Point. Analysis & planning: Review Centre, Scenarios, Continuity. Writing: Writer. |
| Characters | Cast: Characters, Names. Connections: Relationships. |
| World | Setting: Locations, Floor Plans. Story world: Assets. |
| Tools | Reference: Story Bible. Insights: Metrics, Health, Warnings. Organisation: Archive. |
| Help | Support: Help Centre, Feature Requests (including attention count). |
No nonexistent Plot Lines landing page or new AI command was invented. Threads uses the established PlotThreads route; Review Centre uses the existing book review action. Owner-only collaborators/backup remain owner-only.
ApplicationRibbon.ActiveCategory uses the controller and existing ActiveSection, not URL substring matching. Category selection changes the visible commands without navigation. ARIA tabs expose selection and support arrows, Home and End; Tab reaches actual commands. Links independently mark the current feature with aria-current. application-navigation.js still follows Calendar/At This Point asynchronous book changes and updates book-scoped links using only authorised menu choices.
To add a ribbon command, add it to a category/group in ApplicationRibbon. Reuse a Quick Access key when possible. Extend scoped route generation for new parameter shapes, and include required availability/permission checks. Each command has a meaningful inline SVG and text. No icon or drag/drop framework was added.
Quick Access Toolbar
The former standalone toolbar is now embedded in the title row. _ApplicationToolbar.cshtml, its editor, stable registry keys, ToolbarController.Save and IToolbarPreferenceRepository are retained. Compact icons have full accessible names and native tooltips; the ribbon retains visible labels. The account menu and ellipsis button open Customise Quick Access Toolbar.
Default keys/order remain Overview, Timeline, Calendar, Characters, Threads, Relationships and Review Centre. Optional commands remain Locations, Assets, Names, At This Point, Scenarios, Floor Plans, Story Bible, Continuity, Metrics, Health, Warnings, Archive, Projects and Writer.
dbo.AppUser.ToolbarCommandKeysJson, introduced by migration 201, is unchanged. NULL follows current defaults; an ordered JSON key array is a complete custom configuration (membership = enabled, absence = disabled). An empty array intentionally hides all shortcuts. Newly introduced commands are not appended to custom arrays. Removed keys are ignored, remaining order retained, malformed JSON falls back to defaults. URLs are never persisted.
The editor retains native drag/drop, named up/down controls, checkboxes, scrolling, Restore Defaults, Cancel and Save. Changes update the visible toolbar only after successful persistence. Cancel/Escape/backdrop leaves the saved toolbar unchanged. Save requires authentication and antiforgery and never accepts a target user ID. To add a Quick Access command, extend ToolbarCommands.All with a unique key, label, 24x24 SVG path, actual destination, context requirements, section and default membership. Registry order determines default order.
Four-theme architecture
ApplicationAppearance.Themes is the source for the four named choices:
| UI label | Stored identifier | Character |
|---|---|---|
| Modern Light | modern-light |
Neutral white/light grey, charcoal text, restrained copper accent. |
| Modern Dark | modern-dark |
Neutral charcoal, differentiated dark surfaces, amber accent. |
| Warm Light | warm-light |
Existing parchment/editorial character. |
| Warm Dark | warm-dark |
Existing brown-black surfaces and warm text. |
application-shell.css defines one component system. Themes primarily override semantic --pd-* tokens: workspace, surface, secondary/elevated surface, chrome/secondary chrome, borders, text/muted/heading, accent/hover, focus, status colours and functional icon colours. UI typography uses the existing Segoe/system sans-serif family; literary headings retain the shared serif family. Functional icon tones (books, planning, calendar, characters, locations, relationships, review and warning) are shared between Quick Access, ribbon and statistics.
html[data-app-theme] selects the application theme. data-theme and Bootstrap data-bs-theme remain light/dark for compatibility with existing pages. Scoped token aliases bridge the existing --plotline-*, --app-* and Bootstrap variables. The legacy binary theme script exits only when an application theme is active; public pages retain their original script and browser-local preference. Update tokens rather than copying component rules to add/change palette values.
Migration 202_UserApplicationAppearance.sql adds nullable AppUser.ApplicationThemeKey and RibbonCollapsed (default false), plus UserAppearance_Get, UserAppearance_SaveTheme and UserAppearance_SaveRibbon. AppearanceRepository uses only stored procedures. Appearance belongs to the account and is removed with account deletion; Quick Access JSON is never modified by appearance changes. Apply migration 202 before deploying this shell.
The layout reads the account preference and applies it before CSS paints. When no account choice exists, the existing plotline.theme browser value maps dark → Warm Dark and light/unset → Warm Light (preserving the prior default). The client then saves that choice with OnlyIfUnset, so a legacy browser cannot overwrite an explicit account choice made elsewhere. No old browser preference is deleted or overwritten. All later explicit changes persist to SQL, apply immediately without navigation, and survive browser sessions. Authentication, antiforgery and allowlisted identifiers protect writes. Failures revert the visible theme and show an error in the appearance picker. Concurrent explicit saves are last-save-wins.
The ribbon collapse control persists independently per user. Selecting a category while collapsed temporarily reveals its commands; the saved collapsed state returns on the next page. Explicit Expand changes the saved preference. Failure restores the prior state.
Reference Dashboard and responsive behaviour
Projects/Details uses a pd-dashboard wrapper and a wide pd-dashboard-shell container. All counts, actions, warnings, progress calculations and book data are unchanged. A nine-stat band adds functional icons, preserves labels and uses subtle separators instead of individual bordered cards. The reference components use restrained surfaces, modest corner radii, small status badges, clear project actions, lighter progress treatment, serif book/project headings, and consistent Recent Activity/Worth a Look presentation. Other feature pages are not independently redesigned.
On smaller screens, title/context rows adapt, Quick Access scrolls horizontally, category tabs scroll and each ribbon panel keeps its command groups on a horizontally scrollable row. No command is removed for screen size. Dashboard statistics reduce to five/three columns. Focus outlines, ARIA-selected/expanded/current states, labelled icon controls and keyboard reorder alternatives are retained. Reduced-motion preferences disable transitions/animation in application scope.
Verification
dotnet build PlotLine.slnxdotnet run --project PlotLine.Tests/PlotLine.Tests.csproj- Start the isolated host from the repository root:
dotnet run --project PlotLine.Tests -- --toolbar-browser-host - In
PlotLine.Tests/Browser, runnpm run test:toolbar.
The loopback fixture host renders the real compiled shell, editor, Calendar surface and Series Dashboard with in-memory preferences. It starts no application workers and accesses no live database. Browser coverage includes existing Quick Access behaviour, save failures/empty configuration, independent users/sessions, project/book links, asynchronous book changes, CSRF, category switching/keyboard access, collapse persistence, four themes, Dashboard values and narrow layouts. Screenshots go to /tmp and are not committed. Migration 202 is also tested twice in a disposable database, including preservation of Quick Access and explicit themes; the database is removed afterwards.
Phase 2: migrate individual feature-page components systematically to the new tokens after visual approval. Existing legacy feature-specific CSS remains intentionally outside this reference-page refresh. Audit the pre-existing Pkcs dependency advisories separately from visual work.
Application customisation
The account menu's Customise PlotDirector… dialog saves Quick Access order/visibility together with two independent application-bar preferences: ShowProjectContextMenu and ShowBookContextMenu. Both default to true, including for existing accounts migrated by SQL 203. Hiding a root menu changes rendering only; navigation context, routes, permissions and the system-defined dropdown contents are unchanged. Save persists the draft for the account, Cancel discards it, and Restore defaults restores the default Quick Access list plus both menus while leaving theme and ribbon collapse untouched.
Application-bar visibility belongs to ApplicationAppearance, is loaded through UserAppearance_Get, and is saved through a narrowly scoped stored procedure. Future root-control visibility preferences should follow this pattern: default-on schema column where compatibility requires it, appearance DTO/repository mapping, conditional server rendering so hidden controls do not remain focusable, and inclusion in the single customisation Save/Cancel draft.
For installation, service-worker policy and OS integration, see Installable application.