Repository navigation
Description
Summary
Event photos render in an autoplay Swiper carousel (EventImages, shown in
EventPanel) that can't be expanded — tapping a photo does nothing. Port
WeMeditateWeb's fullscreen lightbox (built on yet-another-react-lightbox v3,
with zoom + captions + a thumbnail strip) and wire it into the carousel so a tap
opens the photo fullscreen. Also delete the unused LightboxImage atom, which is
dead code pointing at a leftover requestly.io debug URL.
We adopt a simplified, lazy-loaded port: the YARL wrapper is loaded via
React.lazy so the library and its CSS stay out of the main bundle, and it's
wired directly into EventImages. We deliberately skip WeMeditate's
LightboxProvider / group-registration context — that infrastructure exists to
serve many SSR surfaces, whereas SahajAtlas is a client-only widget with a single
gallery surface.
Current behavior
src/components/molecules/EventImages/EventImages.tsx— autoplay Swiper
carousel ofevent.images, no fullscreen affordance; clicking an image is a
no-op.src/components/atoms/LightboxImage/LightboxImage.tsx— a NextUI-Modal
"lightbox" that is not used anywhere (only in its own story) and renders
its fullscreen image fromhttps://app.requestly.io/delay/1000/${imageUrl}.
WeMeditate's reference implementation (for parity):
~/Documents/Projects/WeMeditateWeb/components/molecules/Lightbox/Lightbox.tsx —
YARL with Captions + Zoom always, Thumbnails added when >1 slide,
zoom={{ scrollToZoom: true }}, and prev/next buttons suppressed for a single
slide.
Proposed changes
- Add dependency
yet-another-react-lightbox@^3.32.0(supports React 18). - New atom
src/components/atoms/Lightbox/(folder-per-component:
Lightbox.tsx+Lightbox.stories.tsx+index.ts):Lightbox.tsx— port of WeMeditate's wrapper: imports YARL + the three CSS
files (styles.css,plugins/captions.css,plugins/thumbnails.css),
plugins[Captions, Zoom]for a single slide and[Captions, Thumbnails, Zoom]for multiple,scrollToZoom, and prev/next suppressed when single.
Props:slides: LightboxSlide[],open,index,close— same shape as
WeMeditate'sLightboxImplProps. DefineLightboxSlide(src,alt?,
description?) locally.index.ts— export the component lazily (React.lazy(() => import('./Lightbox'))) so YARL + its CSS land in a separate chunk and never
load until the user opens a photo. (We don't need WeMeditate'sClientOnly
wrapper — there is no SSR.)- Add to the atoms barrel (
src/components/atoms/index.ts).
- Wire into the carousel (
EventImages.tsx):- Map
images→slides({ src: image.url, alt: image.altText, description: image.altText }) via a small pure helper so it's unit-testable. - Local state for
open+ activeindex; each slide image becomes a real
<button>(keyboard-accessible perjsx-a11y) withcursor-zoom-in, whose
onClicksets the index and opens the lightbox. - Render the lazy
<Lightbox>inside a<Suspense fallback={null}>. - Keep the Swiper carousel and the
swiperdependency — only the
tap-to-expand behavior is added.
- Map
- Remove dead code: delete
src/components/atoms/LightboxImage/(component +
story +index.ts) and its export from the atoms barrel.
Acceptance criteria
- Tapping any photo in an event's carousel opens it fullscreen in the YARL
lightbox; Esc / backdrop / close button dismisses it. - Zoom (scroll, double-click/tap, pinch) and the caption (from
altText)
work; with multiple images a thumbnail strip and prev/next navigation are
shown, and a single image shows neither. - The lightbox opens on the clicked image (correct starting index).
- YARL and its CSS load in a lazy chunk — not in the initial bundle
(verify inpnpm buildoutput / adistchunk). - The lightbox renders correctly in the embedded widget (
demo.html),
i.e. YARL's CSS is picked up byvite-plugin-css-injected-by-js, not just
in standalone dev. -
LightboxImageis deleted and no longer exported; no remaining references
to it or to therequestly.ioURL. - A Ladle story exists for the new
Lightboxatom. - Unit test covers the
images → slidesmapping helper. -
pnpm lint,pnpm typecheck,pnpm test:run,pnpm build, and
pnpm ladle:buildall pass.
Files affected
package.json— addyet-another-react-lightboxsrc/components/atoms/Lightbox/{Lightbox.tsx,Lightbox.stories.tsx,index.ts}(new)src/components/molecules/EventImages/EventImages.tsx— tap-to-open wiringsrc/components/atoms/index.ts— addLightbox, dropLightboxImagesrc/components/atoms/LightboxImage/**— deletesrc/components/molecules/EventImages/EventImages.test.ts(x)— slide-mapping test (new)
References
- WeMeditate lightbox:
WeMeditateWeb/components/molecules/Lightbox/Lightbox.tsx
(andLightboxProvider.tsxfor the parts we deliberately omit) - YARL docs: https://yet-another-react-lightbox.com
- Map rule on hot-path components / widget CSS injection:
.claude/rules/components.md
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity