FEAT-4: install react-d3-tree + /rennmaeuse/:id/stammbaum route (page scaffold)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 00:10:10 +02:00
parent 92c930c165
commit bca97ed10a
4 changed files with 324 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
/**
* FEAT-4: Stammbaum (Ahnentafel) — interaktiver Stammbaum-Viewer.
*
* Erster Ausbauschritt: Route + Grundgerüst (Tier laden, Titel, Rücksprung).
* Der eigentliche Viewer (react-d3-tree, Druckansicht, Inzuchtkoeffizient)
* folgt in den nächsten FEAT-4-Commits.
*/
import { Link, useParams } from 'react-router-dom'
import { de } from '../strings/de'
import { getGerbil } from '../api/gerbils'
import { useApi } from '../hooks/useApi'
export default function StammbaumPage() {
const t = de.pages.stammbaum
const { id = '' } = useParams()
const gerbil = useApi(() => getGerbil(id), [id])
if (gerbil.loading) return <p className="muted">{de.common.loading}</p>
if (gerbil.error || !gerbil.data) {
return (
<section className="page">
<p className="muted">{gerbil.error ?? t.notFound}</p>
<Link to="/rennmaeuse" className="btn">
{de.pages.gerbils.detail.back}
</Link>
</section>
)
}
const g = gerbil.data
return (
<section className="page">
<header className="page-head">
<h2>{t.titleFor(g.name)}</h2>
<div className="head-actions">
<Link to={`/rennmaeuse/${g.id}`} className="btn">
{t.backToAnimal}
</Link>
</div>
</header>
</section>
)
}