diff --git a/src/admin/AdminPhotosTable.tsx b/src/admin/AdminPhotosTable.tsx index 4f5228d5..601aa7d2 100644 --- a/src/admin/AdminPhotosTable.tsx +++ b/src/admin/AdminPhotosTable.tsx @@ -25,6 +25,7 @@ export default function AdminPhotosTable({ onLastPhotoVisible, revalidatePhoto, hasAiTextGeneration, + showCreatedAt, canEdit = true, canDelete = true, }: { @@ -32,6 +33,7 @@ export default function AdminPhotosTable({ onLastPhotoVisible?: () => void revalidatePhoto?: RevalidatePhoto hasAiTextGeneration?: boolean + showCreatedAt?: boolean canEdit?: boolean canDelete?: boolean }) { @@ -79,7 +81,9 @@ export default function AdminPhotosTable({ 'lg:w-[50%] uppercase', 'text-dim', )}> - + {showCreatedAt + ? + : }
- Sync oldest {UPDATE_BATCH_SIZE} photos + Sync Oldest {UPDATE_BATCH_SIZE} Photos - Sync oldest + Sync Oldest } > @@ -56,6 +56,7 @@ export default async function AdminPhotosPage() { hasAiTextGeneration={AI_TEXT_GENERATION_ENABLED} canEdit={false} canDelete={false} + showCreatedAt />
diff --git a/src/photo/PhotoDate.tsx b/src/photo/PhotoDate.tsx index 3a96a2a4..2d8686e3 100644 --- a/src/photo/PhotoDate.tsx +++ b/src/photo/PhotoDate.tsx @@ -3,16 +3,24 @@ import { Photo } from '.'; import { useMemo } from 'react'; export default function PhotoDate({ - photo: { takenAtNaive }, + photo, className, + dateType = 'takenAt', }: { photo: Photo className?: string + dateType?: 'takenAt' | 'createdAt' }) { const date = useMemo(() => { - const date = new Date(takenAtNaive); + const date = new Date(dateType === 'takenAt' + ? photo.takenAt + : photo.createdAt); return isNaN(date.getTime()) ? new Date() : date; - }, [takenAtNaive]); + }, [ + dateType, + photo.createdAt, + photo.takenAt, + ]); return ( );