'use client'; import { formatDate, formatTime } from '../../lib/format'; import { Icon } from '../../icons'; import { useGallery, useGalleryStoreApi } from '../../store/context'; import { EmptyState } from './EmptyState'; /** * Audit browser — every photo/video that has an edit history or comments. * Click an item to open it with the Info panel showing the full version * timeline (v1 = original, never overwritten) and comment thread. */ export function VersionsView() { const api = useGalleryStoreApi(); const media = useGallery((s) => s.media); const tracked = media .filter((m) => !m.deletedAt && ((m.versions?.length ?? 0) > 0 || (m.comments?.length ?? 0) > 0)) .sort((a, b) => (b.editedAt ?? b.importedAt) - (a.editedAt ?? a.importedAt)); const open = (id: string) => { const s = api.getState(); s.openLightbox(id); s.setInfoOpen(true); }; if (tracked.length === 0) { return ( ); } return (
Versions & Audit Log
{tracked.length} item{tracked.length === 1 ? '' : 's'} with edit history or comments. Originals are never overwritten.
{tracked.map((m) => { const versions = m.versions ?? []; const latest = versions[versions.length - 1]; const comments = m.comments?.length ?? 0; return ( ); })}
); }