import { useState } from 'react'; import { SharePanel, type ShareIntentProperties, type SharePanelTranslations } from '../components/SharePanel'; import { TryOnFigure } from './TryOnFigure'; import { formatTryOnDate } from './dateLabels'; import type { TryOnHistoryItem } from '../types'; import type { WidgetTranslations } from '../i18n'; interface GalleryViewProps { items: TryOnHistoryItem[]; onBack: () => void; onDelete: (id: string) => void; t: WidgetTranslations['gallery']; shareT: SharePanelTranslations; onShareIntent?: (properties: ShareIntentProperties) => void; /** Injected by tests so the date labels are deterministic. */ now?: Date; } /** * Everything the shopper has tried on, on this device. * * The Shopify original put an add-to-cart on every row. Here each row links * back to the item instead: this is a demo where nothing is for sale, and a * cart button would contradict the banner at the top of the page. The way * back to the product is the point. */ export function GalleryView({ items, onBack, onDelete, t, shareT, onShareIntent, now }: GalleryViewProps) { const [sharingId, setSharingId] = useState(null); return (
{items.length === 0 ? (

{t.emptyTitle}

{t.emptyMessage}

) : ( <>

{t.privacyNote}

)}
); }