Skip to content

feat(event): add yet-another-react-lightbox to image carousel - #9

Merged
Ardnived merged 7 commits into
mainfrom
feat/event-lightbox
Jun 18, 2026
Merged

Ardnived merged 7 commits into
mainfrom
feat/event-lightbox

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

  • Event photos in the carousel can now be tapped to open full screen in a
    yet-another-react-lightbox overlay — with pinch/scroll/double-click zoom,
    a caption from each image's alt text, and (for multi-image galleries) a
    thumbnail strip + prev/next nav. A single image shows neither.
  • The lightbox opens on the clicked image and dismisses on Esc / backdrop /
    close button.
  • YARL and its CSS ship in a lazy chunk fetched on first open, so they never
    weigh down the initial bundle, and the chunk's CSS is JS-injected so it works
    in the embedded widget, not just standalone dev.
  • Removes the unused LightboxImage atom (dead code that pointed at a leftover
    requestly.io debug URL).

Changes

  • src/components/atoms/Lightbox/ (new) — YARL wrapper ported from WeMeditate
    ([Captions, Zoom] for one slide, [Captions, Thumbnails, Zoom] for many;
    scrollToZoom; prev/next suppressed when single). Exported lazily from the
    barrel (React.lazy) so the library + CSS land in their own chunk;
    LightboxSlide is defined locally (we deliberately skip WeMeditate's
    LightboxProvider/ClientOnly — this is a client-only, single-surface widget).
  • src/components/molecules/EventImages/EventImages.tsx — each slide image is now
    a real keyboard-accessible <button> (cursor-zoom-in) that opens the lightbox
    at its index; the lazy <Lightbox> mounts only while open (inside <Suspense>).
  • src/components/molecules/EventImages/slides.ts (+ slides.test.ts) — pure
    imagesToSlides mapper, extracted so it's unit-testable without pulling YARL
    into the node test lane (its imports are type-only).
  • src/components/atoms/LightboxImage/** — deleted; barrel + docs updated.

Verification

  • Lint: ✓ (pnpm lint)
  • Types: ✓ (pnpm typecheck)
  • Unit: ✓ 40 tests (pnpm test:run) — incl. the new imagesToSlides spec
  • Build: ✓ (pnpm build) — and ladle:build ✓
  • Lazy chunk + widget CSS verified in dist/: YARL's JS and CSS
    (.yarl__*) appear only in assets/Lightbox-*.js; embed.js and the main
    chunk have zero YARL references; no standalone .css is emitted (the
    chunk carries the syatlas-map-style JS-injection used by the widget).

Manual / visual verification

Automated checks can't exercise the live overlay. Worth a manual pass on an event
with photos (standalone and demo.html):

  1. Tap a photo → opens full screen on that image.
  2. Zoom via scroll / double-click / pinch; confirm the caption shows the alt text.
  3. Multi-image: thumbnail strip + prev/next + ←/→ keys; single image: neither.
  4. Esc / backdrop / close button dismiss it.
  5. In demo.html, confirm YARL is styled (CSS picked up by the JS injector).

Notes for reviewer

  • Helper file: the issue suggested the mapper live in EventImages.tsx tested
    by EventImages.test.tsx; I extracted it to slides.ts / slides.test.ts
    instead so the fast node-only test lane never imports NextUI/Swiper (the repo's
    lane currently imports zero UI libs). Same acceptance criterion, faster lane.
  • a11y label + i18n: a code-review pass flagged that the new photo <button>
    would be unnamed when an image has no altText (optional in the schema). Added
    a localized details.view_photo fallback across all 10 locales (en is
    fallbackLng). This is beyond the issue's literal scope but keeps the new
    interactive control accessible.
  • Lazy mount on open: <Lightbox> is rendered only under {open && …} (not
    always-mounted) so React.lazy fetches the YARL chunk on first tap rather than
    on carousel mount — matching WeMeditate's conditional-mount pattern.
  • /simplify + /code-review were run over the branch; the only skipped finding
    was reusing mockEventImages in the atom's story — declined because a
    domain-agnostic atom story shouldn't depend on event-domain mocks + a
    molecule-level helper, and a literal swap wasn't behavior-preserving.

Closes #8

🤖 Generated with Claude Code

Ardnived and others added 7 commits June 18, 2026 20:04
Lazy-loaded fullscreen image lightbox for the event photo carousel.
Supports React 18 (peer ^16.8 || ^17 || ^18 || ^19).

Refs #8

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Port WeMeditate's fullscreen lightbox wrapper (Captions + Zoom always,
Thumbnails added for multiple slides, scrollToZoom, prev/next suppressed
for a single slide). Exported lazily from the barrel so YARL and its CSS
land in a separate chunk and never load until a photo is opened. The
widget's JS-injected CSS picks up the lazy stylesheet, so it works
embedded too. Defines LightboxSlide locally — no SSR, so we skip
WeMeditate's LightboxProvider / ClientOnly infrastructure.

Refs #8

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Tapping a photo in the event carousel now opens it in the YARL lightbox
at the clicked index, with zoom and a caption from altText (thumbnail
strip + prev/next for multiple images). Each slide image is a real
keyboard-accessible <button>; the lazy <Lightbox> mounts only once a
photo is opened, so YARL and its CSS are fetched on first tap. The
images → slides mapping is a pure helper (slides.ts) with a unit test.

Closes #8

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Dead code — only referenced by its own story, and its fullscreen image
pointed at a leftover requestly.io debug URL. Superseded by the new
Lightbox atom.

Refs #8

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the deleted LightboxImage row with the new lazy YARL Lightbox
(surfaced by the /simplify altitude pass).

Refs #8

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The tap-to-open photo buttons took their accessible name from the image
alt, leaving them unnamed when an event image has no altText (optional in
the schema). Fall back to a localized "View photo" label; add the
details.view_photo key to all locales (en is fallbackLng).

Refs #8

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The atoms Media subcategory still listed the deleted LightboxImage; point
it at the new Lightbox atom.

Refs #8

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit 818270c into main Jun 18, 2026
3 checks passed
@Ardnived
Ardnived deleted the feat/event-lightbox branch June 18, 2026 12:46
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(event): add yet-another-react-lightbox to image carousel

1 participant