Skip to content

refactor(components): genericize event panel family + card/story cleanup - #27

Merged
Ardnived merged 16 commits into
mainfrom
refactor/genericize-components
Jul 1, 2026
Merged

Ardnived merged 16 commits into
mainfrom
refactor/genericize-components

Conversation

@Ardnived

@Ardnived Ardnived commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A sweeping, phased restructuring that genericizes the event-detail component family and cleans up the card/story taxonomy — with no visual change to any existing surface. The sole intentional new UI is an opt-in mailing-list consent checkbox on the registration form.

  • Generic, presentational components fed parsed data by their parents (ImageCarousel, DetailRow, RegistrationForm, ShareContent, RegionCard, EventCard).
  • One reusable dialog/trigger pattern (Modal trigger + ModalClose), composed by EventView for both the register and share dialogs.
  • Ladle taxonomy where folder tier == story label, plus refreshed DESIGN_SYSTEM.md / STORYBOOK.md.

Changes

Phases A–J (self-contained commits):

  • A Switch→Checkbox atom with appearance: 'switch' | 'checkbox' (default switch, so existing toggles are unchanged); adds @radix-ui/react-checkbox + a CheckIcon.
  • B Trigger-based Modal — optional trigger (uncontrolled) / isOpen (controlled) + ModalClose; Button is now forwardRef for Radix asChild.
  • C EventPanel→EventView; extracted generic molecules/DetailRow; the detail cards + ordering moved private into EventView/; EventDetails deleted.
  • D EventImages→generic ImageCarousel (slides); folded the Lightbox atom in as a React.lazy module — YARL stays in its own chunk (dist/assets/lightbox-*.js, out of the main bundle).
  • E EventRegistration→form-only RegistrationForm; EventView owns the external-vs-native decision + trigger; new opt-in consent checkbox + subscribe field (schema + register body) + registration.mailing_list_consent in all 10 locales.
  • F Removed ShareButton/ShareModal; EventView composes ShareContent in a Modal.
  • G Folded LanguageSelector + ThemeSwitch into Navbar as private files.
  • H ListItem→RegionCard, EventItem→EventCard; stories grouped under Molecules / List.
  • I Moved Panel + Fallbacks up from atoms to molecules.
  • J Story-taxonomy sweep (folder tier == label), Select barrel export, doc refresh.

The RegionListItem data type is unrelated to the ListItem component and is unchanged.

Follow-up adjustments

  • DetailRow gained a first-class tone variant (icon / highlight / plain) that fully owns the leading-slot tint (the emphasised host-contact card, and the date-badge opt-out) — the callers pass a bare icon; rendered output unchanged. Its story now demonstrates every variant.
  • Panel story now exercises its real Suspense LoadingFallback + ErrorBoundary ErrorFallback.
  • EventView story shows the view unadorned (no faux panel border), only width-limited; EventView memoizes its slides.
  • The Mapbox geocoder (MapSearch) is rethemed to the project's brand CSS tokens, so its input + suggestion dropdown follow light/dark and the tenant palette.

Verification

  • Lint: ✓ (pnpm lint, --max-warnings 0)
  • Types: ✓ (pnpm typecheck)
  • Tests: ✓ 103 passed (pnpm test:run) — added a subscribe case to RegistrationSchema
  • Build: ✓ (pnpm build) — YARL remains a separate lazy chunk
  • Ladle: ✓ (pnpm ladle:build) — nested Molecules / List title builds

Review: two adversarial passes (multi-dimension code-review + security, each finding refuted by skeptics; plus a 4-angle /simplify pass and a focused code+security re-review of the follow-up adjustments) returned no confirmed correctness/parity/security findings. The only actioned items were a stale-comment fix and the DetailRow tone deepening above.

Manual / visual verification (please confirm)

I ran the gates only (no runtime screenshot pass), and automated checks can't diff pixels:

  1. Event panel — in-person / online / no-images render identically to main (incl. the emphasised contact card when there's no upcoming date).
  2. Registration dialog — native (with the consent checkbox above the privacy note, default unchecked) and external; submit with consent → payload includes subscribe: true.
  3. Share dialog, SearchBar toggle, list rows / Navbar — unchanged.
  4. MapSearch geocoder — check the search box + suggestion dropdown, especially in dark mode (that's the main win of the reskin).

Notes for reviewer

Closes #25

🤖 Generated with Claude Code

Ardnived and others added 11 commits July 1, 2026 12:30
Adds @radix-ui/react-checkbox and a CheckIcon. The `switch` appearance is
the former Switch verbatim (the default, so existing toggles are visually
unchanged); the new `checkbox` appearance (role="checkbox") unblocks the
registration mailing-list consent field. Migrates the sole consumer,
SearchBar, to <Checkbox appearance="switch"> — pixel-identical.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Modal now accepts an optional `trigger` (rendered via Dialog.Trigger
asChild) and makes isOpen/onOpenChange optional, so it works uncontrolled
when opened by its trigger while staying backward-compatible with the
controlled callers. Adds ModalClose (Dialog.Close asChild) for
close-from-inside buttons. This is the single dialog abstraction reused by
the share and registration dialogs.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Promotes the private EventDetail row to a generic molecules/DetailRow
(icon slot + title + content + optional link) and moves the three detail
subcomponents (contact/timing/location) + platform/directions helpers into
the EventView folder as private files. EventView now owns the card ordering
rule and composes the rows directly; the EventDetails organism is deleted.
EventView stays out of the organisms barrel (still lazy-loaded from
pages/event.tsx). Rendered output is unchanged.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
ImageCarousel takes generic slides ({ src, alt?, caption? }) instead of
event images, and folds the former Lightbox atom in as a private,
React.lazy-loaded module so YARL and its CSS stay in their own chunk
(verified: dist/assets/lightbox-*.js, out of the main bundle). The
images→slides mapping moves up into EventView. Deletes the Lightbox atom
and the EventImages folder (Swiper config + single-slide arrow handling
preserved).

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Renames EventRegistration to a form-only, config-driven RegistrationForm
({ eventId, upcomingDates, questions, isOnline, eventTitle, eventUrl,
onClose? }). EventView now owns the external-vs-native decision, the trigger
Button, and the upcomingDates/enabledQuestions derivation, wrapping the form
in the trigger-based Modal (RegistrationButton deleted). Because Radix
unmounts dialog content on close, the manual reset-on-close is dropped — the
form remounts fresh on reopen.

Adds the opt-in mailing-list consent checkbox (Checkbox appearance="checkbox",
unchecked by default) above the privacy note, a `subscribe` boolean on
RegistrationSchema sent in the register body, and the
registration.mailing_list_consent key across all 10 locales. The widget
sends `subscribe` regardless; SahajCloud records it once sydevs/SahajCloud#524
lands.

Also makes Button forwardRef so Radix asChild (Dialog.Trigger / Dialog.Close)
can attach to it.

Part of #25

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

Renames EventShare to ShareContent (folder = primary export), keeping the
ShareContent block and its private CopyField and deleting the ShareButton
trigger + private ShareModal. EventView now renders the share trigger and
wraps ShareContent in the trigger-based Modal with the "invite a friend"
header — reproducing today's dialog. RegistrationForm's thank-you screen
still reuses ShareContent. Barrel drops ShareButton/ShareButtonProps.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Navbar is the only consumer, so both move in as private files (no stories,
no atoms-barrel exports). Their absolute @/ imports are unchanged; Navbar
imports them locally. Resolves two atoms that carried molecule-level
responsibility.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
ListItem → RegionCard and EventItem → EventCard (folders, components, and
Props types), with all usages updated (pages index/country/region, EventsList).
The List, RegionCard, and EventCard stories now group under "Molecules / List"
(distinct storyNames keep them from colliding). The RegionListItem data type
is unrelated and unchanged. Rendered output is identical.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Panel (Suspense + ErrorBoundary page container) and the Loading/Error
fallbacks it composes carried molecule-level responsibility, so both move
to the molecules tier together (Panel imports Fallbacks — moving them as a
pair avoids an atom→molecule dependency). Updates the atoms/molecules
barrels, the six page importers, App.tsx, and Panel's Fallbacks import;
story titles move to Molecules. Resolves the tier inversion.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Aligns folder tier with Ladle label: SearchBar → Molecules, Map/MapSearch
→ Organisms (every story's tier now matches its folder). Exports Select/
SelectItem (+ Props) from the atoms barrel. Refreshes DESIGN_SYSTEM.md (new
Checkbox/DetailRow/ImageCarousel/RegionCard/EventCard/RegistrationForm/
EventView entries; Panel/Fallbacks now molecules; ShareContent-only; Modal
trigger API in the exception list; Switch/Lightbox/LanguageSelector/
ThemeSwitch removed) and STORYBOOK.md (permit `Tier / Group` nested titles,
e.g. Molecules / List).

Part of #25

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

The code-split NOTE in organisms/index.ts still named EventRegistration,
which Phase E renamed to RegistrationForm. Comment-only.

Part of #25

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: 941298d
Status: ✅  Deploy successful!
Preview URL: https://9a824f24.syatlas.pages.dev
Branch Preview URL: https://refactor-genericize-componen.syatlas.pages.dev

View logs

Ardnived and others added 5 commits July 1, 2026 14:08
Adds a `highlighted` boolean (tv-driven) that fills the leading icon slot
with the brand tint, replacing the caller-smuggled bg styling. EventView's
contact-for-timing card now passes `highlighted` (rendered output is
unchanged). Expands the story with clear per-variant sections — plain /
internal link / external link / highlighted / icon-vs-badge slot + a
realistic stack.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds a States section: a never-resolving lazy child shows the Panel's
Suspense LoadingFallback, and a throwing child shows its ErrorBoundary
ErrorFallback — so the story actually exercises the fallbacks it describes.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
EventView has no chrome of its own (the app wraps it in a Panel), so the
story dropped the misleading `border border-gray-6` and shows it in its base
state, only width-limited.

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The MapSearch Geocoder now reads the project's brand CSS tokens (neutral
ramp, surface, primary accent) instead of a hardcoded rgba border, so the
input and its suggestion dropdown follow light/dark mode and the tenant
palette. Border matches our form inputs (gray-7); default rounded corners.

Part of #25

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

Per the /simplify altitude pass: DetailRow's leading slot now owns its tint
via a `tone` variant (`icon` default / `highlight` / `plain`), replacing the
half-done `highlighted` boolean whose icon colour was still smuggled through
a load-bearing empty-string ternary at the call site. The three detail
callers now pass a bare icon + `tone`; the date badge opts out with
`tone="plain"`. Rendered output is unchanged.

Also memoizes EventView's `slides` mapping so a stable array threads to the
carousel/lightbox across re-renders (the mapping had become eager when it
moved up from the old lazy lightbox branch).

Part of #25

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit b11c1ad into main Jul 1, 2026
3 checks passed
@Ardnived
Ardnived deleted the refactor/genericize-components branch July 1, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(components): genericize event panel family + card/story cleanup

1 participant