Skip to content

feat(widget): nested region URLs and a unified Region model - #29

Merged
Ardnived merged 15 commits into
mainfrom
feat/nested-region-urls
Jul 5, 2026
Merged

Ardnived merged 15 commits into
mainfrom
feat/nested-region-urls

Conversation

@Ardnived

@Ardnived Ardnived commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Collapse the four parallel region view-models (Country / Region / Area / Venue) into one Region model, one getRegion fetcher, and one RegionPage, and switch routing to hierarchical, ancestry-based URLs (/belgium/flanders/antwerpen; events append /id) resolved by their terminal segment. Every page canonicalizes its URL to the true path and legacy flat URLs redirect.
  • Adopt SahajCloud's server-computed webPath/webUrl (sydevs/SahajCloud#537) as the routing source of truth — no client-side breadcrumb walking, no depth:2 reads, and no redirect flash on normal navigation. Wire per-page <link rel="canonical"> + og:url from webUrl.
  • Ship two data-shape fixes surfaced against live data (null schedule.firstDate_tz, and a safePath scheme guard on server routes) and a pnpm types:openapi dev tool for the API contract.

Changes

  • Types (src/types/): one Region schema + RegionListItem (folds CountrySlim); webPath/webUrl on RegionRef/Region/FeedEvent/EventDoc; BreadcrumbSchema.doc simplified to number | {id} (breadcrumbs now only aggregate counts); firstDate_tz → .nullish(); low-level refs split into region-ref.ts to break an import cycle; deleted country/area/venue.ts.
  • Routing (src/lib/shape/path.ts): parentOf, isCanonicalPath, resolvePath, and the safePath trust guard; removed the client path-builders. src/lib/url.ts adds validateWebUrl for canonical-link safety.
  • Data layer (src/config/api/fetch.ts): one getRegion(slug); select webPath/webUrl; depth:1; regionRoute/toSlim/getEvent fall back to /slug·/id behind safePath.
  • Pages/map: one region.tsx; event.tsx; App.tsx splat route + initialPath from webPath; Map.tsx navigates by webPath; EventMetadata canonical guarded.
  • Tooling: scripts/fetch-openapi.mjs + types:openapi (gitignored openapi.json, password from .env.local); refresh notes in implement-issue skill + environment.md.

Verification

  • Lint ✓ · Types ✓ · Tests ✓ (co-located unit lane) · Build ✓ · Ladle ✓
  • /simplify (centralized the webUrl http(s) guard), a single /code-review (high), and a security-review — all triaged; fixes committed.
  • Validated against the seeded local :3000 backend: 487 events load and parse; region webPath resolves (/belgium, webUrl base atlasreact.sydevelopers.com).

Manual / visual verification (still recommended)

Automated checks are node-only; please confirm in a running widget with published events:

  1. Country → region → area → venue → event drill-down; URLs match the ancestry; back buttons + map/list clicks land correctly.
  2. Region-optional / venue-optional shapes and legacy flat URLs (/areas/:slug, /events/:id) redirect to the nested path.
  3. <link rel="canonical"> / og:url resolve to the Atlas host on event/region pages.

