Skip to content

refactor(frontend): untangle the workspace store, services and trial display - #152

Merged
safina57 merged 1 commit into
stagingfrom
refactor/frontend-untangle
Nov 9, 2026
Merged

safina57 merged 1 commit into
stagingfrom
refactor/frontend-untangle

Conversation

@safina57

@safina57 safina57 commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Untangles the frontend so a typical change lands in one place.

Structure

  • Store owns the workspace rules. Opening a bookmark, removing a context trial (its pin goes with it), clearing a stale selection and saving/restoring the workspace around the tour are store actions instead of logic spread across HomePage and the tour.
  • Panels read their own state. Chat, map, summary and bookmarks use the store and hooks/useWorkspace.ts. HomePage only picks DesktopLayout or MobileLayout; MobileLayout goes from 13 props to 3.
  • One trial cache key. trialQuery() replaces ['trial', ref] from 7 places and the fetchTrial prop that existed only for tests.
  • One API client. services/api.ts replaces the fetch, error and camelCase code copied into six services.
  • One status vocabulary. constants/trialStatus.ts (key order is display priority), StatusDot and StatusLabel, plus title, place and site-key helpers in lib/trial.
  • Shared UI. BrandTitle (header, mobile menu, consent), LanguageOptions (gate, picker, mobile menu), the PDF owns its English copy, MapPanel places its own overlays (compact, topInset).
  • No copied CSS durations. Timers that mirrored transition lengths now wait on the browser (lib/motion).
  • Dead code removed (TrialMarker, extractTrialRefs, unused Turnstile fields, Ontario geojson, 8 unused locale keys).

Fixes

  • Trials added to the chat now show under the user's message again (useChat wrote a field renamed in feat: wire the agent to the full CTC corpus #102).
  • PDF export no longer stalls about 3s when the data-freshness endpoint is down.
  • Bookmark badges show the status in the chosen language.
  • A chat turn that drops the selected trial clears the selection instead of leaving an empty expanded summary.
  • Failed feedback shows a toast and can be retried.
  • Screen-reader labels for citations, definitions and NCT chips are translated.

Visible changes

  • Language tiles use the gate's bordered look everywhere.
  • The consent badge reads "Pre-Release Version", like the header.
  • Dark mode applies on the Terms, Debug and 404 pages too.
  • Favicon is the Camille mark, following the OS light or dark scheme.

The new locale strings (chat.showOnMap, chat.definition, feedback.removeNct, feedback.failed) need a native-speaker check.

@safina57
safina57 force-pushed the refactor/frontend-untangle branch from 4d23dd2 to f0a084a Compare November 9, 2026 13:38
@safina57
safina57 merged commit 6e2c971 into staging Nov 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant