Skip to content

fix: bug sweep — dark-mode marker, drawer stack depth, event surfaces, drop Add to calendar - #83

Merged
Ardnived merged 14 commits into
mainfrom
fix/bug-sweep-2
Jul 30, 2026
Merged

Ardnived merged 14 commits into
mainfrom
fix/bug-sweep-2

Conversation

@Ardnived

@Ardnived Ardnived commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A bug-sweep batch — eight unrelated fixes across the event surfaces, the drawer stack, and the map.

  • A single event had no marker at all in dark mode. The pins came from each Mapbox Studio style's own sprite, and the two had drifted: the dark style has no teardrop point and no cluster-selected, and its selected is actually the round cluster art. The widget now ships its own four marker images, so both themes are identical and a Studio edit can't silently drop a marker again.
  • The drawer stack promised panels the close button never visits. Clicking a map pin from the root landed three cards deep while a single X returned to the countries list. The count now follows history, not the URL.
  • A disabled Checkbox no longer reads as a pale shade of "on" — it repaints on the neutral grey ramp instead of fading the brand fill.
  • "Add to calendar" is gone end to end — action, popover, the hand-rolled RFC 5545 builder, and the locale keys.
  • Host-authored prose no longer scrolls the drawer sideways, and the event carousel no longer floats 176px above the bottom of the view.
  • Plus: the stacked-drawer effect reads as a stack, the action row is rebalanced for its four-action maximum, and the triage chips moved from the pinned header into the body.

Changes

  • src/components/organisms/Mapbox/markers.ts (new) — the four marker images as SVG, plus registerMarkerImages(map). Registration hangs off Mapbox's own styleimagemissing, which re-fires after every style load, so one subscription covers both the initial load and the light/dark switch without the map branching on the theme. Decoded elements and in-flight promises are cached: the event re-fires per missing id per tile batch, so without the promise cache a cold start began the same decode many times over, and without the element cache the warm path couldn't add synchronously — a style switch then painted its first frame pinless.
  • src/lib/shape/navigation.ts — dismissDepth counts what a repeated dismiss actually traverses: depth back-steps, then the ancestors of the depth-0 entry still to be climbed, capped at what the URL can name. DrawerStack holds that entry's height in a non-reactive ref (it's read only at depth > 0 and written only at depth 0, so making it reactive only bought a second render of the whole stack).
  • src/components/atoms/Checkbox/Checkbox.tsx — disabled overrides key off Radix's data-disabled, beating the color and isInvalid fills by CSS specificity rather than class order. isInvalid's ring is a different property, so an errored control keeps it while going grey. The neutral colour is dropped: grey now means disabled.
  • src/styles/globals.css — break-words folded into the .colored-links host-prose utility; carousel theming keyed on .sy-carousel.
  • src/lib/ics.ts + spec deleted; 'calendar' removed from EventActionId and the resolver; two keys removed from all ten locales. The schedule time primitives ics.ts shared with shape/event.ts stay — shape/calendar.ts still uses them.

Verification

  • Lint: ✓ pnpm lint (0 warnings)
  • Types: ✓ pnpm typecheck
  • Tests: ✓ pnpm test:run — 421 passing, 46 files (6 new for dismissDepth, 3 for the Checkbox contract)
  • Build: ✓ pnpm build + pnpm ladle:build

Manual / visual verification

Driven in a browser against the local SahajCloud seed:

  1. Dark-mode pin — clicked the single pin at world zoom; renders in dark mode, and Mapbox's Image "sy-point" could not be loaded warning stays absent across repeated light⇄dark toggles (it appears when the registration path fails, so its absence is the assertion).
  2. Stack count — reproduced the reported bug exactly (pin from root → /ru/yuzhno-sahalinsk/22 at depth 1): now 1 strip, and one X returns to the root. A cold deep link still draws 3 and counts 3→2→1→0 as it climbs; a full drill-down still tracks 1→2→3.
  3. Overflow — both reported URLs now report scrollWidth === clientWidth exactly.
  4. Carousel — image flush with the bottom of the view; bullets checked against the worst background available (a white studio with a sunlit floor).
  5. Checkbox — Ladle, both themes, enabled vs disabled × off/on × switch/checkbox.

Review passes

/simplify, a code review, and two security reviews ran over the full branch diff. Nothing was dismissed without reason.

  • Code review — no critical or high findings. It independently verified the Checkbox specificity in both themes, the marker lifecycle under reuseMaps, and the completeness of the calendar removal. Three fixed: the entryAncestors ref seed silently restored the URL-ancestor count on a reload at depth > 0; the failed-decode retry was unbounded (styleimagemissing re-fires per tile batch, so a host CSP blocking img-src data: would have looped forever); and a decode resolving after unmount could have Mapbox build a fresh Style for a dead map.
  • Security review — no critical or high findings. It caught one regression introduced by this branch: the carousel's pagination theming was keyed on .swiper, and since our stylesheet is injected into the host document, that reached into host pages' own carousels — white-at-0.5 bullets would make their pagination invisible. Re-keyed to .sy-carousel, with the rest of globals.css audited.

Notes for reviewer

  • The commits are unsigned. The signing agent was locked and couldn't prompt in a non-interactive session. Re-sign with git rebase --exec 'git commit --amend --no-edit -S' origin/main.
  • Two behaviour changes worth a second opinion, both deliberate:
    • The mobile sheet's 80px peek now carries the title only, where issue feat(event): redesign event display & registration surfaces #52 WS4 had it showing the whole triage payload — inherent to moving the chips out of the pinned header.
    • Carousel bullets sit over the image. The alternative (a band below it) needs ~40px, which is the dead space this removes.
  • Follow-ups deliberately not in scope: marker fills are the Studio artwork's teal/orange rather than derived from the brand palette, so tenant theming still stops at the map's edge; the neutral-ramp disabled treatment is Checkbox-only (ToggleGroup/Select/Slider still use opacity-disabled); and .colored-links is a bare unprefixed class in the host document whose !important link rule is a collision hazard worth renaming.

🤖 Generated with Claude Code

Ardnived and others added 4 commits July 29, 2026 08:50
The disabled control fell out of `disabled:opacity-disabled` over the brand
fill, which produced a pale tint — easy to read as "a lighter shade of on"
rather than "you can't touch this", and against a pale brand hard to tell
apart from the enabled-unchecked track.

- Repaint disabled on the neutral ramp at full opacity (gray-9 on / gray-5 off
  for the switch, gray-9 / gray-4 for the box), both OFF the enabled steps, so
  state stays readable while the colour can't be mistaken for the brand. A
  control you can see but can't use beats one faded to near-invisible. The
  inert cue moves to the knob (dimmed, no shadow), the filled unchecked box,
  and `cursor-not-allowed` on the control and its label.
- Drive it off Radix's own `data-disabled` (as Slider does) rather than a tv
  variant, so the override beats the `color` and `isInvalid` fills by CSS
  SPECIFICITY — one more attribute in the selector — instead of depending on
  class order. `isInvalid`'s ring is a different property, so an errored
  control keeps its ring while going grey.
- Drop the `neutral` colour option: its whole job was a grey fill, which is now
  what disabled means. Nothing outside the story used it.
- The story gains an enabled-vs-disabled grid (off/on × switch/checkbox) so the
  two can actually be compared, and a test pins the Radix attribute the styling
  hangs on.

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

A single (unclustered) event rendered as NOTHING in dark mode. The pins came
from each Mapbox Studio style's own sprite, and the two styles had drifted: the
dark style has only `cluster` and a `selected` that is really the ROUND cluster
art — no teardrop `point`, and no `cluster-selected` either, so the
selected/hovered area highlight was missing there too.

Own the four marker images instead (`markers.ts`), drawn as SVG from the light
style's artwork so light mode is unchanged, and register them on the map:

- `styleimagemissing` is Mapbox's own hook for supplying an icon a style lacks,
  and it re-fires after every style load — so one subscription covers the
  initial load AND the light/dark switch (which drops runtime images) without
  tracking the theme in the map.
- Both the decoded element and the in-flight promise are cached. Mapbox re-fires
  the event per missing id per TILE BATCH, so without the promise a cold start
  began the same decode many times over; and the warm path has to add the image
  synchronously inside the handler, or the new style's first frame paints
  pinless (a microtask is already too late).
- A failed decode is evicted rather than remembered, so a host page whose CSP
  omits `img-src data:` recovers on a later style load instead of losing every
  marker for its lifetime.
- Ids are `sy-`-prefixed and looked up in a `Map`, so an id the basemap's own
  layers ask for (`constructor`) can't resolve to a non-marker.

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

Drops the feature end to end rather than hiding the CTA:

- `EventActions`: the calendar action circle and its Google-template /
  .ics-download popover are gone; the action row is now Directions · Website ·
  Contact · Share. `ActionPopover`'s render-prop shell only existed so contact
  AND calendar could each supply a trigger, so it collapses into a plain
  `ContactPopover` — taking the `Record<string, unknown>` prop bag with it.
- `lib/ics.ts` (the hand-rolled RFC 5545 builder, `buildEventIcs` /
  `buildGoogleCalendarUrl`, RRULE + EXDATE expansion) and its spec are deleted,
  along with the `@/lib` re-export. Nothing else imported them; the schedule
  time primitives it shared with `shape/event.ts` stay — `shape/calendar.ts`
  (the Schedule-X occurrence expansion) still uses them.
- `'calendar'` leaves `EventActionId` and the resolver's action set.
- `actions.add_calendar` / `actions.download_ics` removed from all ten locales.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The ancestor panels peeked out by 5–6px at 0.55 opacity (falling to 0.15),
which was easy to mistake for a border rather than a drawer behind the sheet.

- Roughly double the peek (10px mobile / 12px desktop) and soften the per-level
  decay (0.7 → 0.78), so a deeper stack still tightens but each level stays
  visible.
- Lift the fade: the nearest ancestor is near-solid (0.8) and deeper ones step
  down to a 0.25 floor, so the stack recedes without any level disappearing.
  Extracted as `peekOpacity` beside the peek constants.
- Widen the settings cog's inline-start offset to clear the STRIPS, not just the
  drawer: the deepest stack now pushes an ancestor ~23px past the panel edge,
  where the cog only cleared 12px, so at two or more ancestors the strips
  rendered under it. Measured ~10px of air with a three-deep stack.

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

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

Copy link
Copy Markdown

Deploying sahajatlas-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 684b9cb
Status: ✅  Deploy successful!
Preview URL: https://5210a82f.sahajatlas-design.pages.dev
Branch Preview URL: https://fix-bug-sweep-2.sahajatlas-design.pages.dev

View logs

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 684b9cb
Status: ✅  Deploy successful!
Preview URL: https://5df64f34.sahajatlas.pages.dev
Branch Preview URL: https://fix-bug-sweep-2.sahajatlas.pages.dev

View logs

Ardnived and others added 10 commits July 29, 2026 10:56
The stack showed one panel per URL ancestor, but dismissal is history-aware, so
the two disagreed. Clicking a map pin from the root view lands on
`/ru/yuzhno-sahalinsk/22` at in-widget depth 1: three ancestors were drawn, yet a
single X went chronologically back to the countries list. The stack was promising
two panels that pressing close never visits.

`dismissDepth` (in navigation.ts, beside `dismissAction`) computes what a repeated
X actually traverses: while depth remains each press goes BACK one entry, and only
at depth 0 does it start climbing structural parents — so the count is
`depth + the ancestors of the depth-0 entry`, capped at what the current URL can
name. DrawerStack remembers that entry's height (once past it the URL no longer
says where the widget came in) and renders the first n ancestors, root-first: with
history in play the nearest ancestor may not be where back lands, but the root end
of the chain is.

Verified in the browser: pin-from-root now draws ONE strip and one X returns to
the root; a cold deep link still draws three and counts 3→2→1→0 as it climbs; a
full drill-down still tracks depth 1→2→3 as before.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The row's cramped metrics were sized for five actions; dropping Add to calendar
caps the set at four (directions, website, contact, share), which buys back room.

- Labels go to full `text-xs` from the sub-12px 11px, and the columns get a real
  `gap-2`. Both existed because five 48px circles needed every pixel to keep the
  longer translations ("Megosztás", "Связаться") off a second line; at four each
  column has ~70px of the panel's ~304px instead of ~58px, which fits
  "Directions" at 12px with room to separate the columns.
- Cap the column at 6rem and centre the row, so a SHORT set stops sprawling: an
  online event with only contact + share was stretching each column to half the
  panel. Four actions never reach the cap, so the full row is unchanged. (An
  arbitrary value — `max-w-24` isn't a utility in Tailwind 3.4, and emitted the
  class with no CSS behind it.)
- Colour the labels with the primary role's high-contrast step instead of plain
  foreground, so the row reads as a set of brand controls rather than captions.

Also drops two comments that still described the calendar action.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Both reported pages overflowed for the same reason, and it was not the carousel
(the swiper clips its own track correctly — measured 350px content in a 350px
box). It was the description: an unbreakable run in host prose widened the
scroll container, and the whole drawer picked up a horizontal scrollbar.

- `/ca/ontario/halton-region/422` — a bare URL pasted as plain text.
- `/ru/sankt-peterburg/456` — long strings of U+2800 (braille blank) used as
  makeshift spacing. Invisible, but not whitespace, so the line-breaker treats
  each run as one enormous word. This one was the worse of the two: 628px of
  content in a 302px column.

`break-words` on the prose container fixes both at the source (verified: the
body's scrollWidth drops to exactly its clientWidth on both pages).

`overflow-x-hidden` on the drawer body backs it up. A drawer is a fixed-width
panel that must never scroll sideways, but it renders arbitrary CMS prose, so
the next unbreakable string should degrade to a clipped edge rather than a
scrollbar across the view. Safe for the full-bleed carousel (exactly the body's
width) and for popovers (portaled out of the body).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Three bottom paddings stacked under the last thing in an EventView, leaving
176px of blank space below the images to clear a 65px register bar.

- Replace the `h-24` spacer with bottom padding on the scroll container, which
  is what the Drawer's `sticky` footer documents ("give the body matching bottom
  padding"). The spacer sat in the flow and added to the content's own padding
  instead of composing with it, and 96px over-provisioned for the 65px bar.
- The carousel is full-bleed and always last, so it takes the content
  container's `pb-10` with it: images now end flush with the view instead of
  floating 40px above it. Everything else keeps the padding.
- Size the slide's bottom padding to what it is actually for — the pagination
  bullets (~16px + air, so `pb-6`) — and drop it entirely for a lone image,
  which has no bullets. It was 40px either way.

Net: 176px → 24px of bullet band on desktop, and 104px on the mobile sheet where
80px of that is clearing the bar. Verified at both breakpoints.

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

Committing to the overlay option rather than a band below the image. Sizing a
band to the bullets (the previous `pb-6`) left them butted against the image's
bottom edge — `--swiper-pagination-bottom` is 1rem, so 24px of padding put the
bullet tops exactly on the image — and a band big enough to clear them is the
dead space that was being removed in the first place.

- Drop the slide's bottom padding entirely: the slide is the image, so the
  carousel now ends flush with the bottom of the view.
- Inset the pagination into the image (`--swiper-pagination-bottom: 0.75rem`).
- Bullets go WHITE with a dark halo instead of brand primary with `shadow-md`.
  Sitting on a photo, they can't be themed off the widget's palette — they have
  to survive whatever is under them, and a pale wall or a bright sky is exactly
  where a tinted bullet and a soft shadow both vanish. Checked against the
  worst case to hand (a white studio with a sunlit floor).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The header is now the title alone; the chips (type · language(s) · Today) lead the
drawer body, above the when/where facts. `EventHeader` has no other consumer, so
the chips move wholesale rather than becoming a prop.

`-mb-2` on the chips pulls the facts back up — the body container's `gap-4` plus
the facts' own `my-2` left a short chip row floating well clear of them.

Note this changes what the mobile sheet's 80px peek carries: the title only,
where issue #52 WS4 had the peek showing the whole triage payload. The chips now
scroll with the body.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- `break-words` moves from the one EventDetails call site into the
  `.colored-links` utility. Wrapping is a property of host-authored rich text,
  not of the panel it sits in, so the next prose surface inherits the fix rather
  than relying on the drawer's clip backstop.
- Fold the carousel's swiper vars into the single `@layer base` block that
  already carries the host-scoping rationale, and nest the bullet shadow under
  `.swiper` — a bare `.swiper-pagination-bullet` restyled any carousel the HOST
  page runs, which is exactly what that block exists to prevent.
- DrawerStack: `entryAncestors` becomes a ref. It's only read at depth > 0 and
  only written at depth 0 (where `dismissDepth` uses the live count instead), so
  a write can never change the current render — making it reactive just bought a
  second render of the whole stack. Same non-reactive treatment as
  `useCameraHistory`. Also drops a no-op `useMemo` around a 3-element `.slice`,
  and reuses the local `depth` instead of calling `atlasDepth` three times.
- markers.ts: one `onError` instead of two identical handlers, with the try/catch
  narrowed to the only synchronous throw (the cached `addImage`).
- Consolidate ActionRow's four overlapping notes into one, dropping the dead
  five-action history; trim Map.tsx's marker comment to a pointer at markers.ts.
- Drop `variant="default"` on EventChips — it's the component's own default.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
From the security review. Our stylesheet is injected into the HOST document, and
Swiper is a popular library, so `.swiper` roots routinely exist on host pages —
theming that selector reaches straight into their carousels. The comment claiming
"`.swiper` only ever exists inside our own ImageCarousel" was simply wrong.

Worse, this branch had made the impact more severe while narrowing the selector:
white bullets at 0.5 opacity render a host's pagination invisible on a light
background, where the leak used to be a wrong-but-visible brand tint.

Key the vars and the bullet halo on `.sy-carousel` — a class only our
ImageCarousel sets — instead. Audited the rest of globals.css: every remaining
selector is scoped to a class we own (`.event-pin-popover`, `.sx-calendar`,
`.colored-links`).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
No critical or high defects. The review independently confirmed the Checkbox
specificity holds in both themes, the marker lifecycle is sound under `reuseMaps`,
and the calendar removal is complete. Three real findings:

- DrawerStack: seed `entryAncestors` with 0, not the current URL's ancestor count.
  Mounting already at depth > 0 — a reload keeps `history.state` — made the cap
  always bind (`min(ancestors, depth + ancestors) === ancestors`), quietly
  restoring the URL-ancestor count this branch set out to replace. Neither seed is
  right after such a reload, so prefer the one that can only under-count.
- markers.ts: bound the failed-decode retry. Evicting on rejection alone loops —
  `styleimagemissing` re-fires per missing id PER TILE BATCH, so a host CSP that
  blocks `img-src data:` would rebuild four `Image`s and log four errors every
  batch, forever. A `failed` set now gates retries and clears on `style.load`: one
  attempt per id per style. (The comment claiming "next style load" was wrong.)
- markers.ts: a decode resolving after unmount no longer touches the map. Behind
  `hasImage`'s short-circuit on a removed map, `addImage` would have Mapbox lazily
  build a fresh Style and worker dispatcher for a dead map — benign only because
  `Map.tsx` passes `reuseMaps`, which this module shouldn't rely on.

Also corrects `layers.ts`' claim that the cluster count sits on an OPAQUE bubble:
the art is slightly translucent (inherited from the Studio sprite), so a pale
feature does bleed through. Left as-is to keep light mode unchanged; noted where
to fix it if the count ever reads thin.

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

- `.claude/rules/i18n-and-state.md`: how many peek strips the stack draws is a
  history question, not a URL one (`dismissDepth`), and why the depth-0 entry's
  height is held in a non-reactive ref.
- `.claude/rules/components.md`: two conventions this branch learned the hard way
  — every selector in `globals.css` must be scoped to a class we own (that
  stylesheet lands in the HOST document, and both a bare `main {}` and a bare
  swiper-bullet rule have leaked out already), and host-authored rich text carries
  `.colored-links`, which owns wrapping as well as link colour.
- `DESIGN_SYSTEM.md`: `EventHeader` is the pinned title alone with the chips
  leading the body; the panel order gains chips and moves images last; ActionRow's
  metrics assume a four-action maximum with width-capped columns; the drawer stack
  draws one peek card per dismiss step.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Ardnived Ardnived changed the title fix: bug sweep — dark-mode event marker, Checkbox disabled state, drop Add to calendar fix: bug sweep — dark-mode marker, drawer stack depth, event surfaces, drop Add to calendar Jul 30, 2026
@Ardnived
Ardnived merged commit 6af130c into main Jul 30, 2026
4 checks passed
@Ardnived
Ardnived deleted the fix/bug-sweep-2 branch July 30, 2026 15:03
@Ardnived
Ardnived restored the fix/bug-sweep-2 branch July 30, 2026 15:04
Ardnived added a commit that referenced this pull request Aug 8, 2026
Reintroduces add-to-calendar on the registration confirmation across five providers (Google, Apple/ICS, Outlook.com, Office 365, Yahoo), reviving the deleted src/lib/ics.ts byte-for-byte — all 25 of its original tests passed unchanged, which is itself the evidence that PR #83's removal was an action-row rebalance rather than a technical defect.

No library adopted, decided on correctness not size: both real candidates emit DTSTART as a bare UTC instant with no TZID, so a weekly 19:00 London class silently becomes 18:00 after the October DST change (calendar-link also emits an unescaped comma in LOCATION, violating RFC 5545). The CMS's icalRule proved unusable for export — FREQ=DAILY;COUNT=1 for one-off events, UTC-stamped EXDATE against a TZID-local DTSTART, no DTEND, no line folding — verified upstream, where SahajCloud's own builder rejects it for the same reasons.

Eager bundle unchanged at 0.0 KiB; the feature costs +2.1 KiB gz on the already-lazy registration chunk.

Closes #105
@Ardnived
Ardnived deleted the fix/bug-sweep-2 branch November 13, 2026 03:49
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