/** @jsxRuntime automatic */ /** @jsxImportSource remix/component */ import { unsafeHTML } from 'remix/component' import type { Action } from 'remix/router' import { coverOf, findGallery } from '../../src/domain/content.ts' import { buildSrcset, pickVariant } from '../../src/domain/image-plan.ts' import type { Photo } from '../../src/domain/types.ts' import { canonicalUrl, loadSite, variantUrl, type Site } from '../data/site.ts' import { routes } from '../routes.ts' import { icon } from '../ui/icons.tsx' import { notFound } from '../ui/not-found.tsx' import { ogImage } from '../ui/og-image.ts' import { cameraDetails } from '../ui/photo-details.ts' import { picture } from '../ui/picture.tsx' import { render } from '../ui/render.tsx' /** Shape the lightbox client reads from `#lightbox-data` (see app/assets/entry.ts). */ export type LightboxPhoto = { href: string alt: string caption?: string details?: string width: number height: number lqip: string src: string srcset: string webpSrcset: string } function lightboxData( site: Site, slug: string, photos: Array, ): Array { const url = (photo: Photo, variant: Parameters[2]) => variantUrl(site, photo, variant) return photos.map((photo) => { const details = cameraDetails(site.content.config, photo) return { href: routes.photo.href({ slug, photoId: photo.id }), alt: photo.alt, ...(photo.caption ? { caption: photo.caption } : {}), ...(details ? { details } : {}), width: photo.width, height: photo.height, lqip: photo.lqip, src: url(photo, pickVariant(photo, 'jpeg', 1600)!), srcset: buildSrcset(photo, 'jpeg', url), webpSrcset: buildSrcset(photo, 'webp', url), } }) } /** JSON for an inline