Compare commits

...

2 Commits

5 changed files with 67 additions and 10 deletions

View File

@@ -137,3 +137,20 @@ test('Kein Würfe-Panel wenn Wurzeltier keine Würfe hat (STAMMBAUM-LITTERS)', a
await expect(page.locator('.pedigree-card').first()).toBeVisible() await expect(page.locator('.pedigree-card').first()).toBeVisible()
await expect(page.locator('.stammbaum-litters-panel')).not.toBeVisible() await expect(page.locator('.stammbaum-litters-panel')).not.toBeVisible()
}) })
test('Knoten-Karte zeigt volles Geburtsdatum (STAMMBAUM-FULLDATE)', async ({ page }) => {
skipUnlessMock()
// Krümel: dateOfBirth '2025-03-12' → formatDate → '12.03.2025'
await page.goto('/rennmaeuse/kruemel/stammbaum')
await expect(page.locator('.pedigree-card').first()).toBeVisible()
await expect(page.locator('.pedigree-card__year').first()).toContainText('12.03.2025')
})
test('Gencode-Chip zeigt Genotyp statt Farbname (STAMMBAUM-GENCODE)', async ({ page }) => {
skipUnlessMock()
// Fridolin ist Vater von Krümel — genotype 'aa CC DD EE GG PP spsp rere'
await page.goto('/rennmaeuse/kruemel/stammbaum')
await expect(page.locator('.pedigree-card').first()).toBeVisible()
const fridolinCard = page.locator('.pedigree-card').filter({ hasText: 'Fridolin' })
await expect(fridolinCard.locator('.pedigree-chip')).toContainText('aa CC')
})

View File

@@ -1,19 +1,21 @@
import { useState } from 'react' import { useState } from 'react'
import type { ReactNode } from 'react'
import { NavLink, Outlet } from 'react-router-dom' import { NavLink, Outlet } from 'react-router-dom'
import { de } from '../strings/de' import { de } from '../strings/de'
import GerbilIcon from './GerbilIcon'
import './appShell.css' import './appShell.css'
interface NavItem { interface NavItem {
to: string to: string
label: string label: string
icon: string icon: ReactNode
end?: boolean end?: boolean
} }
// Primary items are always visible in the phone bottom bar; secondary items // Primary items are always visible in the phone bottom bar; secondary items
// move into the "Mehr" sheet on phones and appear inline in the desktop sidebar. // move into the "Mehr" sheet on phones and appear inline in the desktop sidebar.
const PRIMARY: NavItem[] = [ const PRIMARY: NavItem[] = [
{ to: '/rennmaeuse', label: de.nav.gerbils, icon: '🐭' }, { to: '/rennmaeuse', label: de.nav.gerbils, icon: <GerbilIcon size="1.25em" /> },
{ to: '/wuerfe', label: de.nav.litters, icon: '🍼' }, { to: '/wuerfe', label: de.nav.litters, icon: '🍼' },
{ to: '/genetik', label: de.nav.genetics, icon: '🧬' }, { to: '/genetik', label: de.nav.genetics, icon: '🧬' },
] ]
@@ -46,7 +48,7 @@ export default function AppShell() {
return ( return (
<div className="app-shell"> <div className="app-shell">
<header className="app-header"> <header className="app-header">
<span className="app-logo" aria-hidden="true">🐭</span> <span className="app-logo" aria-hidden="true"><GerbilIcon size="1.5rem" /></span>
<h1 className="app-title">{de.app.title}</h1> <h1 className="app-title">{de.app.title}</h1>
</header> </header>

View File

@@ -0,0 +1,35 @@
import type { CSSProperties } from 'react'
interface Props {
size?: string | number
style?: CSSProperties
className?: string
}
/** Reusable gerbil silhouette icon — upright sitting pose, long tail with tuft. fill=currentColor. */
export default function GerbilIcon({ size = '1em', style, className }: Props) {
return (
<svg
viewBox="0 0 64 64"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
style={{ display: 'inline-block', verticalAlign: '-0.125em', flexShrink: 0, ...style }}
className={className}
role="img"
aria-label="Rennmaus"
>
{/* body — sitting upright */}
<path d="M40 14c6 0 11 5 11 12 0 4-2 7-2 11 0 10-6 16-15 16-8 0-14-6-14-15 0-13 9-24 20-24z" />
{/* ear */}
<circle cx="46" cy="15" r="5" />
{/* hind paw */}
<ellipse cx="24" cy="52" rx="9" ry="3.5" />
{/* long curved tail with tuft */}
<path d="M16 51c-7 1-13-2-15-9-1-4 0-8 3-10 1 3 1 6 3 8 3 3 7 4 11 4z" />
{/* front paw */}
<path d="M30 45c3 0 5 1 5 4-3 1-6 1-7-2 0-1 1-2 2-2z" />
</svg>
)
}

View File

@@ -28,6 +28,7 @@ import { getInbreedingCoefficient } from '../api/pedigree'
import type { Gender, Gerbil, Litter } from '../api/types' import type { Gender, Gerbil, Litter } from '../api/types'
import { useApi } from '../hooks/useApi' import { useApi } from '../hooks/useApi'
import { formatDate, genderLabel } from '../format/labels' import { formatDate, genderLabel } from '../format/labels'
import GerbilIcon from '../components/GerbilIcon'
import { UNKNOWN_FARBSCHLAG, fromDisplayString, genotypeToFarbschlag, toDisplayString } from '../genetics' import { UNKNOWN_FARBSCHLAG, fromDisplayString, genotypeToFarbschlag, toDisplayString } from '../genetics'
import { import {
DEFAULT_GENERATIONS, DEFAULT_GENERATIONS,
@@ -379,7 +380,7 @@ function PedigreeCard({
const t = de.pages.stammbaum const t = de.pages.stammbaum
const g = node.gerbil const g = node.gerbil
const chip = farbschlag ? chipColorFor(farbschlag) : null const chip = farbschlag ? chipColorFor(farbschlag) : null
const year = g.dateOfBirth ? g.dateOfBirth.slice(0, 4) : null const dob = g.dateOfBirth ? formatDate(g.dateOfBirth) : null
return ( return (
<div <div
className={isRoot ? 'pedigree-card pedigree-card--root' : 'pedigree-card'} className={isRoot ? 'pedigree-card pedigree-card--root' : 'pedigree-card'}
@@ -389,7 +390,7 @@ function PedigreeCard({
> >
{/* Foto-Platzhalter — echte Fotos kommen mit FEAT-6. */} {/* Foto-Platzhalter — echte Fotos kommen mit FEAT-6. */}
<div className="pedigree-card__photo" aria-hidden="true"> <div className="pedigree-card__photo" aria-hidden="true">
🐭 <GerbilIcon size="1.6rem" />
</div> </div>
<div className="pedigree-card__body"> <div className="pedigree-card__body">
<div className="pedigree-card__name"> <div className="pedigree-card__name">
@@ -406,11 +407,12 @@ function PedigreeCard({
<span <span
className="pedigree-chip" className="pedigree-chip"
style={chip ? { background: chip.bg, color: chip.fg } : undefined} style={chip ? { background: chip.bg, color: chip.fg } : undefined}
title={farbschlag}
> >
{farbschlag} {g.genotype || farbschlag}
</span> </span>
)} )}
{year && <span className="pedigree-card__year">* {year}</span>} {dob && <span className="pedigree-card__year">* {dob}</span>}
</div> </div>
{node.expandable && ( {node.expandable && (
<button <button

View File

@@ -285,14 +285,15 @@
.pedigree-chip { .pedigree-chip {
align-self: flex-start; align-self: flex-start;
max-width: 100%; max-width: 100%;
font-size: 0.68rem; font-size: 0.62rem;
padding: 0.1rem 0.45rem; padding: 0.1rem 0.45rem;
border-radius: 1rem; border-radius: 1rem;
background: var(--color-accent-soft); background: var(--color-accent-soft);
color: var(--color-accent); color: var(--color-accent);
white-space: nowrap; white-space: normal;
word-break: break-word;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; line-height: 1.3;
} }
.pedigree-card__year { .pedigree-card__year {