FEAT-6: wire tab content into animal detail (Fotos/Gesundheit/Gewicht) + profile photo in header + tab styles
This commit is contained in:
20
gerbil-manager-web/src/components/GerbilProfilePhoto.tsx
Normal file
20
gerbil-manager-web/src/components/GerbilProfilePhoto.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* FEAT-6: Profilfoto im Detail-Kopf — erstes Foto nach sortOrder.
|
||||
* Selbstständig ladend; rendert nichts, solange es keine Fotos gibt
|
||||
* (oder die Foto-Endpunkte noch nicht live sind).
|
||||
*/
|
||||
import { listGerbilPhotos, photoSrc, profilePhoto } from '../api/photos'
|
||||
import { useApi } from '../hooks/useApi'
|
||||
|
||||
export default function GerbilProfilePhoto({ gerbilId }: { gerbilId: string }) {
|
||||
const photos = useApi(() => listGerbilPhotos(gerbilId), [gerbilId])
|
||||
const profile = profilePhoto(photos.data ?? [])
|
||||
if (!profile) return null
|
||||
return (
|
||||
<img
|
||||
className="profile-photo"
|
||||
src={photoSrc(profile)}
|
||||
alt={profile.caption ?? profile.fileName}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user