Repository navigation
feat(event): add yet-another-react-lightbox to image carousel - #9
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
yet-another-react-lightboxoverlay — 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.
close button.
weigh down the initial bundle, and the chunk's CSS is JS-injected so it works
in the embedded widget, not just standalone dev.
LightboxImageatom (dead code that pointed at a leftoverrequestly.iodebug 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 thebarrel (
React.lazy) so the library + CSS land in their own chunk;LightboxSlideis defined locally (we deliberately skip WeMeditate'sLightboxProvider/ClientOnly— this is a client-only, single-surface widget).src/components/molecules/EventImages/EventImages.tsx— each slide image is nowa real keyboard-accessible
<button>(cursor-zoom-in) that opens the lightboxat its index; the lazy
<Lightbox>mounts only whileopen(inside<Suspense>).src/components/molecules/EventImages/slides.ts(+slides.test.ts) — pureimagesToSlidesmapper, extracted so it's unit-testable without pulling YARLinto the node test lane (its imports are type-only).
src/components/atoms/LightboxImage/**— deleted; barrel + docs updated.Verification
pnpm lint)pnpm typecheck)pnpm test:run) — incl. the newimagesToSlidesspecpnpm build) — andladle:build✓dist/: YARL's JS and CSS(
.yarl__*) appear only inassets/Lightbox-*.js;embed.jsand the mainchunk have zero YARL references; no standalone
.cssis emitted (thechunk carries the
syatlas-map-styleJS-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):demo.html, confirm YARL is styled (CSS picked up by the JS injector).Notes for reviewer
EventImages.tsxtestedby
EventImages.test.tsx; I extracted it toslides.ts/slides.test.tsinstead 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.
<button>would be unnamed when an image has no
altText(optional in the schema). Addeda localized
details.view_photofallback across all 10 locales (en isfallbackLng). This is beyond the issue's literal scope but keeps the newinteractive control accessible.
<Lightbox>is rendered only under{open && …}(notalways-mounted) so
React.lazyfetches the YARL chunk on first tap rather thanon carousel mount — matching WeMeditate's conditional-mount pattern.
/simplify+/code-reviewwere run over the branch; the only skipped findingwas reusing
mockEventImagesin the atom's story — declined because adomain-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