import { useState, useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { api } from '../../utils/api' import { formatPhotoCaption } from '../../utils/photoDisplay' /** * Fortschrittsfotos (Galerie wie Verlauf-Tab Fotos). */ export default function ProgressPhotosWidget({ refreshTick = 0 }) { const nav = useNavigate() const [photos, setPhotos] = useState([]) const [big, setBig] = useState(null) useEffect(() => { api.listPhotos().then(setPhotos).catch(() => setPhotos([])) }, [refreshTick]) if (!photos.length) { return (
Noch keine Fotos.
) } return (
Fortschrittsfotos
{big && (
setBig(null)} >
)}
{photos.map((p) => (
setBig(p.id)} />
{formatPhotoCaption(p)}
))}
) }