Skip to content

feat(ui): standardise the icon set on Lucide - #178

Merged
Ardnived merged 3 commits into
mainfrom
feat/lucide-icons-main
Aug 28, 2026
Merged

Ardnived merged 3 commits into
mainfrom
feat/lucide-icons-main

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Replaces #177, which merged into its stack base (feat/rethink-sans) rather than main, leaving the icon work stranded behind the still-open typeface PR. This is the same change cherry-picked onto main, without the typeface — #176 stays open while that is evaluated.

Contents: the Lucide swap (#177), the SquarePlay → Play follow-up, and one correction to the bundle-budget comment.

The swap

The catalogue mixed Material, Fluent and hand-drawn glyphs: different grids, different stroke weights, filled next to outlined, seven non-24 viewBoxes. Now one family — 24px grid, 2px stroke, round caps and joins, outline only.

No wrapper, because Lucide already provides the two contracts BaseIcon existed for: it strokes with currentColor and sets aria-hidden="true" itself. size and className mean the same thing, so call sites kept their metrics. Only role="presentation" is lost, which is redundant beside aria-hidden. Verified in the browser: 39/39 glyphs stroking currentColor, 47/47 aria-hidden, 0 empty.

flipRtl did not come for free. It carried RTL mirroring centrally; Lucide has no equivalent, so the six directional call sites declare rtl:-scale-x-100 themselves. Confirmed mirrored in Chrome (matrix(-1, 0, 0, 1, 0, 0)).

Brand marks stay ours — Lucide ships none, and redrawing them is a trademark problem. Icons/ is now exactly that: the Logo plus the three meeting-platform glyphs behind SocialIcon. (The share row's network marks were never ours; react-share renders its own.) Four icons with no reference anywhere are deleted: PlusSquareIcon, ExternalIcon, HeartFilledIcon, SignupIcon.

Alert's info glyph and Spinner's hand-rolled ring are absorbed into Info and LoaderCircle; the spinner keeps its animate-spin, colour variants and live region.

The gallery is usage, not a catalogue

The story lists exactly the glyphs the app imports, and links to lucide.dev for the rest — a curated subset would be a worse copy of a 2,000-icon site, stale on every upstream release.

Icons.usage.test.tsx enforces that in both directions: a newly-used glyph is red until listed, and one that loses its last call site cannot linger. It excludes stories and tests deliberately — Video and Calendar are imported by Chip.stories.tsx alone, and counting those would re-grow the rows the spec exists to keep out.

⚠ Pause and Play look decorative but are the image carousel's pause control, which exists for WCAG 2.2.2. They stay.

Bundle

pnpm size ratcheted 310 → 308: the swap takes ~3 KiB off both eager graphs, since the tree-shaken glyphs cost less than the path data they replaced even after adding the dependency. Re-measured on main without the typeface — the difference is 0.1 KiB, because the woff2 files are separate assets and only the URL strings live in the JS graph.

Open question for the designer

contact and map-pinned from the original brief map to nothing in the app, and the brief omitted the theme picker entirely — I used Lucide's Sun/Moon there. The directions glyph is Milestone (a signpost), replacing the paper-plane Navigation.

Verification

lint · typecheck · test:run (1404) · build · size · ladle:build all green on this branch.

🤖 Generated with Claude Code

Ardnived and others added 3 commits August 28, 2026 15:54
* feat(ui): standardise the icon set on Lucide

The catalogue mixed Material, Fluent and hand-drawn glyphs — different grids,
different stroke weights, filled next to outlined, and seven non-24 viewBoxes.
It is now one family: 24px grid, 2px stroke, round caps and joins, outline only.

**A direct swap, with no wrapper, because Lucide already provides the two
contracts `BaseIcon` existed for.** It draws with `stroke="currentColor"` and
sets `aria-hidden="true"` itself, so colour inheritance and the decorative-icon
a11y treatment both survive untouched. `size` and `className` have the same
meaning, so every call site kept its metrics. Only `role="presentation"` is lost,
which is redundant beside `aria-hidden`.

**What did NOT come for free is `flipRtl`.** `BaseIcon` carried RTL mirroring
centrally for the two directional glyphs; Lucide has no equivalent, so the six
directional call sites now declare `rtl:-scale-x-100` themselves — the drill-in
chevrons (ListItem, SettingsMenu, the calendar's month arrows) and the directions
arrow. Verified mirrored in Chrome under `dir="rtl"`.

**Brand marks stay ours.** Lucide removed its brand icons and redrawing them is a
trademark problem, so `Icons/` is now exactly that: the Sahaja Yoga `Logo` plus
the three meeting-platform glyphs behind `SocialIcon`. (The share row's network
marks were never ours — react-share renders its own.) `actions.tsx`, `records.tsx`
and `symbols.tsx` are gone, and with them four icons that had no reference
anywhere: PlusSquare, External, HeartFilled and Signup.

Two inline SVGs outside the module are absorbed: Alert's info glyph, already
drawn in the Lucide idiom, and Spinner's ring, which becomes `LoaderCircle` while
keeping its `animate-spin`, colour variants and live region.

**`pnpm size` is ratcheted down, 310 -> 308.** The swap took ~3 KiB off both eager
graphs — the tree-shaken glyphs cost less than the path data they replaced, even
after adding the dependency — and the repo's rule is to lower the budget in the
commit that wins the space. Headroom is preserved at the previous line's margin.

`Icons.test.tsx` now covers both sides of the seam: the Lucide contracts the swap
had to keep, and the brand marks we still draw.

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

* refactor(ui): make the icon gallery the app's usage, and link the catalogue

Three changes to the icon story, plus the glyph swap they surfaced.

**Directions is now `Milestone`, not `Navigation`.** A signpost rather than a
paper plane. It still encodes travel direction, so it keeps the
`rtl:-scale-x-100` the previous glyph carried.

**The gallery lists only what the app renders**, and links out for the rest. It
was a curated subset of Lucide, which is the worst of both: stale the moment
upstream ships anything, and an invitation to pick a glyph from our page rather
than from the 2,000 there. `Video` is gone — it was only ever in
`Chip.stories.tsx` — and `Sun`/`Moon` are added, which the original icon brief
omitted entirely despite the theme picker using both.

⚠ `Pause` and `SquarePlay` STAY: they look decorative but they are the image
carousel's pause control, which exists for WCAG 2.2.2 (anything moving for more
than five seconds needs a visible way to stop it). Removing them from the gallery
would have been the easy mistake here.

**A "Browse all Lucide icons" button sits below the gallery**, on the `Button`
atom's href form so the shared href gate covers it. (`Button`'s anchor arm
spreads native `<a>` props — `isExternal` belongs to `Link` — so the new-tab
treatment is written out.)

**The one-way rule is enforced, not remembered.** `Icons.usage.test.tsx` walks
app code — excluding stories and tests, which is exactly the distinction `Video`
turned on — and fails in BOTH directions: a newly-used glyph is red until it is
listed, and one that loses its last call site cannot linger. Both were confirmed
red before the spec was kept. Same reasoning as `href.test.ts`'s anchor
inventory: a rule a person has to re-check is a rule that drifts.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
The plain triangle reads as a transport control at 16px where the boxed variant
reads as a video thumbnail, and it pairs with `Pause` — the two are one toggle.

Both halves move together because they have to: `Icons.usage.test.tsx` fails if
the story's gallery and the app's imports disagree, in either direction.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The ratchet landed on a branch that also carried the typeface change, so the
figure in the comment was measured with it. Re-measured without: the difference
is 0.1 KiB, because the woff2 files are separate assets and only the URL strings
live in the JS graph. The budget itself is unchanged and still correct.

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

cloudflare-workers-and-pages Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2208836
Status: ✅  Deploy successful!
Preview URL: https://a9b938f4.sahajatlas.pages.dev
Branch Preview URL: https://feat-lucide-icons-main.sahajatlas.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sahajatlas-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2208836
Status: ✅  Deploy successful!
Preview URL: https://38c44f04.sahajatlas-design.pages.dev
Branch Preview URL: https://feat-lucide-icons-main.sahajatlas-design.pages.dev

View logs

@Ardnived
Ardnived merged commit 1fe8a66 into main Aug 28, 2026
5 checks passed
@Ardnived
Ardnived deleted the feat/lucide-icons-main branch August 28, 2026 23:00
Ardnived added a commit that referenced this pull request Aug 29, 2026
Every preview deploy of this repo rendered nothing at all, and had done for a
long time — this branch's preview, and PR #178's before it, both ship
`http://localhost:5174/locales/` in the bundle.

`VITE_HOST` composes the absolute URL the locale JSON is fetched from, and it has
to be absolute: embedded, the widget runs on the host's page while its
translations live wherever the bundle came from. Production sets it in the Pages
dashboard. **Preview deploys had nothing**, so they inherited `.env`'s
`localhost:5174` and shipped it to a `pages.dev` origin — every locale fetch then
a cross-origin request to the reviewer's own machine, blocked as private-network
access.

That does not degrade into missing strings, which is what makes it easy to miss.
i18next's `init` never resolves, every component reading a translation suspends
forever, and the page renders blank: no canvas, no content, no readiness marker.

`CF_PAGES_URL` is Cloudflare's own answer — the URL of the current deployment,
documented for exactly this ("allowing build tools to know the URL the page will
be deployed at"). Taking it in `vite.config.ts` rather than adding a dashboard
variable is deliberate: a preview host is per-deployment, so no static value could
work, and this way forks get it too.

Verified against real builds, all three cases:

  pnpm build                            → http://localhost:5174/locales/   (unchanged)
  CF_PAGES_URL=… pnpm build             → https://abc12345.…pages.dev/locales/
  VITE_HOST=… CF_PAGES_URL=… pnpm build → https://sahajatlas.com/locales/  (unchanged)

The third is the one that matters for safety: an explicit value still wins, so
production is untouched and `docs/embedding.md`'s promise to hosts — that UI
strings come from `sahajatlas.com` — stays true. No host-facing change, so that
guide and CHANGELOG.md are deliberately not touched.

Worth noting for whoever reads the smoke lane's invariants: the Smoke job passed
against a preview that rendered nothing, because those specs are fetch-based over
`_headers`, `_redirects` and `robots.txt` and never boot the app. "The specs ran"
was true; it just could not mean "the widget works".

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Ardnived added a commit that referenced this pull request Aug 29, 2026
…uage (#179)

* fix(map): stop an exiting view from commanding the camera

Searching a city and then tapping a pin zoomed the map out to the whole
world before flying back in to the event.

DrawerStack renders the active view inside `<AnimatePresence mode="popLayout">`,
which keeps the OUTGOING view mounted for its 150ms exit — and router context
still reaches it. So SearchView, whose framing deps are `?center`/`?bbox`,
re-rendered under the event's URL, read both as absent, and re-ran its effect:
`frameSearch({})` fell through to `moveMap({ zoom: 0 })`. EventView then
resolved a cold `['event', id, locale]` (map pins are never prefetched) and flew
in from zoom 0.

`topViewKey` names which view the base drawer is actually showing, and
`useFrameOnTop` compares its mount value against the live one — a view that is
no longer on top does not own the camera. It is derived through `baseStackEntry`
rather than compared as a pathname, because a trailing `filters` over the
calendar is a modal overlay whose base view is still the calendar; DrawerStack
now derives `top` through the same helper, so its AnimatePresence key and this
guard cannot drift.

The guard deliberately is NOT "did the location change": a re-search moves
`?center` and must still re-frame the same SearchView. Both cases are pinned.

Also splits the two meanings `frameSearch` was carrying. With no bbox and no
centre nothing was searched, so there is nothing to frame and the camera stays
put — that branch used to reset to the world, which made pressing Search from a
region throw the map to zoom 0 while SearchView was simultaneously snapshotting
that camera to rank by. Framing the world is something only the root view wants,
and CountriesView now asks for it by name via `reset()`, which the seam already
declared and nothing called.

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

* fix(map): let the framing call own the emphasized pin, not a view's unmount

EventView cleared the map's selection from an effect cleanup. Two things were
wrong with that, and neither is reachable by the exiting-view guard, because an
unmount cleanup is never the active view.

It ran 150ms after the incoming view had already framed — the length of the
drawer's exit animation — so on a back navigation it wiped the `selection` and
`boundary` that `restore()` had just reinstated from the camera snapshot, and on
a push to a region it wiped the boundary `frameRegion` had just set.

And its dependency was `clearSelection`, whose identity changes whenever the
controller memo re-creates. That memo depends on the mapbox callbacks, which
depend on the camera padding — so a resize or an orientation change while an
event was open cleared the pin with no navigation involved at all.

The emphasized point belongs to whatever framed the camera last, so
`frameRegion` and `frameSearch` now clear it themselves, beside the boundary
they already cleared. `restore` and `frameEvent` already set both. With no
caller left, `clearSelection` is dropped from the seam rather than kept as an
unused member — an unused seam member is an invitation to write this bug again.

One accepted consequence: opening the calendar over an event no longer clears
the pin, since CalendarView never frames. The calendar is full-width and the pin
is behind it, and `restore` reinstates it on the way back.

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

* fix(map): let a deep link arrive at its place instead of flying in from the world

Loading straight into a region or an event played a long, disorienting zoom:
the map appeared showing the whole planet and then flew across it to wherever
the link pointed.

`<ReactMapGL>` is deliberately uncontrolled and takes no `initialViewState`, so
it boots at [0, 0] zoom 0 while the region or event query is still in flight.
The framing that follows was an ordinary `flyTo`, and a fly from zoom 0 to zoom
15 arcs over half the world.

`useCameraSettled` records whether the camera has arrived anywhere yet. Until it
has, `flyTo` jumps and `fitBounds` fits without animating; everything after
flies exactly as before, so drilling in and backing out stay symmetric.

The predicate is deliberately NOT `isEntry`. That is `atlasDepth(location) === 0`,
which is true for a fresh deep link AND for a structural climb — so dismissing an
event up to its region an hour into a session would have jumped. "Has the camera
moved yet" is a fact about the map, and it is exactly the condition under which a
fly is disorienting.

The canvas is also held until then, so the world frame is never painted at all:
it fades in on the same flag behind `MapCurtain`, a backdrop-blurred overlay with
the Spinner atom. The spinner fades in on a 200ms CSS delay so a warm boot reads
as a clean frost-then-reveal rather than flashing a spinner nobody registers, and
a timeout armed on style load reveals the map anyway after 1.5s — CalendarView
never frames the camera, so a /calendar deep link would otherwise stay hidden for
the session.

Two library mechanics were measured against mapbox-gl 3.9.2 rather than assumed,
and both are recorded in the hook: the instant point move is `jumpTo` (what
flyTo's own reduced-motion branch delegates to, keeping padding through the
`pick`), and an instant bounds fit needs BOTH `linear: true` and `animate: false`,
because `_fitInternal` only reaches the `easeTo` that honours `animate` when
`linear` is set.

This is not a reduced-motion branch and must not become one: it reads no media
query and passes no `essential: true`. Under the preference mapbox already jumps,
so the first move is a no-op difference and every later one is untouched.

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

* feat(map): make "find my location" open the classes near you

Pressing the geolocate control zoomed to street level and did nothing else:
mapbox's own `_updateCamera` fits the accuracy circle at zoom 15, so every class
was off-screen, and with no `onGeolocate` handler the results list never
re-ranked from where the visitor actually is.

It now navigates to `/search?center=…&bbox=…`, which makes it a navigation
rather than a camera command — SearchView's existing `frameSearch` does the
framing (capped at REGION_MAX_ZOOM for free), the list re-ranks by distance from
the fix, and the bottom sheet rises out of its peek.

`nearbyBounds` computes the frame: the visitor's point unioned with the nearest
few classes, floored at NEARBY_RADIUS_KM so standing on top of a venue gives a
neighbourhood rather than the degenerate box `fitBounds` answers with maximum
zoom, and capped at NEARBY_MAX_KM. Both bounds are reused rather than invented —
the cap is already this module's definition of "genuinely near", the thing that
decides whether the IP prompt is offered at all, so a class the app declines to
suggest cannot widen the camera either.

`followUserLocation={false}` stops mapbox moving the camera itself. The flag
gates only `_updateCamera` in `_onSuccess`, so the blue dot, the accuracy circle,
the permission flow and the localized labels all stay. (Mapbox's own .d.ts claims
otherwise; its source disagrees, and the source is right.)

A browser GeolocationPosition carries no place name and no country, so the fix is
reverse-geocoded for both — but AFTER navigating, never before: getting here has
already cost up to six seconds of `positionOptions.timeout`. `?q` then labels the
field and `?cc` turns on the country-site offer and the foreign-distance rule.
It resolves null on any failure, which costs a label rather than the feature.

Supporting changes, each of which removes a way to get this wrong:

- `preserveSearchState` moves to `lib/shape/path.ts` and gains `placeSearchPath`,
  one builder for the three things that name a searched place. Each previously
  hand-rolled the same four params, one forgotten call away from silently
  clearing somebody's filters. It was also module-private and untested.
- `geocodeBounds` narrows the geocoder's `LngLatBoundsLike` to the four numbers
  `?bbox` carries. The previous inline `.toString()` would have written
  `[object Object]` for a LngLatBounds instance, which `parseBounds` discards in
  silence — degrading the fit to a pinpoint with nothing to show for it.
- MapSearch adopts a `?q` written by anyone else. It seeded from the URL only in
  its state initializer, which was right while typing was the only writer; the
  field would otherwise keep naming a place the results are no longer about.
- The bottom sheet lifts out of its peek on a new `?center`. The geolocate
  control lives on the map, so "drag the sheet down, then press locate" is the
  likely gesture — and it re-searches without changing `top.kind`, which is all
  the existing snap effect watched.

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

* fix(i18n): list each language by its own name in the picker

The language menu labelled every option through the ACTIVE locale's
`Intl.DisplayNames`, so the one thing it exists for was the one thing it could
not do: a French visitor looking for English was offered "anglais", a Russian one
"английский", and someone who could not read the current language had no way to
find their own.

`nativeLanguageLabel` builds the label with the code as both the display locale
and the subject, which is what makes it an endonym — čeština, Deutsch, English,
español, français, magyar, Nederlands, português (Brasil), русский, українська.
It reuses the module-level DisplayNames cache, so offering ten languages costs
ten ICU objects for the widget's lifetime rather than ten per render.

The submenu trigger showing the CURRENT language was already an endonym by
construction, since its DisplayNames was built in the locale it was naming. It
now says so outright, so the row and the list it opens cannot drift apart.

`languageLabel` is deliberately untouched: it names an event's language inside a
filter, where the reader is reading the current UI language and "Russian" is the
right word. Each row also carries `lang`, so a screen reader pronounces the
endonym in the language it belongs to rather than through the page's.

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

* feat(i18n): put the chosen language in the URL

Picking a language from the settings menu changed the widget and left the
address bar describing the page as it was before — nothing to copy, nothing to
reload into, and no way to hand somebody the atlas in the language you were
reading it in.

`?locale=` was already half a contract: i18next's detector reads it and
docs/embedding.md documents it to integrators. Nothing ever wrote it. The
settings menu now publishes the pick with a `history.replaceState`.

`replaceState` rather than a push, because a language is a preference and not a
place — pushing would leave an entry in the host's history whose only effect on
Back is to change the language again. `history.state` is passed through verbatim,
which keeps the atlas history's own slice: drop it and the drawer's next X climbs
to the structural parent instead of going back, and the camera snapshot taken
against that entry key is stranded. It does not go through AtlasRouter, which
would mint a route entry; writing behind the history's back is safe precisely
because `?atlas=` is untouched, and that is the only parameter it re-reads.
Skipped entirely in memory routing, where the route deliberately isn't in a URL.

The write lives in SettingsMenu rather than in `useLocale().setLocale`. That hook
is called by every card in a list that pages to hundreds of rows, and this is the
one place a viewer picks a language — a context read and a URL write on that path
would serve one menu at the cost of the app's hottest one.

**A viewer's `?locale=` now outranks the script URL's `locale=`**, which is a
deliberate reordering of the documented precedence chain and the point of writing
the parameter at all: deferring to the host would revert the visitor on the very
next load, on exactly the hosts that pin a language, and the link they shared
would carry a language it does not honour.

`pageLocaleOverride` insists the parameter names a language we actually ship
rather than merely being present — a junk `?locale=zz` resolves to English
through `supportedLngs`, and letting that suppress a host's `locale=fr` would be
a worse answer than either party asked for. It takes the supported set as an
argument rather than importing it: `config/i18n-options.ts` imports LOCALE_PARAM
from this module, so reaching back would close a cycle that typecheck cannot see
and that surfaces as a TDZ ReferenceError at boot, in whichever load order the
bundler happens to pick.

docs/embedding.md carries the inverted precedence, a section on the write, and
the parameter in the list of what the widget touches on a host's page.

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

* docs(embedding): record the geolocate, boot and locale changes for hosts

Everything a host or their visitors can observe from the five fixes, per the
rule that the integrator guide and the changelog change in the same PR as the
behaviour they describe.

embedding.md: the Permissions Policy row now says what the geolocate control
actually does (it opens the nearby class list, not just a camera move), so a host
reading the table knows what breaks when `geolocation` is denied. The
`connect-src` row for api.mapbox.com names the reverse lookup alongside the
forward geocoder — the check was made rather than assumed, and the answer is that
this adds no CSP row, because the place-search geocoder already reaches the same
origin. The list of what the widget touches on a host's page gains the query
string, naming both parameters it claims.

CHANGELOG: entries for the two visible additions and the three fixes, written for
somebody who embeds the widget rather than somebody who works on it. The existing
`locale` precedence line is corrected in place — it stated the old order, which
this branch inverts.

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

* fix(map): read live router state in the geolocate handler, not a stale closure

Found in a browser, and invisible to every gate: pressing "find my location"
navigated to `/search?center=…&bbox=…` correctly and then immediately rewrote the
URL back to `/?q=…&cc=…`, dropping the search it had just performed.

`onGeolocate` is bound ONCE, when Mapbox constructs the control — the same
construction-only behaviour `Map.tsx` already documents for the `locale` prop.
The handler therefore closed over the `searchParams`, `setSearchParams` and
`location` of the render in which the map mounted, and the reverse-geocode phase's
`setSearchParams(…, { replace: true })` replaced the wrong entry with a merge onto
the wrong base.

The handler now reads `navigate` and `searchParams` from a ref refreshed on every
render, and the naming phase rebuilds the whole destination from the same base and
place rather than merging onto whatever the URL says by the time it resolves. So
the label cannot disturb the search it is labelling.

Verified end to end in a browser, which is the only thing that could see it:

  pushState    -> /search?center=4.9003,52.3791&bbox=4.4777,51.9244,5.2686,52.6039
  replaceState -> /search?q=Amsterdam, North Holland, Netherlands&center=…&bbox=…&cc=NL

with the fit settling at zoom 8.9 rather than mapbox's 15, the search field reading
the resolved place, and `followUserLocation={false}` confirmed to suppress mapbox's
own camera move (the map did not budge from zoom 0.75 before our framing ran).

No unit spec accompanies this one deliberately. The defect is in the binding
between a library's control construction and a React closure — `use-mapbox.ts`
cannot even be imported in the node lane, and a spec asserting callback stability
would have stayed green through both the broken and the fixed version. The repo
already carries this lesson from #132: when a helper's output feeds a caller,
something has to exercise the caller.

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

* fix(map): close four gaps found reviewing the branch

All four are cases where a change earlier in this branch was right about the
common path and silent about an edge.

**A late reverse-geocode could hijack a route the visitor had moved to.** The
naming phase fires a few hundred ms after the navigation — easily long enough to
tap a class — and its `replace` overwrote whatever entry was current by then,
with no Back to undo it. It now labels the search only while the visitor is still
on the route it pushed, compared exactly, since both sides come from
`placeSearchPath` over the same inputs.

**That replace also went through `useAtlasNavigate`, which is for pushes.** It
stamps an incrementing `atlasDepth` and remembers the outgoing camera, so an entry
that added no history left the drawer stack drawing a peek strip for a back-step
that does not exist. It uses the raw navigate now, carrying `state` explicitly the
way MapSearch does.

**`useCameraSettled` outlived the map it described.** The store is module-global
and the map is not: a compact embed unmounts the whole interface when its dialog
closes. On the second expansion a stale `true` would have met a fresh map at [0,0]
zoom 0 — no curtain, and a fly across the planet. Both of the defects the store
exists to fix, back on the second view. It is now forgotten from the map's own
unmount, and `store.test.ts` pins that.

**`reset()` did not clear the emphasized pin.** Moving selection ownership into
the framing calls covered `frameRegion` and `frameSearch` but missed the one the
root view actually calls, so pressing the root peek strip out of an event left its
pin drawn over the zoomed-out world.

**And a hidden map was still an interactive one.** The curtain hides the canvas
with `opacity: 0` and is itself `pointer-events-none`, so a click landed on pins
nobody could see — reachable on any route that never frames the camera, where the
reveal waits out the 1.5s backstop. The canvas is inert while hidden.

Re-verified in a browser: geolocate still lands on /search with the fit at zoom
8.9, the resolved place in the field, and both history writes in the right order.

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

* fix(map): round the device fix before it reaches a URL

The geolocate feature was internally inconsistent about the same question.
`reverseGeocode` deliberately asks Mapbox for a `place` rather than a street
address, on the stated grounds that "a visitor's doorstep is not something to
write into a shareable URL" — and then `?center` beside that label carried the
doorstep at full float precision.

Rounding to ~110m closes it. Nothing the feature can see changes: the frame is a
neighbourhood (NEARBY_RADIUS_KM is 25km) and the list ranks over hundreds of km,
both orders of magnitude coarser. What it buys is that the coordinates a visitor
might copy into a link, or that their host page's analytics scrape off the query
string, are a neighbourhood rather than an address.

In the hook rather than in `placeSearchPath`, because the other two callers pass
a typed geocode or an IP guess — already public and already coarse — and blurring
those would cost accuracy for nothing.

Raised by the branch security review and deliberately NOT recorded as a
vulnerability: the coordinates exist only after an explicit press and a browser
permission prompt scoped to the host origin, and they land in the visitor's own
address bar. Adversarial filtering scored it 3/10 as a security finding. It is a
privacy-consistency tidy-up, and it is worth making because the same commit was
already arguing for it one field over.

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

* docs(rules): update the map rule for the seam and camera changes

`.claude/rules/mapbox.md` is path-scoped to the map subsystem and auto-loads when
those files are edited, so a stale claim there is read as current by whoever
touches this next. Three of its statements are no longer true, and two things this
branch learned belong in it.

Corrected: the seam member list still named `clearSelection`, which is gone;
`frameSearch({})` no longer resets to the world, and the rule now says which call
does and why the two were split.

Added, both because they cost real time to find and neither is visible from the
source alone: that a Mapbox control's HANDLERS are construction-only just as its
`locale` is — the trap that let a stale closure rewrite a completed search, which
every gate passed — and that the first camera command of a session arrives rather
than flying, with the three mechanics that make it work (`jumpTo`; `linear` AND
`animate: false` together; the flag being forgotten on unmount, without which a
compact embed's second expansion brings both defects back).

Also a short section on the geolocate control now being a navigation rather than a
camera move, carrying the `followUserLocation` finding — where mapbox's own types
contradict its source — and the coordinate rounding.

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

* fix(build): give a Cloudflare preview its own origin for locale JSON

Every preview deploy of this repo rendered nothing at all, and had done for a
long time — this branch's preview, and PR #178's before it, both ship
`http://localhost:5174/locales/` in the bundle.

`VITE_HOST` composes the absolute URL the locale JSON is fetched from, and it has
to be absolute: embedded, the widget runs on the host's page while its
translations live wherever the bundle came from. Production sets it in the Pages
dashboard. **Preview deploys had nothing**, so they inherited `.env`'s
`localhost:5174` and shipped it to a `pages.dev` origin — every locale fetch then
a cross-origin request to the reviewer's own machine, blocked as private-network
access.

That does not degrade into missing strings, which is what makes it easy to miss.
i18next's `init` never resolves, every component reading a translation suspends
forever, and the page renders blank: no canvas, no content, no readiness marker.

`CF_PAGES_URL` is Cloudflare's own answer — the URL of the current deployment,
documented for exactly this ("allowing build tools to know the URL the page will
be deployed at"). Taking it in `vite.config.ts` rather than adding a dashboard
variable is deliberate: a preview host is per-deployment, so no static value could
work, and this way forks get it too.

Verified against real builds, all three cases:

  pnpm build                            → http://localhost:5174/locales/   (unchanged)
  CF_PAGES_URL=… pnpm build             → https://abc12345.…pages.dev/locales/
  VITE_HOST=… CF_PAGES_URL=… pnpm build → https://sahajatlas.com/locales/  (unchanged)

The third is the one that matters for safety: an explicit value still wins, so
production is untouched and `docs/embedding.md`'s promise to hosts — that UI
strings come from `sahajatlas.com` — stays true. No host-facing change, so that
guide and CHANGELOG.md are deliberately not touched.

Worth noting for whoever reads the smoke lane's invariants: the Smoke job passed
against a preview that rendered nothing, because those specs are fetch-based over
`_headers`, `_redirects` and `robots.txt` and never boot the app. "The specs ran"
was true; it just could not mean "the widget works".

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

* docs(environment): say where the standalone build's API key really comes from

The `VITE_SAHAJCLOUD_API_KEY` row read "the key the widget uses in dev", which is
what made a keyless preview look inexplicable next to a keyless production site.

It is not dev-only. `main.tsx` falls back to it whenever the URL carries no
`?key=` — `searchParams.get('key') || import.meta.env.VITE_SAHAJCLOUD_API_KEY` —
so it is inlined into every deploy that has it set, which is why sahajatlas.com
renders keyless and a preview answers `Missing api key`.

Both mentions now say so, and the row carries the consequence: set it in the Pages
**Preview** environment as well as Production, or every preview needs `?key=`
appended by hand. Noted there too is why this one cannot be defaulted in
`vite.config.ts` the way `VITE_HOST` now is — there is no Cloudflare-provided
value to fall back to, and the key must stay out of the committed `.env` or it
would ship to every fork and every `pnpm dev`.

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

* test(smoke): catch a deploy that points at somebody's laptop

Every existing smoke spec asks whether a file was deployed. None asks whether
what was deployed points anywhere real — which is why every preview in this repo
could render a completely blank page while the whole lane stayed green.

`boot-origins.smoke.test.ts` reads the eager graph back off the deploy and checks
the two origins the app will actually request from, `${VITE_HOST}/locales/` and
`${VITE_SAHAJCLOUD_URL}/api`, naming the variable rather than just the string —
"which env var produced this" being the only useful next question.

Proven against both real artifacts rather than a simulation. The broken
deployment is still live, so the A/B is exact:

  c6e49822 (broken)  → FAIL: locale JSON (VITE_HOST) → http://localhost:5174
                             (/assets/api-d6S0tmYy.js)
  branch alias (fixed) → 4 passed, whole lane 19 passed

Three properties are load-bearing, and two of them are corrections to my own
first draft:

- **Targeted, not a sweep.** Scanning for any private host anywhere flagged a
  healthy deploy: react-router carries its own literal `http://localhost` as the
  `createURL` base for when there is no `window.location`.
- **Reading the string is the deterministic half; dialling the origin is not.**
  The companion test fetches whatever origin was baked in, and it cannot own the
  localhost case — anyone running `pnpm dev` has something answering on 5174, so
  against the very deploy that shipped this bug it passed on my machine and would
  only have failed on a runner. Measured, not assumed; each docblock now says
  which half it owns.
- **A missing match fails rather than passing empty.** If an origin stops
  matching, the assertions would go vacuously green — the failure this lane's own
  history says is hardest to notice.

⚠ It still does not prove the widget RENDERS, and no fetch-based spec can. That
is acceptable here only because this defect is a string in the bundle, so reading
it back is a direct observation rather than an inference. A runtime-only failure
still needs a browser, which stays local per the note atop `embed.smoke.test.ts`.

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

* fix(map): blur the map while it loads instead of hiding it, and quieten the spinner

Two things wrong with the loading state, both visible the moment you actually look
at it — which I had not done: I verified the mechanism (canvas held, curtain up,
reveal fires) and never once photographed the result.

**The frost showed nothing at all.** The canvas was held at `opacity: 0` AND
frosted, and the two cancel out: `backdrop-filter` filters what is BEHIND the
element, so with a transparent canvas there was nothing to blur and the tint
painted onto the page's own white. A blank screen where a soft map should be —
the opposite of the point, since a frost works by letting you see that something
is there. The canvas now stays opaque and the overlay blurs it for real, at a
much lighter `sm`/4px over a 20% tint rather than `md`/12px over 60%.

It stays non-interactive while blurred, which is now the honest reason rather
than a workaround: a map nobody can read clearly should not take clicks.

**The drawer spinner carried a redundant caption.** `DrawerLoadingBody` passed
`label`, which draws "Loading…" under the glyph — a word a spinner already says —
and that caption is also what pushed the glyph itself off centre, since the column
centres as a unit and the label's height sits half of it below the middle. It
passes `srLabel` now: announced, not drawn. Measured after: the glyph's centre and
its container's centre are both at y=451.

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

* fix(ui): let the boot spinner fill the window it is standing in for

The first thing a visitor sees — the app-level fallback, before the interface or
even the map exists — sat 140px tall at the TOP of the window with its spinner
centred in that 140px rather than on screen. Measured at an 800px viewport: the
surface ran 0→140, the glyph's centre was y=70.

`APP_SURFACE` sizes with `h-full`, and a percentage height against a parent with
no definite height resolves to `auto`. An unboxed map embed has exactly that by
design — it measures zero height, because everything the interface draws is
`position: fixed` and the element takes no room in the host's layout — and the
standalone shell's `<html>` is no different. So the surface shrink-wrapped to its
own content, every time, in the most common form.

It now mirrors what it stands in for: that interface is `fixed; inset: 0`, so in
that form the fallback is too. Measured after: the surface runs 0→800 and the
glyph sits at exactly (600, 400).

**The caller decides, rather than the component guessing.** A contained map, a
map-less embed and the compact card all have a real box where `h-full` is already
correct, and taking the viewport there would paint over the host's page — or, in
the compact form, over the very margin the expanded dialog keeps so the page shows
through and can be clicked to close. `App` and `AppShell` both have `hasMap`,
`contained` and `compact` in scope at the mount point, so neither has to infer it.
Verified that `?map=0` still renders `position: static` and in flow.

It also drops the visible "Loading…" to `srLabel`, the same call `DrawerLoadingBody`
now makes — announced, not drawn, and its height was a second reason the glyph sat
below centre.

⚠ `ErrorFallback` shares `APP_SURFACE` and so has the same collapse in the same
form. Left alone here because it takes `FallbackProps` from the error boundary
rather than props from the call site, so giving it the same switch is a different
change — worth doing, but not silently inside this one.

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

---------

Co-authored-by: Claude Opus 5 (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.

1 participant