import { useEffect, useState } from 'react'; import { Link, useParams } from 'react-router'; import { get } from '../lib/api'; import type { SitePhoto } from '../lib/types'; import { PlayerAvatar } from '../components/PlayerAvatar'; import { absoluteTime, num, relativeTime } from '../lib/format'; export function PhotoDetail() { const { id } = useParams<{ id: string }>(); const [photo, setPhoto] = useState(null); const [err, setErr] = useState(null); useEffect(() => { if (!id) return; setErr(null); setPhoto(null); get(`/photos/${id}`).then(setPhoto).catch(e => setErr((e as Error).message)); }, [id]); if (err) return (

Photo not found

{err}

← Back to feed
); if (!photo) return
Loading…
; return (
← Back to feed
{photo.caption
); }