GEN-2: surface Farbschlag images (FarbschlagImage component) in breeding results, animal detail, form picker
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { listColorVarieties, listContacts, listEnclosures, listLitters } from '.
|
||||
import { useApi } from '../hooks/useApi'
|
||||
import { formatDate, genderLabel, statusLabel } from '../format/labels'
|
||||
import { fromDisplayString, genotypeToFarbschlag, toDisplayString } from '../genetics'
|
||||
import FarbschlagImage from '../components/FarbschlagImage'
|
||||
// FEAT-6 (Oscar): Tab-Inhalte + Profilfoto
|
||||
import GerbilHealthTab from '../components/GerbilHealthTab'
|
||||
import GerbilPhotosTab from '../components/GerbilPhotosTab'
|
||||
@@ -118,7 +119,19 @@ export default function GerbilDetailPage() {
|
||||
{g.status === 'GivenAway' && (
|
||||
<Row label={t.fields.goHomeDate} value={formatDate(g.goHomeDate)} />
|
||||
)}
|
||||
<Row label={t.fields.colorVariety} value={lookup(colorName, g.colorVarietyId)} />
|
||||
<Row
|
||||
label={t.fields.colorVariety}
|
||||
value={
|
||||
storedColorName ? (
|
||||
<span className="farbschlag-value">
|
||||
<FarbschlagImage name={storedColorName} size={32} />
|
||||
{storedColorName}
|
||||
</span>
|
||||
) : (
|
||||
'—'
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Row label={t.fields.enclosure} value={lookup(enclosureName, g.enclosureId)} />
|
||||
<Row label={t.fields.litter} value={lookup(litterName, g.litterId)} />
|
||||
<Row label={t.fields.origin} value={lookup(contactName, g.originContactId)} />
|
||||
|
||||
@@ -7,6 +7,7 @@ import { GENDERS, GERBIL_STATUSES, type CreateGerbil, type Gender, type GerbilSt
|
||||
import { useApi, useMutation } from '../hooks/useApi'
|
||||
import { genderLabel, statusLabel } from '../format/labels'
|
||||
import { fromDisplayString } from '../genetics'
|
||||
import FarbschlagImage from '../components/FarbschlagImage'
|
||||
|
||||
interface FormState {
|
||||
name: string
|
||||
@@ -173,6 +174,9 @@ export default function GerbilFormPage() {
|
||||
|
||||
if (isEdit && existing.loading) return <p className="muted">{de.common.loading}</p>
|
||||
|
||||
const selectedColorName =
|
||||
(colorVarieties.data ?? []).find((cv) => cv.id === form.colorVarietyId)?.name ?? null
|
||||
|
||||
return (
|
||||
<section className="page">
|
||||
<h2>{isEdit ? t.form.editTitle : t.form.createTitle}</h2>
|
||||
@@ -265,14 +269,20 @@ export default function GerbilFormPage() {
|
||||
|
||||
<label className="field">
|
||||
<span>{t.fields.colorVariety}</span>
|
||||
<select value={form.colorVarietyId} onChange={(e) => set('colorVarietyId', e.target.value)}>
|
||||
<option value="">{t.form.none}</option>
|
||||
{(colorVarieties.data ?? []).map((cv) => (
|
||||
<option key={cv.id} value={cv.id}>
|
||||
{cv.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<span className="farbschlag-value">
|
||||
<select
|
||||
value={form.colorVarietyId}
|
||||
onChange={(e) => set('colorVarietyId', e.target.value)}
|
||||
>
|
||||
<option value="">{t.form.none}</option>
|
||||
{(colorVarieties.data ?? []).map((cv) => (
|
||||
<option key={cv.id} value={cv.id}>
|
||||
{cv.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{selectedColorName && <FarbschlagImage name={selectedColorName} size={36} />}
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label className="field">
|
||||
|
||||
Reference in New Issue
Block a user