Skip to content

fix(ui): follow-up fixes for the nested-drawer navigation UI - #36

Merged
Ardnived merged 20 commits into
mainfrom
fix/nested-drawer-followups
Jul 11, 2026
Merged

Ardnived merged 20 commits into
mainfrom
fix/nested-drawer-followups

Conversation

@Ardnived

@Ardnived Ardnived commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up fixes and polish for the nested-drawer navigation shell (#31 / feat #30), plus a second round of Adjust-phase tweaks. Each is its own commit.

Original batch (#35):

  • Drag: the desktop (≥md) left panel is undraggable (vaul handleOnly); dismissal is the close button only, so a drag no longer desyncs the shadow or dismisses the drawer. Applied to both map and map-less drawers.
  • Spacing: balanced handle→header gap on the mobile bottom sheet.
  • Flags: country flags shrink below lg (mobile + tablet), restoring at desktop.
  • Cog: the settings cog moves to the top-left, offset clear of the drawer on ≥md; menu opens from the left (align="start"). Map-less keeps it bottom-left (side="top").
  • i18n: every useLocale consumer relocalizes together on a language change (useSyncExternalStore on languageChanged).
  • Theme: the widget renders the built-in teal/orange default when no real brand palette resolves — achromatic seeds (the backend #000000 sentinel) are treated as unset.
  • DetailRow: the leading icon box is an explicit, always-square discriminated box prop.

Adjust follow-ups:

  • Language switching: Widget.tsx re-applied the embed's locale prop in the render body on every render, clobbering a language the user picked from the menu — removed (App's mount effect already applies the initial locale).
  • Ordering: country and region lists are ordered by event count, busiest first — done in the fetchers (getCountries/getRegion), next to the eventCount>0 filters they already do.
  • Stacking peek: one uniform per-level gap for the whole stack that tightens with total depth (base·0.7^(total−1)) — every level evenly spaced, deeper stacks denser.
  • Polish: smaller collapsed snap point; smaller event description text; drawer text selectable on desktop; smaller settings cog.
  • Tailwind: swapped arbitrary classes for built-ins where exact (text-[24px]→text-2xl, min-w-[11rem]→min-w-44, h-[100dvh]→h-dvh).

Changes

  • src/config/api/fetch.ts — busiest-first ordering moved into getCountries/getRegion via a shared byEventCountDesc comparator (data-layer concern, matching getEvents); the views just render the pre-sorted data.
  • src/Widget.tsx — dropped the render-body i18n.changeLanguage.
  • src/hooks/use-locale.ts — useState → useSyncExternalStore(languageChanged).
  • src/config/theme/palette.ts — isBrandSeed rejects achromatic seeds so primary/secondary fall back to the globals.css default.
  • src/components/molecules/DetailRow/DetailRow.tsx — freeform children → structured box.

Verification

  • Lint: ✓ (pnpm lint)
  • Types: ✓ (pnpm typecheck)
  • Tests: ✓ Unit lane green — 131 tests, incl. DetailRow SSR + palette achromatic-seed regression tests
  • Build: CI runs pnpm build + ladle:build

Manual / visual verification

Driven in the running widget (Playwright, standalone dev against the local backend):

  • Ordering: countries → Brazil (80), United Kingdom (61), Australia (49)… (monotonic desc); a region (UK) → South East (30) … Wales (1). Confirmed after moving the sort into the fetchers.
  • Language: English→Français relocalizes the country list in place, no navigation; localStorage persists.
  • Theme: computed --primary-9 = 176 23% 60% (teal), no inline override — the #000000 client seeds fall back to the default.
  • Drag: a left-drag on the ≥md panel leaves it at transform: none, not dismissed.
  • Cog / flags / DetailRow / peek: cog clears the drawer by 12px at md/lg (32×32 after shrink); flags 28/36px; three 44×44 square DetailRow boxes; peek gaps uniform per stack (2 levels → 4.2px, 4 levels → 2.06px) and denser when deeper; desktop drawer user-select: text.

Notes for reviewer

  • Simplify + code review + security review (dispatched subagents, one high-effort code-review pass) all ran over the Adjust diff. The simplify pass moved the event-count ordering into the data layer (removing two view-level useMemo sorts + a redundant filter). Code review found no correctness bugs; security review found no risk (the fetcher .sort() mutates only freshly-built arrays — not the React Query cache — and the Widget change doesn't touch the auth/host-prop boundary). No findings dismissed.
  • Language regression: standalone switching was already working; the fix targets the embedded widget path (the render-body clobber). Worth a confirm in an embedded pnpm preview build.
  • Map-less cog is bottom-left (not top-left): map-less has no map, so the drawer fills the container and its search header owns the top — bottom-left keeps the cog clear and usable.

Closes #35

🤖 Generated with Claude Code

Ardnived and others added 20 commits July 11, 2026 12:15
On ≥md the drawer renders as a left-anchored panel with no snap points, so
vaul made the whole panel draggable — a drag desynced the shadow and read as a
dismiss of the top-level drawer. Thread a `handleOnly` prop through the Drawer
atom and set it for the left direction; since that panel renders no handle, the
drawer becomes undraggable while the close button still dismisses it. The mobile
bottom sheet keeps its full-panel snap-drag.

Closes #35 (drag)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The handle→header gap read as too large on the mobile bottom sheet. The handle
renders only on bottom sheets, so trimming its bottom margin (my-3 → mt-2.5 mb-1)
tightens the gap on mobile without touching the desktop header rhythm.

Closes #35 (spacing)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The h-9 flags read too large next to the row text below the desktop breakpoint.
Drop to h-7/w-7 under lg (mobile + tablet), restoring h-9 at ≥lg.

Closes #35 (flags)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
useLocale seeded a local useState from i18n.resolvedLanguage and only updated it
through its own setLocale, so toggling the language from SettingsMenu left other
consumers (CountriesView's regionNames) on a stale locale — their
Intl.DisplayNames never rebuilt — until the view remounted. Derive the locale via
useSyncExternalStore subscribed to i18next's `languageChanged` so all consumers
re-read the active language together.

Closes #35 (i18n)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
On localhost the client record returns color1/2/3 = "#000000" (the backend's
unconfigured default). buildScale("#000000") yields a fully-desaturated ramp, so
applyPalette painted primary/secondary grey inline — overriding the built-in
teal/orange globals.css defaults and rendering a grey, un-themed widget.

Treat an achromatic seed (near-zero saturation) like an invalid one in setRole:
the role isn't written and the static default stands. Background is unchanged —
its shade already snaps to the readable app-bg step for any near-black seed.

Closes #35 (theme)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…hapes

The leading slot was a single w-11 h-11 frame with free-form children, so it
wasn't reliably square and the two real box shapes weren't modeled. Replace the
children slot with a discriminated `box` prop — { kind: 'icon', icon } or
{ kind: 'split', top, bottom } — so the box is always square and callers can't
hand-assemble an off-spec slot. Keep the tone variants (icon / highlight / plain).
Migrate the event detail cards + stories and add SSR tests.

Closes #35 (DetailRow)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Follow-up to the handle spacing tweak: the mobile bottom sheet stacked the
header's pt-4 on top of the handle's margin, leaving the handle→header gap
top-heavy. Add a compound variant so the header uses a tighter top padding
exactly when the handle is present (bottom sheet, not the map-less full panel
that hides the handle), for a balanced ~11/13px gap. Desktop panels keep pt-4.

Closes #35 (spacing)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Map mode: move the cog from the top-right to the top-left, offset past the left
drawer on ≥md (flush left-0 on tablet, floating to left-4 at ≥lg) so it never
overlaps the panel; on mobile the sheet is at the bottom, so the corner is clear.
Flip the dropdown to align="start" so the menu opens from the left-anchored
trigger.

Map-less: the drawer fills the container with a search header owning the top, so
keep the cog on the left but at the bottom (clear of the search field), and lift
it to z-50 so it sits above the fill-the-container drawer content instead of
being intercepted by a list row.

Closes #35 (cog)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Dedup the LeadingBox outer box wrapper — compute the inner content once and
return a single wrapper instead of repeating it in both branches.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address code-review findings on the map-less path:
- The >=md left panel omitted handleOnly, so a nested map-less drawer was still
  full-panel drag-dismissible - inconsistent with the map drawer. Pass
  handleOnly={direction === 'left'} there too.
- The bottom-left cog relied on Radix collision-flipping to open upward; add a
  `side` prop to SettingsMenu and pass side="top" so it opens up deterministically
  (a top cog keeps the default bottom). Fix the stale align/side comment.

Closes #35 (drag, cog)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The widget called i18n.changeLanguage(locale) in the render body, so it re-applied
the embed's locale prop on every render and clobbered a language the user picked
from the settings menu. App's AppShell effect already applies defaultLocale on
mount (and on prop change), so remove the redundant render-side-effect.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Each deeper ancestor peeks a little less than the one before (cumulative
  offset base·(1−0.6^depth)/0.4), so a tall stack reads denser and its total
  spread stays bounded instead of fanning out linearly (gaps 6/3.6/2.16/1.3px
  vs a flat 6px).
- Reduce the collapsed peek snap point from 96px to 80px.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vaul disables text selection on the drawer for pointer devices. Desktop drag is
already disabled (handleOnly on the left panel), so re-enable selection there —
event/venue copy should be selectable. Mobile is untouched (vaul only sets
user-select:none under hover+fine).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Reduce the cog from h-10/w-10 to h-8/w-8 (icon 20→16). Swap the menu's arbitrary
min-w-[11rem] for the built-in min-w-44 (same 11rem).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add text-sm to the event description so it reads a little smaller. Swap the
title's arbitrary text-[24px] for the built-in text-2xl (same 1.5rem).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Swap the arbitrary h-[100dvh] for Tailwind 3.4's built-in h-dvh (same value).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sort a region's subregions by eventCount descending so the areas with the most
events lead the list (copy before sorting; equal counts keep the API order).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The previous diminishing offset gave each level a different gap. Instead give the
whole stack a single per-level gap (base·0.7^(total−1)) so every ancestor is evenly
spaced, and the gap shrinks with the TOTAL depth — a taller stack reads denser
(verified: 2 levels → 4.2px gaps, 4 levels → 2.06px gaps).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Mirror the region view: sort the (already event-filtered) country list by
eventCount descending so the busiest countries lead. Equal counts keep API order.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Move the busiest-first ordering into the data layer, next to the eventCount>0
filters the fetchers already do (matching getEvents, which sorts in the fetcher):
- getCountries / getRegion sort subregions/countries via a shared byEventCountDesc
  comparator, so ordering is one testable data invariant instead of two view copies.
- Drop the per-view useMemo sorts + imports and CountriesView's now-redundant
  eventCount>0 filter (getCountries already guarantees it).
- DrawerStack: compute the uniform peek gap once (a stack constant) and pass it to
  PeekStrip instead of recomputing per strip from a threaded total.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Deploying atlas-legacy with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4fdc969
Status: ✅  Deploy successful!
Preview URL: https://3f0303e1.syatlas.pages.dev
Branch Preview URL: https://fix-nested-drawer-followups.syatlas.pages.dev

View logs

@Ardnived
Ardnived merged commit e7f0156 into main Jul 11, 2026
3 checks passed
@Ardnived
Ardnived deleted the fix/nested-drawer-followups branch July 11, 2026 22:54
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.

fix(ui): follow-up fixes for the nested-drawer navigation UI

1 participant