Notes for reviewer

  • Event webPath is null for unpublished events (it's published-gated server-side; region webPath isn't). The widget degrades gracefully — feed/event routes fall back to /id — so nothing breaks, but canonical event URLs only appear once events are published. The safePath guard means a hostile/misconfigured webPath (scheme or //host) can never reach an <a href>.
  • Follow-up (pre-existing, not fixed here): resolvePath treats an all-numeric terminal segment as an event id, so a region whose slug is purely numeric (e.g. a center named "108") would misresolve. It was introduced in the first batch; flagging for a decision — worth a disambiguation ticket if numeric region slugs are possible.
  • Latent: 16 seed events have null firstDate (not just firstDate_tz); z.coerce.date() silently coerces those to epoch (1970). Separate from this PR; noted for a follow-up.

Closes #26

🤖 Generated with Claude Code

Ardnived and others added 7 commits July 1, 2026 18:43
Collapse the four near-identical view-models (Country/Area/Venue + the
old region view-model) into a single `Region` schema that branches on
`level`: country/region carry `subregions`, city/center carry `events`,
and `center`/`countryCode` are derived for the levels that need them. Fold
the home-list `CountrySlim` into `RegionListItem` (keeps `countryCode` for
the flag) and extend `BreadcrumbSchema` so a populated crumb `doc` carries
`slug`/`level` — the ancestor chain nested paths build from.

Split the low-level refs (RegionLevel/Breadcrumb/RegionRef) into
`region-ref.ts` so `event.ts` can reference them without the
region→event→region import cycle that embedding `EventSlim` would create.

Closes #26

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the flat `LEVEL_ROUTES` scheme with nested paths that mirror a
region's breadcrumb slug chain (`/belgium/flanders/antwerpen`); events
append their numeric id. `resolvePath` keys off the terminal segment alone
(all-digits → event id, else → globally-unique region slug), so every
variable-depth shape — region-optional, venue-optional — and the legacy
flat URLs resolve through one code path. `eventStubPath` is the minimal
`/id` route used where ancestry isn't loaded (map/feed), canonicalized on
the event page.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
One `getRegion(slug)` resolves any level (slug is globally unique, so no
level filter) and derives path/parentPath from the breadcrumb slug chain
(read at depth 2 so the crumb docs populate), subregions-or-events by
level, and bounds/center from the feed. `getCountries` now returns
`RegionListItem[]`. `getEvent` reads at depth 2 to build the canonical
nested event path; feed-derived list items stay minimal (`/id`) and
canonicalize on open — until SahajCloud emits a server `webPath` in the
feed (sydevs/SahajCloud#530).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Merge the four region pages into a single RegionPage that branches on
`level` (subregion list vs EventsList), preserving each level's behaviors:
fitBounds / center-move framing, the near-empty venue redirect, the
country flag + localized name, the area subheader, and mapWindow=240 for
centers. A splat route resolves the pathname via `resolvePath` and each
page canonicalizes its URL to the true breadcrumb path (replacing the
legacy flat-URL redirects). Map point clicks navigate by minimal `/id`.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per /simplify — getRegionDoc(slug) and loadGeojson() are independent, so
await them together instead of sequentially (saves a round-trip on the
region-navigation hot path when the feed cache is cold).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address /code-review findings on the URL scheme:

- Encoding-safe canonicalization: compare the decoded pathname against the
  decoded canonical target (isCanonicalPath). The address bar stores non-ASCII
  slugs percent-encoded (/li%C3%A8ge) while paths are built from decoded
  breadcrumb slugs (/liège), so the old raw !== looped navigate(replace)
  forever on accented slugs (Liège, Zürich, München).
- resolvePath no longer throws on a malformed % escape (safeDecode), so a bad
  URL falls back to a region lookup instead of crashing the widget.
- regionSlugChain tolerates breadcrumbs that do OR don't include the region
  itself as the terminal crumb (appends the ref's own slug unless already
  last) — a wrong backend convention no longer drops the region's own segment
  or makes parentPath off-by-one.
- getEvent parses before deriving the path, so a malformed region surfaces a
  clean zod error rather than a raw TypeError.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per security review — only id/slug/level are consumed from a populated
breadcrumb doc, so don't retain arbitrary CMS fields on the parsed object.
No-op for current call sites; shrinks the trust surface.

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

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

Copy link
Copy Markdown

Deploying atlas-legacy with  Cloudflare Pages  Cloudflare Pages

Latest commit: 05afe20
Status: ✅  Deploy successful!
Preview URL: https://5613231a.syatlas.pages.dev
Branch Preview URL: https://feat-nested-region-urls.syatlas.pages.dev

View logs

Ardnived and others added 8 commits July 5, 2026 16:33
Regenerated types add the server-computed webPath/webUrl/appUrl trio to
Region, Event, and Page (virtual, published-gated). The Atlas widget uses
Region/Event webPath (canonical route) and webUrl (absolute) — integrated
in the following commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
SahajCloud#537 now emits canonical routes server-side, so the widget
navigates to final URLs directly instead of building them from breadcrumbs:

- Schemas carry webPath (RegionRef, FeedEvent, EventDoc) + webUrl
  (RegionRef, Region view-model); BreadcrumbSchema.doc simplifies back to
  number|{id} (breadcrumbs are now only for count/bounds ancestry).
- fetchers select webPath/webUrl and drop depth:2 + the breadcrumb-slug
  populate; region path = webPath, parentPath = parentOf(webPath), children
  and feed events use their own webPath. Map clicks and initialPath use
  webPath too — so normal navigation no longer round-trips through a
  redirect. The canonicalize redirect stays only for legacy/stale URLs.
- path.ts drops the client path-builders (regionPath, regionSlugChain,
  regionRefPath, ancestorSlugsFromBreadcrumbs, eventPath, eventStubPath);
  keeps resolvePath, isCanonicalPath, and a new parentOf.
- SEO: event/region pages set <link rel="canonical"> + og:url from webUrl;
  the search page replaces its hardcoded wemeditate.com/map with the client
  home region's webUrl. (Event sharing already used event.webUrl.)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The geojson feed returns firstDate_tz=null for events with no stored
timezone (now visible with prod seeded), but the collection type marks it
a required SupportedTimezones — so GeojsonSchema.parse threw and the home
page failed to load. Widen it to nullish; consumers already fall back to
UTC (details.tsx, lib/shape/event.ts).

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

`scripts/fetch-openapi.mjs` fetches the (HTTP basic-auth'd) OpenAPI spec to
src/types/payload/openapi.json — gitignored, alongside the committed
types:cms output. The docs password is read from SAHAJCLOUD_DOCS_PASSWORD
(.env.local), never committed. Document the refresh step in the
implement-issue skill for data-layer work, and note that live data is
authoritative where it diverges from the contract (the firstDate_tz null).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Extract the repeated `webUrl && /^https?:/i.test(...)` canonical-URL guard
(region + index pages) into `validateWebUrl` — one place enforces the
http(s)-only safety before a webUrl reaches a <link rel=canonical>/og:url
href, matching SafeUrlSchema's intent for the plain-string region/client
webUrls that aren't zod-guarded.

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

Per security review — webPath/webUrl are server strings now feeding <a href>
and navigate(). A `safePath` guard trusts a webPath only if it's a site-
relative route (leading `/`, not protocol-relative `//`); anything with a
scheme (`javascript:`, `https:`) or `//host` is rejected and the widget builds
its safe `/slug`·`/id` fallback instead. Applied at every server-webPath sink
(regionRoute, toSlim, getEvent, Map click, initialPath). Not reachable with the
current backend slugify, but the public bundle shouldn't extend implicit trust
to a server-derived navigation target.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per code review — the old regex captured `[^"'\n#]+`, silently truncating a
password at the first `#` (common in generated secrets) → wrong Basic-auth →
misleading 401. Now match the value to EOL: take the inside of a quoted value
(ignoring a trailing ` # comment`, matching the other .env.local vars), else
the raw trimmed value so `#` is preserved.

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

Per code review — EventMetadata already emits <link rel="canonical"> + og:url
from event.webUrl, so the block added to event.tsx was a duplicate; remove it.
Guard EventMetadata's canonical/og:url with `{url && …}` so an unpublished
event (null webUrl) no longer renders an empty `href=""`/`content=""`.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit be4149c into main Jul 5, 2026
3 checks passed
@Ardnived
Ardnived deleted the feat/nested-region-urls branch July 5, 2026 20:09
Ardnived added a commit that referenced this pull request Jul 9, 2026
* feat(theme): derive --background from the ladder app-bg step

Tints the page/panel surface in both modes from the seed's hue + capped
saturation at the Radix app-background shade, instead of the previous
light-only raw-seed override — so a near-black seed no longer blackens
the panel and dark mode now picks up the themed surface.

Pre-existing local change, preserved on this branch ahead of the drawer rework.

* build(deps): add [email protected] (exact pin) for the drawer system

Vaul supplies the non-modal + nested + directional + snap drawer primitives
for the URL-driven nested-drawer navigation rework. Pinned exactly; vaul is
feature-complete but unmaintained (revisit only if a real bug surfaces).

Refs #30

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

* build(deps): patch vaul to forward `modal` to Radix (non-modal a11y)

AC-0 (issue #30) proved vaul 1.1.2's nested + non-modal + directional + snap
+ container-portal combination composes. One gap surfaced: vaul never
forwards its `modal` prop to Radix `Dialog.Root`, so Radix always runs modal
— `hideOthers()` aria-hides the background and a trapped `FocusScope` seizes
focus even when vaul `modal={false}`. On desktop the root drawer is always
open, so the map would be permanently unreachable by AT + keyboard.

Forward `modal` so `modal={false}` is truly non-modal. Verified via the spike
(Playwright): map no longer aria-hidden, no `data-aria-hidden` markers, focus
stays on the map, mouse-through preserved through 5 stacked drawers, and a
map-click does not dismiss drawers. Pinned patch via pnpm patchedDependencies
— the issue's pre-authorized vendored-fork mitigation.

Refs #30

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

* feat(atoms): add vaul-based Drawer atom + vendored drawer CSS

The Drawer atom wraps vaul with tailwind-variants slots, portaling into the
themed widget root via overlayContainer() (mirrors the Modal atom). Renders a
root or `nested` drawer, directional (left ≥md / bottom on mobile), non-modal
so the map/content behind stays interactive, with optional snap points for the
mobile RootView. Sub-components: DrawerContent (portal + positioned panel +
sr-only Radix title for a11y), DrawerHeader/Body/Footer, DrawerClose.

vaul's stylesheet is vendored to src/styles/vaul.css (its package `exports`
map doesn't expose ./style.css, so it can't be @import-ed by specifier) and
pulled into globals.css — it supplies the slide/snap transforms without which
snap sheets render off-screen. Corrected one upstream CSS typo.

Verified in Ladle (Playwright): full-height themed left panel at ≥md, mobile
bottom-sheet, nested stacking, interactive background.

Refs #30

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

* feat(ui): URL-driven nested-drawer navigation replaces pages/panels

Replace the single floating Panel + Modal model with a drawer stack that is a
pure function of the pathname (issue #30):

- resolveStack(pathname) returns the full ancestor chain; DrawerStack renders
  RootView (non-dismissable base) + one nested vaul drawer per entry. No
  drawer-stack store, no PUSH/POP interception — dismissing a drawer is just
  navigate(parentPath), so the router's history is the stack.
- src/views/ (RootView, SearchView, RegionView, EventView, RegistrationView,
  ShareView) replaces src/pages/. Left panels at >=md, bottom sheets on mobile.
- MapController seam (real + no-op) centralizes camera framing; views call it
  unconditionally so none branch on whether a map exists.
- Reserved-slug guard (search/register/share + legacy events/areas) so a CMS
  region can never shadow a routed view; register/share are deep-linkable.
- Drop canonicalization redirects — the address bar follows navigation;
  canonical/og:url are standalone-only (WidgetMode context).
- Rename organisms/EventView -> EventDetails and molecules/Navbar -> Toolbar
  (drawer footer). De-Modal RegistrationForm. Remove SearchBar, Panel, Modal,
  List/ListHeader, src/pages, src/layouts, and the dead useNavigationState store.

Fathom pageviews are deduped per pathname. lint + typecheck + 118 tests green.

Refs #30

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

* fix(map): give the Mapbox container an explicit fixed/inset size

The map div's viewport-unit / inset Tailwind utilities weren't generating CSS,
so the container measured 0x0 and Mapbox fell back to a 400x300 canvas. Use an
inline fixed/inset style so the map reliably fills the viewport behind the
drawers, independent of utility generation.

Verified in the running app: full-viewport basemap, RootView drawer + a nested
RegionView drawer over it, map interactive behind (non-modal).

Refs #30

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

* feat(widget): map-less mode + rename element to <sahaj-atlas>

Add the map=false axis (issue #30):
- Rename the custom element <syatlas-map> -> <sahaj-atlas> (mode-agnostic); vite
  styleId + demo.html updated. Standalone #syatlas mount id unchanged.
- <sahaj-atlas map="false"> and standalone ?map=0 both render content-only (no
  MapProvider/Mapbox, no token); MapController is the no-op impl so no view
  branches on the map flag. Default on both surfaces is the full map.
- Map-less: RootView renders inline (filling the widget container); deeper views
  are `contained` drawers (absolute, portaled into the container). The WidgetMode
  context carries standalone + hasMap.
- Viewport audit: drop the dead window scroll/resize padding effect and the
  #syatlas-main DOM-measuring updatePadding (padding is the MapController's job);
  the 100dvh height stays gated to the standalone build.

Verified running (?map=0): no map canvas, inline base, a contained drawer
portaled into the widget container.

Refs #30

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

* feat(views): i18n keys, debounced md breakpoint, hoisted registration draft

- Add the missing UI strings (common: back / search / error.*; events:
  registration.register_for, details.share_event) to the en fallback locale.
- useIsDesktop() debounces the md crossing so a viewport resting near 768px can't
  thrash-remount the drawer wrapper (vaul direction isn't hot-swappable).
- Hoist in-progress RegistrationView form values into a draft store (read once and
  persisted via getState() to avoid a watch<->store loop) so the md-crossing
  remount can't drop a half-filled form; cleared on submit.

Refs #30

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

* docs: update for the drawer-nav rework (issue #30)

Bring CLAUDE.md, DESIGN_SYSTEM.md, and the affected .claude/rules + docs in
line with the shipped architecture: the <sahaj-atlas> element name, src/views/
replacing src/pages+layouts, the Drawer atom replacing Modal, Toolbar replacing
Navbar, the resolveStack-driven navigation model (no drawer-stack store), and
the MapController seam (real + no-op) for map vs map-less. Rewrites
.claude/docs/architecture.md's data-flow diagram and layer table to match.

Refs #30

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

* refactor: simplify per /simplify pass over the drawer-nav branch

Four parallel reviews (reuse/simplification/efficiency/altitude) over the full
branch diff. Applied:

- shared.tsx: useFrameOnTop(isTop, frame, deps) replaces the identical
  `if (isTop) frame...()` effect duplicated across all 6 Views.
- shared.tsx: ViewFooter (<DrawerFooter><Toolbar/></DrawerFooter>) replaces the
  same two lines repeated in all 6 Views.
- shared.tsx: useEventFromPath(eventPath) replaces the duplicated
  resolvePath+useSuspenseQuery boilerplate in RegistrationView/ShareView.
- shared.tsx: DrawerLoading/DrawerErrorFallback now compose Spinner/Alert the
  same way the top-level Fallbacks.tsx does, instead of hand-rolled markup —
  the error fallback now renders as a proper danger Alert, not a bare <p>.
- DrawerStack.tsx: memoize resolveStack(pathname) so it doesn't re-parse the
  URL into the full stack on every render.
- App.tsx: memoize the allowedDomains->primaryDomain derivation.

Declined (documented, not applied):
- Threading EventView's already-fetched Event down to RegistrationView/ShareView
  as a prop instead of useEventFromPath's own query: TanStack Query dedupes by
  the shared ['event', id] key, so there's no real duplicate network fetch —
  just a second subscription. The prop-threading would need EventView's
  children contract to change from plain ReactNode to a render-prop, a broader
  structural change for a benefit that's mostly already free.
- A generic ViewFrame/DrawerShell wrapping header+body+footer: each view's
  header differs too much (search field vs. back+title vs. none) for a shared
  shell to reduce duplication without a pile of optional slots.
- Deriving renderEntry's parentPath via lib/shape's parentOf(path) instead of
  entries[index-1].path: RESERVED_SLUGS causes some URL segments (legacy
  events/areas prefixes) to have no stack entry, so entries[] indices don't
  align 1:1 with URL segments — parentOf(entry.path) would compute the wrong
  parent for those legacy URLs (e.g. '/events' instead of '/' for
  '/events/507'). The index-based derivation is the correct one.
- Extracting DrawerStack's recursive renderEntry into a memoized component: no
  demonstrated re-render problem (MapController's context value is already
  memoized; recursion depth is small), so the added indirection isn't justified.
- Debouncing the RegistrationView draft-store writes on every keystroke: the
  store has no reactive subscribers (read only via getState()), so the writes
  are cheap and don't trigger re-renders — not a hot path.
- Altitude review found no issues: the hasMap seam is correctly scoped to
  use-map-controller.tsx + DrawerStack.tsx only, and the vaul patch fixes the
  one dropped prop at its source with no compensating workaround elsewhere.

Verified: lean gate green (118 tests); re-checked in the running app — the
region-not-found fallback now renders as a themed Alert instead of plain text.

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

* fix(views): guard useEventFromPath against a non-event resolved path

Code review (single high-effort pass over the branch diff) found that
resolveStack derives a register/share entry's eventPath from the raw
preceding URL segment without checking it resolves to an event — a
hand-typed `/india/register` would reach useEventFromPath with a region path,
which fell through to useSuspenseQuery(['event', NaN]) and fired a live
getEvent(NaN) request. Only reachable via a hand-typed/bookmarked URL (the
app itself never constructs one), but real: throw a clear error before the
query fires so DrawerErrorFallback renders immediately instead of round-
tripping a doomed request.

Also: document the dormant resolvePath/resolveStack RESERVED_SLUGS
inconsistency (currently unreachable — every caller passes an already-
derived entity path) so a future reuse doesn't reintroduce it silently, and
fix a stale comment in organisms/index.ts referencing the deleted
pages/event.tsx + old EventView path.

Findings reviewed and not changed (documented in the review, not applied):
- A transient container=null vs undefined portal-target gap on the very
  first paint of a map-less deep link below the root — self-heals on the
  ref-triggered re-render before paint; fixing would add render-order
  complexity for an unmeasured one-frame edge case.
- Fathom recording the literal (non-canonicalized) pathname now that the
  canonicalization redirects are gone — an accepted tradeoff of the issue's
  explicit "no canonicalization redirects" acceptance criterion, not a bug.
- The pre-existing (PR #29, not this branch) unused `region.parentPath` zod
  field — out of scope for this diff.

Refs #30

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

* fix(ui): polish drawer nav per review (flags, padding, close, snap points, handle)

Follow-up tweaks on the #30 drawer-nav branch:

- Tailwind `content` still globbed the removed pages/ + layouts/ dirs and never
  scanned src/views/, so any utility used only in a view went ungenerated — the
  RootView country flags fell back to the img{height:auto} reset and ballooned
  to 272px. Scan ./src/** instead; flags now honor h-9 (~2x the label text).
- Drop the default DrawerBody padding so list rows sit flush (cards carry their
  own px-6); RegistrationView/ShareView opt back in with p-4.
- Replace the custom BackButton with a vaul DrawerClose (CloseIcon) in the
  conventional top-right position; DrawerStack's onOpenChange still routes to the
  parent, so parentPath drops out of the views that only used it for the button.
- Mobile snap points were strings ('8rem','0.5','0.97'); vaul parseInts a string
  as px and reads only numbers as fractions, so they resolved to ~8px/0.5px/0.97px
  and the sheet sat off-screen and jumped on any interaction. Use ['128px', 0.5, 0.97].
- Give the drag handle vertical margin (my-3) so it isn't flush to the sheet edge.

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

* feat(views): simulate parent drawers; snap ladder, dismissable root, polish

Rework the drawer stack from real nested vaul drawers to a single drawer holding
the active (top) view, with ancestors simulated as static peek cards behind it.
Real nesting rendered every level at the same position (child fully covering the
parent) and fought vaul on non-dismissable parents, synced peeks and a single snap
ladder; simulating parents makes all of that fall out naturally.

- DrawerStack: one vaul Drawer for the top view; parents are PeekStrips portaled
  behind it, offset by depth so a sliver peeks out (above the sheet on mobile,
  beside the panel on desktop) and tracks the active snap. Clicking a strip pops
  straight to that ancestor.
- Snap ladder (mobile): ['96px', '300px', 0.97] — handle+title peek / lower third
  (title + a list row + a peek of the next) / near-full. Sheets are now full
  viewport height (h-[100dvh]); vaul derives its snap translate from the window
  height, so a content-sized sheet was pushed off-screen. 3dvh bottom padding keeps
  the footer above the fold at the 0.97 snap.
- RootView is dismissable like every other view; dismissing the base collapses to a
  floating "Explore" reopen button (map mode only — map-less has nothing to reveal).
- Drawer atom: drop the now-unused nested/NestedRoot path; add a `full` variant so
  the map-less panel fills its container as a real vaul root (close button still
  works); grab cursor on the handle; one drawer type keeps the handle consistent.
- Search field is full width (flex-1 beside the close); remove the footer from
  Registration/Share; cap the registration form at max-w-md.

Verified in-browser across map desktop, map mobile and map-less.

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

* refactor(views): unify drawer handling; collapse-to-peek + stacked ancestors

Follow-up on the simulated-parent drawer nav:

- Rename RootView -> CountriesView for clarity (it's the country list).
- One uniform code path for every view: dismissing navigates to the parent, and the
  one view with no parent (CountriesView) collapses to the peek snap instead of
  closing. Drop the dismissed state, the hasMap-gated close, and the "Explore" FAB
  entirely -- the panel never fully dismisses, so there's nothing to reopen.
- CountriesView's header is now the search field + a stacked-list toggle (no close
  button): the toggle collapses the open list to the peek and expands it back, so the
  peek (smallest snap) is just the search bar + list icon. Search still opens
  SearchView. The toggle hides where there's no snap ladder (desktop / map-less).
- Ancestors now render as semi-transparent panels (opacity fading with depth) stacked
  behind the active sheet, so the stack reads as fading cards over the map rather than
  two separate drawers. They mirror the sheet's live top via a --sy-sheet-top CSS
  variable updated each animation frame, so they track a drag with no lag (previously
  they only moved once the snap settled).
- Add a ListIcon.

Verified in-browser: desktop + mobile, drag tracking, collapse toggle, map-less.

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

* refactor(views): persistent sheet + cross-fade transitions; desktop floating panel

- Make the vaul sheet persistent: DrawerStack renders one DrawerContent and the views
  are just its inner content (header/body/footer fragments). Navigating no longer
  remounts/re-slides the drawer -- previously a view-type change remounted Vaul.Content
  and vaul replayed its open animation, so opening some views slid in and dismissing
  one slid the parent back in "as if newly opened". Now every transition is a quick
  content cross-fade (framer-motion AnimatePresence, popLayout), consistent across all
  views. CloseButton dismisses via the control seam (a navigation) instead of vaul's
  Close, so the sheet stays put.
- Desktop: the drawer floats with a 1rem margin (map visible around it) and rounded
  corners matching the stacked ancestor panels; those panels round + inset to match.
- Halve the stacked ancestor peek thickness (mobile 8px, desktop 6px).
- Views drop the now-unused children prop; the persistent DrawerContent carries a
  single generic dialog title.

Verified in-browser: mobile (no slide on open/back, cross-fade, collapse), desktop
(floating + rounding + stacked peeks, event view), map-less.

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

* fix(views): nest region event paths, align event title, animate the peek stack

- Region events fell back to a flat `/<id>` path (an event's webPath is null), so
  opening one dropped the region ancestry and stacked it straight on the country
  list. Nest each region event under its region path (`<region>/<id>`) so the URL --
  and thus the peek stack -- keeps the full country -> region -> city -> event chain.
- EventDetails title drops its extra `pl-5` (only applied when the event has no
  image), which had indented it past the rest of the event content.
- Peek strips are framer-motion elements now: they ease out to make room as the stack
  grows (a new panel enters from under the sheet, existing ones slide further out) and
  reverse on close, instead of a strip popping in/out. Mobile keeps the live rAF sheet
  tracking on `top`; only the depth offset (transform) animates.

Verified in-browser (desktop + mobile): event opens with full ancestry + back, title
aligned, strips slide on push/pop.

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

* fix(views): simplify share/register headers + summary; event-card + description polish

- Share/Registration headers are now the static "Share Meditation" / "Register for
  Meditation" (drop the interpolated event title); the i18n keys are renamed to match.
- RegistrationView shows a compact event summary (title, address, recurrence) above
  the form so the core details stay in view while filling it out.
- Tighten the event description line-height (leading-snug).
- Remove the "More info" label + chevron from the event cards (the whole card is
  already the link).

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

* fix(views): thinner mobile peek, drawer border, subtle close, tablet-flush drawer

- Mobile stacked-peek 8px -> 5px (~37% thinner).
- Give the drawer the same divider border as the ancestor peek panels.
- Make the close control more subtle (muted gray, slightly smaller); the CountriesView
  header toggle shows the list icon at the peek and the close icon once opened past it.
- Drop the floating margin on tablet: md-lg is flush + square, only >=lg floats +
  rounds -- for the drawer and the peek strips alike.

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

* feat(ui): floating settings cog with language + theme (incl. Auto) dropdown

Replace the drawer footer (Sahaj Atlas wordmark + LanguageSelector + ThemeSwitch)
with a floating cog that opens a Radix DropdownMenu:

- Two rows -- language and colour mode -- each an icon + the current choice, opening a
  submenu (RadioGroup) to change it. Built on @radix-ui/react-dropdown-menu for a
  clean menu + submenu flow.
- Theme gains an "Auto" option: the preference (light/dark/auto) is stored and, when
  auto, resolves to prefers-color-scheme and re-applies on system change. The resolved
  class on the root stays the single source of truth for NextUI/Tailwind/Mapbox.
- use-theme exposes useThemePreference (preference + setPreference) alongside the
  existing resolved useTheme; getInitialTheme/initTheme resolve an 'auto' preference.
- Remove ViewFooter + the Toolbar/LanguageSelector/ThemeSwitch molecules. Add a cog
  (SettingsIcon) + MonitorIcon and the settings/theme.* i18n labels.
- The cog floats top-right below the geolocate control (map mode) / bottom-right of
  the container (map-less); the menu portals into the themed root.

Verified in-browser (desktop): dropdown, both submenus, Auto persists + resolves to
system + relabels, language en/fr, footer gone.

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

* refactor: simplify per /simplify pass over the drawer-nav branch

- Drop the vestigial `isTop` param (always true) from the 6 drawer views and
  `useFrameOnTop` — only the top view renders, so each frames the map on mount.
- Add a `childRoute` path helper (inverse of `parentOf`) and use it in the
  region-events fetcher instead of composing the path inline.
- Extract the shared header icon-button className in views/shared.
- Move PeekStrip's left geometry to responsive Tailwind classes (mirroring the
  Drawer atom) and drop the `margin` prop / `stripMargin` / `DESKTOP_MARGIN` /
  `useBreakpoint('lg')`.
- Cache the vaul sheet lookup in the rAF loop instead of re-querying every frame.
- Remove the dead `inline` DrawerContent fallback (slot + context field + branch).
- `useTheme` returns only `{ theme }` (drop unused `isDark`/`isLight`).

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

* fix(theme): stop the system-theme watcher on widget teardown

The 'auto' preference engages a module-level matchMedia('change') listener that
was never released, so a torn-down embed (a host SPA unmounting the widget on a
route change) kept firing the callback against a detached wrapper — or the host
page's <html>. Disengage it in BrandTheme's unmount cleanup, alongside releasing
the theme root, via a new stopSystemWatch() export.

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

* fix(views): validate the ?bbox search param before framing

SearchView parsed ?bbox with a raw split().map(Number) cast while ?center was
finiteness-checked, so a malformed/truncated hand-typed bbox fed NaNs into
frameSearch → fitBounds (where Mapbox can throw). Add parseBounds to require four
finite numbers, else fall back to the centre/reset like center already does.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.

feat(widget): nested region URLs and a unified Region model

1 participant