"use client"; import { cn } from "@/lib/utils"; import React from "react"; import { ArtworkImageCard } from "./ArtworkImageCard"; type ArtworkGalleryItem = { id: string; name: string; altText: string | null; okLabL: number | null; file: { fileKey: string }; metadata: { width: number; height: number } | null; tags: { id: string; name: string }[]; }; type FitMode = | { mode: "fixedWidth"; width: number } // height varies | { mode: "fixedHeight"; height: number }; // width varies function getOverlayTextClass(okLabL: number | null | undefined) { return "text-white"; } function getOverlayBgClass(okLabL: number | null | undefined) { return "bg-black/45"; } type OpenSheet = "alt" | "tags" | null; const BUTTON_BAR_HEIGHT = 36; export default function ArtworkThumbGallery({ items, hrefBase = "/artworks", fit = { mode: "fixedWidth", width: 400 }, }: { items: ArtworkGalleryItem[]; hrefBase?: string; fit?: FitMode; }) { const [openSheet, setOpenSheet] = React.useState>({}); const toggleSheet = (id: string, which: Exclude) => { setOpenSheet((prev) => { const current = prev[id] ?? null; // toggle off if same, switch if different return { ...prev, [id]: current === which ? null : which }; }); }; if (items.length === 0) { return

No artworks found.

; } return (
{items.map((a) => { const textClass = getOverlayTextClass(a.okLabL); const bgClass = getOverlayBgClass(a.okLabL); const w = a.metadata?.width ?? 4; const h = a.metadata?.height ?? 3; const tileStyle: React.CSSProperties = fit.mode === "fixedWidth" ? { aspectRatio: `${w} / ${h}` } : { height: fit.height, aspectRatio: `${w} / ${h}` }; const sheet = openSheet[a.id] ?? null; return (
{/* Title overlay (restored) */}
{a.name}
{/* Bottom reserved bar (if you need it later) */}
); })}
); }