import { useQuery } from '@tanstack/react-query' import { photos } from '../../services/api' import type { MemoryGroup } from '../../services/api' export function MemoriesView() { const { data, isLoading } = useQuery({ queryKey: ['memories'], queryFn: () => photos.memories(), staleTime: 60_000 * 30, // 30 min — date doesn't change often }) if (isLoading) { return (
Loading memories...
) } const memories = data?.memories ?? [] if (memories.length === 0) { return (

No memories for today

Photos taken on this date in previous years will appear here.

) } return (

On This Day — {data?.date}

{memories.map((group: MemoryGroup) => (

{group.year} · {group.years_ago} year{group.years_ago !== 1 ? 's' : ''} ago

{group.photos.map((photo) => (
{photo.thumb_small ? ( {photo.filename} ) : (
No thumb
)}

{photo.filename}

))}
))}
) }