, string> = {
+ sm: 'max-w-sm',
+ md: 'max-w-md',
+ lg: 'max-w-2xl',
+ xl: 'max-w-4xl',
+}
+
+export default function Dialog({ open, onClose, title, children, size = 'md' }: DialogProps) {
+ useEffect(() => {
+ if (!open) return
+ const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose()
+ window.addEventListener('keydown', onKey)
+ return () => window.removeEventListener('keydown', onKey)
+ }, [open, onClose])
+
+ return (
+
+ {open && (
+
+ )}
+
+ )
+}
+```
+
+- [ ] **Step 4:** Re-run; expect PASS
+
+- [ ] **Step 5:** Commit
+```bash
+git add src/components/ui/Dialog.tsx tests/unit/ui.Dialog.test.tsx
+git commit -m "feat(ui): Dialog with backdrop + escape + motion fade"
+```
+
+### Task 7.4 — Toast (deferred — DROPPED FROM v1)
+
+> Plan-review decision: Toast is unused in v1. HomeRoute renders import errors
+> inline (``). Skip this task. Leave the
+> placeholder file as-is; do not implement. Re-introduce in v1.1 when
+> notifications grow beyond one inline error.
+
+---
+
+## Phase 8 — Design tokens + canvas state styling
+
+### Task 8.1 — Tokens + svg-canvas rules
+
+**Files:**
+- Modify: `src/styles/tokens.css`
+- Modify: `src/styles/index.css`
+
+- [ ] **Step 1:** `src/styles/tokens.css`
+```css
+:root {
+ --color-bg: #fbf9f5;
+ --color-surface: #ffffff;
+ --color-surface-strong: #f4efe6;
+ --color-ink: #1f1b16;
+ --color-ink-muted: #6b6359;
+ --color-border: #e7e0d2;
+
+ --color-accent: #b85a3f;
+ --color-accent-strong: #9c4831;
+ --color-danger: #c0392b;
+ --color-danger-strong: #962c21;
+
+ --obs-accent-0: #b85a3f;
+ --obs-accent-1: #6b8e6b;
+ --obs-accent-2: #3f7d8c;
+ --obs-accent-3: #b88a3f;
+ --obs-accent-4: #7a3f7d;
+ --obs-accent-5: #8a6b3f;
+
+ --severity-mild: #6b8e6b;
+ --severity-moderate: #b88a3f;
+ --severity-severe: #c0392b;
+
+ --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
+ --font-serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
+}
+```
+
+- [ ] **Step 2:** `src/styles/index.css`
+```css
+@import 'tailwindcss';
+@import './tokens.css';
+
+html, body, #root { height: 100%; }
+body {
+ background: var(--color-bg);
+ color: var(--color-ink);
+ font-family: var(--font-sans);
+ -webkit-font-smoothing: antialiased;
+}
+
+.svg-canvas [data-state='current'] { fill: var(--color-accent) !important; fill-opacity: 0.85 !important; }
+.svg-canvas [data-state='linked'] { stroke-dasharray: 4 3; stroke: var(--color-accent); fill-opacity: 0.35 !important; }
+.svg-canvas [data-state='multi'] { fill: var(--color-accent) !important; fill-opacity: 0.65 !important; stroke: var(--color-ink); stroke-width: 1.5; }
+.svg-canvas [data-bone-id] { cursor: pointer; }
+.svg-canvas [data-bone-id]:hover { filter: brightness(1.05); }
+```
+
+- [ ] **Step 3:** Verify build
+```bash
+pnpm build
+```
+
+- [ ] **Step 4:** Commit
+```bash
+git add src/styles/tokens.css src/styles/index.css
+git commit -m "feat(styles): design tokens + svg-canvas state rules"
+```
+
+---
+
+## Phase 9 — Brand component
+
+### Task 9.1 — Brand renders config
+
+**Files:**
+- Modify: `src/components/brand/Brand.tsx`
+- Create: `tests/unit/components.Brand.test.tsx`
+
+- [ ] **Step 1:** Test
+```tsx
+import { describe, it, expect } from 'vitest'
+import { render, screen } from '@testing-library/react'
+import { ConfigProvider } from '@/app/providers/ConfigProvider'
+import Brand from '@/components/brand/Brand'
+
+describe('Brand', () => {
+ it('renders the brand name from config', () => {
+ render(
+
+
+ ,
+ )
+ expect(screen.getByText(/Osteo Report/i)).toBeInTheDocument()
+ })
+})
+```
+
+- [ ] **Step 2:** Run; expect FAIL
+
+- [ ] **Step 3:** Implement `src/components/brand/Brand.tsx`
+```tsx
+import { useConfig } from '@/app/providers/ConfigProvider'
+
+export default function Brand({ size = 'md' }: { size?: 'sm' | 'md' | 'lg' }) {
+ const cfg = useConfig()
+ const cls = size === 'lg' ? 'text-3xl' : size === 'sm' ? 'text-base' : 'text-xl'
+ return (
+
+ {cfg.brandName}
+
+ )
+}
+```
+
+- [ ] **Step 4:** Re-run; expect PASS
+
+- [ ] **Step 5:** Commit
+```bash
+git add src/components/brand/Brand.tsx tests/unit/components.Brand.test.tsx
+git commit -m "feat(brand): render brandName from runtime config"
+```
+
+---
+
+## Phase 10 — Anatomy canvas
+
+### Task 10.1 — AnatomyCanvas
+
+**Files:**
+- Modify: `src/components/canvas/AnatomyCanvas.tsx`
+- Create: `tests/unit/components.AnatomyCanvas.test.tsx`
+
+- [ ] **Step 1:** Test
+```tsx
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+import { render, screen, waitFor } from '@testing-library/react'
+import AnatomyCanvas from '@/components/canvas/AnatomyCanvas'
+
+vi.mock('@/anatomy/svgLoader', () => ({
+ loadSvg: vi.fn(async () => {
+ const doc = new DOMParser().parseFromString(
+ ``,
+ 'image/svg+xml',
+ )
+ return doc.documentElement as unknown as SVGSVGElement
+ }),
+}))
+
+beforeEach(() => vi.clearAllMocks())
+
+describe('AnatomyCanvas', () => {
+ it('renders the loaded SVG inline', async () => {
+ render( {}} />)
+ await waitFor(() =>
+ expect(document.querySelector('[data-bone-id="epaule"]')).not.toBeNull(),
+ )
+ })
+
+ it('calls onZoneClick with the clicked bone id', async () => {
+ const onZoneClick = vi.fn()
+ render()
+ await waitFor(() => screen.getByTestId('anatomy-canvas'))
+ ;(document.querySelector('[data-bone-id="epaule"]') as Element).dispatchEvent(
+ new Event('click', { bubbles: true }),
+ )
+ await waitFor(() => expect(onZoneClick).toHaveBeenCalledWith('epaule'))
+ })
+})
+```
+
+- [ ] **Step 2:** Run; expect FAIL
+
+- [ ] **Step 3:** Implement `src/components/canvas/AnatomyCanvas.tsx`. Use `replaceChildren()` to clear the host element — never assign to `innerHTML`.
+```tsx
+import { useEffect, useRef } from 'react'
+import { loadSvg } from '@/anatomy/svgLoader'
+import { getBoneIdFromEvent } from '@/anatomy/svgConvention'
+import type { BoneState } from '@/anatomy/types'
+
+export interface AnatomyCanvasProps {
+ src: string
+ boneStates: Map
+ onZoneClick: (boneId: string) => void
+ className?: string
+}
+
+export default function AnatomyCanvas({
+ src,
+ boneStates,
+ onZoneClick,
+ className = '',
+}: AnatomyCanvasProps) {
+ const containerRef = useRef(null)
+
+ useEffect(() => {
+ let cancelled = false
+ const c = containerRef.current
+ if (!c) return
+ c.replaceChildren()
+ loadSvg(src).then((root) => {
+ if (cancelled || !c) return
+ c.appendChild(root)
+ })
+ return () => { cancelled = true }
+ }, [src])
+
+ useEffect(() => {
+ const c = containerRef.current
+ if (!c) return
+ const onClick = (e: Event) => {
+ const id = getBoneIdFromEvent(e)
+ if (id) onZoneClick(id)
+ }
+ c.addEventListener('click', onClick)
+ return () => c.removeEventListener('click', onClick)
+ }, [onZoneClick])
+
+ useEffect(() => {
+ const c = containerRef.current
+ if (!c) return
+ const all = c.querySelectorAll('[data-bone-id]')
+ all.forEach((el) => {
+ const id = el.getAttribute('data-bone-id') as string
+ const state = boneStates.get(id)
+ if (state && state !== 'default') el.setAttribute('data-state', state)
+ else el.removeAttribute('data-state')
+ })
+ }, [boneStates])
+
+ return (
+
+ )
+}
+```
+
+- [ ] **Step 4:** Re-run; expect PASS
+
+- [ ] **Step 5:** Commit
+```bash
+git add src/components/canvas/AnatomyCanvas.tsx tests/unit/components.AnatomyCanvas.test.tsx
+git commit -m "feat(canvas): inline SVG load + delegated click + state classes"
+```
+
+### Task 10.2 — DetailModal
+
+**Files:**
+- Modify: `src/components/canvas/DetailModal.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import Dialog from '@/components/ui/Dialog'
+import AnatomyCanvas from './AnatomyCanvas'
+import type { BoneState } from '@/anatomy/types'
+
+export interface DetailModalProps {
+ open: boolean
+ onClose: () => void
+ detailSrc: string
+ detailId: string
+ title: string
+ boneStates: Map
+ onZoneClick: (boneId: string, detailId: string) => void
+}
+
+export default function DetailModal({
+ open,
+ onClose,
+ detailSrc,
+ detailId,
+ title,
+ boneStates,
+ onZoneClick,
+}: DetailModalProps) {
+ return (
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/canvas/DetailModal.tsx
+git commit -m "feat(canvas): DetailModal renders detail SVG in Dialog"
+```
+
+### Task 10.3 — ZoneTooltip (deferred — DROPPED FROM v1)
+
+> Plan-review decision: spec hover-tooltip deferred to v1.1. Leave the
+> placeholder file as-is; do not implement. Visual state classes alone
+> (`current` / `linked` / `multi`) communicate zone participation in v1.
+
+---
+
+## Phase 11 — Vertebra picker
+
+### Task 11.1 — Region tabs + chip grid
+
+**Files:**
+- Modify: `src/components/observation/VertebraPicker.tsx`
+- Create: `tests/unit/components.VertebraPicker.test.tsx`
+
+- [ ] **Step 1:** Test
+```tsx
+import { describe, it, expect, vi } from 'vitest'
+import { render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import VertebraPicker from '@/components/observation/VertebraPicker'
+import { EQUINE_VERTEBRAL_FORMULA } from '@/domain/species/equine/vertebrae'
+
+describe('VertebraPicker', () => {
+ it('renders region tabs based on the formula', () => {
+ render(
+ {}}
+ onConfirm={() => {}}
+ initial={[]}
+ formula={EQUINE_VERTEBRAL_FORMULA}
+ title="Vertèbres cervicales"
+ />,
+ )
+ expect(screen.getByRole('tab', { name: /Cervicales/ })).toBeInTheDocument()
+ expect(screen.getByRole('tab', { name: /Thoraciques/ })).toBeInTheDocument()
+ })
+
+ it('toggles a chip and confirms', async () => {
+ const onConfirm = vi.fn()
+ render(
+ {}}
+ onConfirm={onConfirm}
+ initial={[]}
+ formula={EQUINE_VERTEBRAL_FORMULA}
+ title="Vertèbres thoraciques"
+ />,
+ )
+ await userEvent.click(screen.getByRole('tab', { name: /Thoraciques/ }))
+ await userEvent.click(screen.getByRole('button', { name: 'T12' }))
+ await userEvent.click(screen.getByRole('button', { name: 'Valider' }))
+ expect(onConfirm).toHaveBeenCalledWith([{ region: 'T', index: 12 }])
+ })
+})
+```
+
+- [ ] **Step 2:** Run; expect FAIL
+
+- [ ] **Step 3:** Implement
+```tsx
+import { useState } from 'react'
+import Dialog from '@/components/ui/Dialog'
+import Button from '@/components/ui/Button'
+import Chip from '@/components/ui/Chip'
+import type { Vertebra, VertebralRegion } from '@/domain/schema/observation'
+import type { VertebralFormula } from '@/domain/species/types'
+
+const REGION_LABELS: Record = {
+ C: 'Cervicales',
+ T: 'Thoraciques',
+ L: 'Lombaires',
+ S: 'Sacrales',
+ Cd: 'Caudales',
+}
+
+export interface VertebraPickerProps {
+ open: boolean
+ onClose: () => void
+ onConfirm: (vertebrae: Vertebra[]) => void
+ initial: Vertebra[]
+ formula: VertebralFormula
+ title: string
+}
+
+export default function VertebraPicker({
+ open,
+ onClose,
+ onConfirm,
+ initial,
+ formula,
+ title,
+}: VertebraPickerProps) {
+ const [selected, setSelected] = useState(initial)
+ const [activeRegion, setActiveRegion] = useState('C')
+
+ const has = (r: VertebralRegion, i: number) =>
+ selected.some((v) => v.region === r && v.index === i)
+
+ const toggle = (r: VertebralRegion, i: number) => {
+ setSelected((cur) =>
+ has(r, i)
+ ? cur.filter((v) => !(v.region === r && v.index === i))
+ : [...cur, { region: r, index: i }],
+ )
+ }
+
+ const all = (r: VertebralRegion, count: number) => {
+ setSelected((cur) => {
+ const rest = cur.filter((v) => v.region !== r)
+ return [...rest, ...Array.from({ length: count }, (_, k) => ({ region: r, index: k + 1 }))]
+ })
+ }
+
+ const none = (r: VertebralRegion) =>
+ setSelected((cur) => cur.filter((v) => v.region !== r))
+
+ const count = formula[activeRegion]
+
+ return (
+
+ )
+}
+```
+
+- [ ] **Step 4:** Re-run; expect PASS
+
+- [ ] **Step 5:** Commit
+```bash
+git add src/components/observation/VertebraPicker.tsx tests/unit/components.VertebraPicker.test.tsx
+git commit -m "feat(observation): VertebraPicker dialog with region tabs + chip grid"
+```
+
+---
+
+## Phase 12 — Pathology picker + free-text + severity
+
+### Task 12.1 — PathologyPicker
+
+**Files:**
+- Modify: `src/components/observation/PathologyPicker.tsx`
+- Create: `tests/unit/components.PathologyPicker.test.tsx`
+
+- [ ] **Step 1:** Test
+```tsx
+import { describe, it, expect, vi } from 'vitest'
+import { render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import PathologyPicker from '@/components/observation/PathologyPicker'
+import type { Pathology } from '@/domain/schema/pathology'
+
+const POOL: Pathology[] = [
+ {
+ id: 'a',
+ labelFr: 'Aïe',
+ description: '',
+ category: 'osseux',
+ speciesIds: ['equine'],
+ boneIds: ['epaule'],
+ sources: [{ type: 'manual', citation: 'X' }],
+ },
+ {
+ id: 'b',
+ labelFr: 'Aïe-aïe',
+ description: '',
+ category: 'osseux',
+ speciesIds: ['equine'],
+ boneIds: ['hanche'],
+ sources: [{ type: 'manual', citation: 'X' }],
+ },
+]
+
+describe('PathologyPicker', () => {
+ it('shows only pathologies matching zones', () => {
+ render(
+ {}}
+ />,
+ )
+ expect(screen.getByLabelText('Aïe')).toBeInTheDocument()
+ expect(screen.queryByLabelText('Aïe-aïe')).toBeNull()
+ })
+
+ it('toggles selection', async () => {
+ const onChange = vi.fn()
+ render(
+ ,
+ )
+ await userEvent.click(screen.getByLabelText('Aïe'))
+ expect(onChange).toHaveBeenCalledWith(['a'])
+ })
+})
+```
+
+- [ ] **Step 2:** Run; expect FAIL
+
+- [ ] **Step 3:** Implement
+```tsx
+import { useMemo } from 'react'
+import type { Pathology } from '@/domain/schema/pathology'
+
+export interface PathologyPickerProps {
+ pool: Pathology[]
+ speciesId: string
+ boneIds: string[]
+ selected: string[]
+ onChange: (next: string[]) => void
+}
+
+function matches(p: Pathology, speciesId: string, boneIds: string[]): boolean {
+ const speciesOk = p.speciesIds.length === 0 || p.speciesIds.includes(speciesId)
+ if (!speciesOk) return false
+ if (boneIds.length === 0) return true
+ if (p.boneIds.length === 0) return true
+ return p.boneIds.some((b) => boneIds.includes(b))
+}
+
+export default function PathologyPicker({
+ pool,
+ speciesId,
+ boneIds,
+ selected,
+ onChange,
+}: PathologyPickerProps) {
+ const filtered = useMemo(
+ () => pool.filter((p) => matches(p, speciesId, boneIds)),
+ [pool, speciesId, boneIds],
+ )
+
+ function toggle(id: string) {
+ onChange(selected.includes(id) ? selected.filter((x) => x !== id) : [...selected, id])
+ }
+
+ if (filtered.length === 0) {
+ return (
+
+ Aucune pathologie de référence pour ces zones. Ajoutez-en une en texte libre ci-dessous.
+
+ )
+ }
+
+ return (
+
+ {filtered.map((p) => (
+ -
+
+
+ ))}
+
+ )
+}
+```
+
+- [ ] **Step 4:** Re-run; expect PASS
+
+- [ ] **Step 5:** Commit
+```bash
+git add src/components/observation/PathologyPicker.tsx tests/unit/components.PathologyPicker.test.tsx
+git commit -m "feat(observation): PathologyPicker filtered by species + zones"
+```
+
+### Task 12.2 — FreeTextPathologyInput
+
+**Files:**
+- Modify: `src/components/observation/FreeTextPathologyInput.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import { useState } from 'react'
+import Input from '@/components/ui/Input'
+import Button from '@/components/ui/Button'
+import Badge from '@/components/ui/Badge'
+
+export interface FreeTextPathologyInputProps {
+ items: string[]
+ onChange: (next: string[]) => void
+}
+
+export default function FreeTextPathologyInput({
+ items,
+ onChange,
+}: FreeTextPathologyInputProps) {
+ const [v, setV] = useState('')
+ function add() {
+ const trimmed = v.trim()
+ if (!trimmed) return
+ onChange([...items, trimmed])
+ setV('')
+ }
+ function remove(i: number) {
+ onChange(items.filter((_, k) => k !== i))
+ }
+ return (
+
+
+ setV(e.target.value)}
+ placeholder="Pathologie additionnelle (texte libre)"
+ onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault(); add() } }}
+ aria-label="Pathologie libre"
+ />
+
+
+ {items.length > 0 && (
+
+ {items.map((it, i) => (
+ -
+
+ {it}
+
+
+
+ ))}
+
+ )}
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/observation/FreeTextPathologyInput.tsx
+git commit -m "feat(observation): FreeTextPathologyInput with chip removal"
+```
+
+### Task 12.3 — SeveritySelector
+
+**Files:**
+- Modify: `src/components/observation/SeveritySelector.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import type { Severity } from '@/domain/schema/observation'
+
+export interface SeveritySelectorProps {
+ value: Severity | undefined
+ onChange: (s: Severity | undefined) => void
+}
+
+const SEVERITIES: Severity[] = ['légère', 'modérée', 'sévère']
+const COLORS: Record = {
+ 'légère': 'border-[var(--severity-mild)] text-[var(--severity-mild)]',
+ 'modérée': 'border-[var(--severity-moderate)] text-[var(--severity-moderate)]',
+ 'sévère': 'border-[var(--severity-severe)] text-[var(--severity-severe)]',
+}
+
+export default function SeveritySelector({ value, onChange }: SeveritySelectorProps) {
+ return (
+
+ {SEVERITIES.map((s) => (
+
+ ))}
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/observation/SeveritySelector.tsx
+git commit -m "feat(observation): SeveritySelector radio chips"
+```
+
+---
+
+## Phase 13 — Observation list, card, editor
+
+### Task 13.1 — ObservationCard
+
+**Files:**
+- Modify: `src/components/observation/ObservationCard.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import type { Observation } from '@/domain/schema/observation'
+import Card from '@/components/ui/Card'
+import Badge from '@/components/ui/Badge'
+import Button from '@/components/ui/Button'
+
+export interface ObservationCardProps {
+ observation: Observation
+ index: number
+ active: boolean
+ onSelect: () => void
+ onDelete: () => void
+ onMoveUp: () => void
+ onMoveDown: () => void
+ canMoveUp: boolean
+ canMoveDown: boolean
+}
+
+export default function ObservationCard({
+ observation,
+ index,
+ active,
+ onSelect,
+ onDelete,
+ onMoveUp,
+ onMoveDown,
+ canMoveUp,
+ canMoveDown,
+}: ObservationCardProps) {
+ const zoneCount = observation.zones.length
+ const patCount =
+ observation.pathologyIds.length + observation.freeTextPathologies.length
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/observation/ObservationCard.tsx
+git commit -m "feat(observation): ObservationCard with reorder + delete affordances"
+```
+
+### Task 13.2 — ObservationList
+
+**Files:**
+- Modify: `src/components/observation/ObservationList.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import type { Observation } from '@/domain/schema/observation'
+import ObservationCard from './ObservationCard'
+import Button from '@/components/ui/Button'
+
+export interface ObservationListProps {
+ observations: Observation[]
+ activeIndex: number
+ onSelect: (i: number) => void
+ onAdd: () => void
+ onDelete: (i: number) => void
+ onMoveUp: (i: number) => void
+ onMoveDown: (i: number) => void
+}
+
+export default function ObservationList({
+ observations,
+ activeIndex,
+ onSelect,
+ onAdd,
+ onDelete,
+ onMoveUp,
+ onMoveDown,
+}: ObservationListProps) {
+ return (
+
+
+
Observations
+
+
+ {observations.length === 0 ? (
+
+ Aucune observation. Cliquez sur "+ Nouvelle observation" puis sur les zones du schéma.
+
+ ) : (
+
+ {observations.map((obs, i) => (
+ -
+ onSelect(i)}
+ onDelete={() => onDelete(i)}
+ onMoveUp={() => onMoveUp(i)}
+ onMoveDown={() => onMoveDown(i)}
+ canMoveUp={i > 0}
+ canMoveDown={i < observations.length - 1}
+ />
+
+ ))}
+
+ )}
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/observation/ObservationList.tsx
+git commit -m "feat(observation): ObservationList with add + per-card actions"
+```
+
+### Task 13.3 — ObservationEditor
+
+**Files:**
+- Modify: `src/components/observation/ObservationEditor.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import { useMemo } from 'react'
+import type { Observation, ObservationZone, Vertebra } from '@/domain/schema/observation'
+import type { Pathology } from '@/domain/schema/pathology'
+import type { Bone } from '@/anatomy/types'
+import Label from '@/components/ui/Label'
+import Textarea from '@/components/ui/Textarea'
+import Badge from '@/components/ui/Badge'
+import PathologyPicker from './PathologyPicker'
+import FreeTextPathologyInput from './FreeTextPathologyInput'
+import SeveritySelector from './SeveritySelector'
+
+export interface ObservationEditorProps {
+ observation: Observation
+ bones: Map
+ speciesId: string
+ pathologyPool: Pathology[]
+ onChange: (next: Observation) => void
+ onOpenVertebraPicker: (zoneIndex: number) => void
+ onRemoveZone: (zoneIndex: number) => void
+}
+
+function describeZone(z: ObservationZone, bones: Map): string {
+ const b = bones.get(z.boneId)
+ const label = b?.fr ?? z.boneId
+ if (z.vertebrae?.length) {
+ const vs = z.vertebrae.map((v: Vertebra) => `${v.region}${v.index}`).join(', ')
+ return `${label} (${vs})`
+ }
+ return label
+}
+
+export default function ObservationEditor({
+ observation,
+ bones,
+ speciesId,
+ pathologyPool,
+ onChange,
+ onOpenVertebraPicker,
+ onRemoveZone,
+}: ObservationEditorProps) {
+ const zoneBoneIds = useMemo(
+ () => observation.zones.map((z) => z.boneId),
+ [observation.zones],
+ )
+
+ return (
+
+
+
+ {observation.zones.length === 0 ? (
+
+ Cliquez sur les zones du schéma pour les ajouter à cette observation.
+
+ ) : (
+
+ {observation.zones.map((z, i) => {
+ const b = bones.get(z.boneId)
+ const isSpine = b?.category === 'spine-zone'
+ return (
+ -
+
+ {describeZone(z, bones)}
+ {isSpine && (
+
+ )}
+
+
+
+ )
+ })}
+
+ )}
+
+
+
+
+ onChange({ ...observation, pathologyIds: ids })}
+ />
+
+
+
+
+ onChange({ ...observation, freeTextPathologies: items })}
+ />
+
+
+
+
+ onChange({ ...observation, severity: s })}
+ />
+
+
+
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/observation/ObservationEditor.tsx
+git commit -m "feat(observation): ObservationEditor wires zones + pathologies + severity + comment"
+```
+
+---
+
+## Phase 14 — Report forms
+
+### Task 14.1 — PractitionerForm
+
+**Files:**
+- Modify: `src/components/report/PractitionerForm.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import type { Practitioner } from '@/domain/schema/practitioner'
+import Label from '@/components/ui/Label'
+import Input from '@/components/ui/Input'
+
+export interface PractitionerFormProps {
+ value: Practitioner
+ onChange: (next: Practitioner) => void
+}
+
+export default function PractitionerForm({ value, onChange }: PractitionerFormProps) {
+ const set = (patch: Partial) => onChange({ ...value, ...patch })
+ return (
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/report/PractitionerForm.tsx
+git commit -m "feat(report): PractitionerForm with required name + optional fields"
+```
+
+### Task 14.2 — AnimalForm
+
+**Files:**
+- Modify: `src/components/report/AnimalForm.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import type { Animal, Owner } from '@/domain/schema/animal'
+import Label from '@/components/ui/Label'
+import Input from '@/components/ui/Input'
+import Select from '@/components/ui/Select'
+import { getAllSpecies } from '@/domain/species/registry'
+
+export interface AnimalFormProps {
+ animal: Animal
+ owner: Owner
+ onChangeAnimal: (next: Animal) => void
+ onChangeOwner: (next: Owner) => void
+}
+
+export default function AnimalForm({ animal, owner, onChangeAnimal, onChangeOwner }: AnimalFormProps) {
+ const species = getAllSpecies()
+ const setA = (patch: Partial) => onChangeAnimal({ ...animal, ...patch })
+ return (
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/report/AnimalForm.tsx
+git commit -m "feat(report): AnimalForm + owner name with species select"
+```
+
+### Task 14.3 — ConclusionPanel + NextAppointmentPicker
+
+**Files:**
+- Modify: `src/components/report/ConclusionPanel.tsx`
+- Modify: `src/components/report/NextAppointmentPicker.tsx`
+
+- [ ] **Step 1:** NextAppointmentPicker
+```tsx
+import type { Report } from '@/domain/schema/report'
+import Input from '@/components/ui/Input'
+import Label from '@/components/ui/Label'
+
+export interface NextAppointmentPickerProps {
+ value: Report['nextAppointment']
+ onChange: (next: Report['nextAppointment']) => void
+}
+
+export default function NextAppointmentPicker({ value, onChange }: NextAppointmentPickerProps) {
+ const kind = value?.kind ?? 'date'
+ return (
+
+ )
+}
+```
+
+- [ ] **Step 2:** ConclusionPanel
+```tsx
+import type { Report } from '@/domain/schema/report'
+import Label from '@/components/ui/Label'
+import Textarea from '@/components/ui/Textarea'
+import NextAppointmentPicker from './NextAppointmentPicker'
+
+export interface ConclusionPanelProps {
+ conclusion: string
+ recommendations: string
+ nextAppointment: Report['nextAppointment']
+ onChangeConclusion: (s: string) => void
+ onChangeRecommendations: (s: string) => void
+ onChangeNextAppointment: (n: Report['nextAppointment']) => void
+}
+
+export default function ConclusionPanel({
+ conclusion,
+ recommendations,
+ nextAppointment,
+ onChangeConclusion,
+ onChangeRecommendations,
+ onChangeNextAppointment,
+}: ConclusionPanelProps) {
+ return (
+
+ Conclusion & recommandations
+
+
+
+
+
+
+
+
+ )
+}
+```
+
+- [ ] **Step 3:** Commit
+```bash
+git add src/components/report/ConclusionPanel.tsx src/components/report/NextAppointmentPicker.tsx
+git commit -m "feat(report): ConclusionPanel + NextAppointmentPicker (date | period | none)"
+```
+
+### Task 14.4 — ReportHeader
+
+**Files:**
+- Modify: `src/components/report/ReportHeader.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import type { Report } from '@/domain/schema/report'
+import Brand from '@/components/brand/Brand'
+import { formatDateFr } from '@/lib/dates'
+
+export interface ReportHeaderProps {
+ report: Report
+}
+
+export default function ReportHeader({ report }: ReportHeaderProps) {
+ return (
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/components/report/ReportHeader.tsx
+git commit -m "feat(report): ReportHeader with brand + animal/owner/date"
+```
+
+---
+
+## Phase 15 — Routes
+
+### Task 15.1 — HomeRoute
+
+**Files:**
+- Modify: `src/app/routes/HomeRoute.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import { useNavigate } from 'react-router-dom'
+import { useRef, useState } from 'react'
+import Brand from '@/components/brand/Brand'
+import Button from '@/components/ui/Button'
+import Card from '@/components/ui/Card'
+import { useConfig } from '@/app/providers/ConfigProvider'
+import { importReportFromPdf, ImportError } from '@/pdf/import'
+import { useReportStore } from '@/state/reportStore'
+
+export default function HomeRoute() {
+ const navigate = useNavigate()
+ const cfg = useConfig()
+ const fileRef = useRef(null)
+ const hydrate = useReportStore((s) => s.hydrateReport)
+ const [error, setError] = useState(null)
+ const [busy, setBusy] = useState(false)
+
+ async function onPickFile(e: React.ChangeEvent) {
+ const file = e.target.files?.[0]
+ if (!file) return
+ setBusy(true)
+ setError(null)
+ try {
+ const bytes = new Uint8Array(await file.arrayBuffer())
+ const report = await importReportFromPdf(bytes)
+ hydrate(report)
+ navigate('/editor')
+ } catch (err) {
+ setError(err instanceof ImportError ? err.message : "Erreur de lecture du PDF.")
+ } finally {
+ setBusy(false)
+ if (fileRef.current) fileRef.current.value = ''
+ }
+ }
+
+ return (
+
+
+
+
+
+ Nouveau bilan
+
+ Démarrer un nouveau bilan d'ostéopathie sur un animal.
+
+
+
+
+ Importer un PDF
+
+ Reprendre un bilan précédent généré par cette application pour effectuer un suivi.
+
+
+
+ {error && {error}
}
+
+
+
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/app/routes/HomeRoute.tsx
+git commit -m "feat(home): HomeRoute with new + import PDF flows"
+```
+
+### Task 15.2 — NewReportRoute
+
+**Files:**
+- Modify: `src/app/routes/NewReportRoute.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import { useEffect, useState } from 'react'
+import { useNavigate } from 'react-router-dom'
+import PractitionerForm from '@/components/report/PractitionerForm'
+import AnimalForm from '@/components/report/AnimalForm'
+import Brand from '@/components/brand/Brand'
+import Button from '@/components/ui/Button'
+import Input from '@/components/ui/Input'
+import Label from '@/components/ui/Label'
+import { todayIso } from '@/lib/dates'
+import { readCachedPractitioner, writeCachedPractitioner } from '@/state/practitionerCache'
+import { useReportStore } from '@/state/reportStore'
+
+export default function NewReportRoute() {
+ const navigate = useNavigate()
+ const initReport = useReportStore((s) => s.initReport)
+
+ const [practitioner, setPractitioner] = useState({ name: '' })
+ const [animal, setAnimal] = useState({ speciesId: 'equine', name: '' })
+ const [owner, setOwner] = useState({ name: '' })
+ const [date, setDate] = useState(todayIso())
+
+ useEffect(() => {
+ const cached = readCachedPractitioner()
+ if (cached) setPractitioner(cached)
+ }, [])
+
+ const canSubmit = practitioner.name.trim() && animal.name.trim() && owner.name.trim()
+
+ function submit() {
+ if (!canSubmit) return
+ writeCachedPractitioner(practitioner)
+ initReport({
+ date,
+ practitioner,
+ animal,
+ owner,
+ observations: [],
+ conclusion: '',
+ recommendations: '',
+ })
+ navigate('/editor')
+ }
+
+ return (
+
+
+
+
+
+
+
Nouveau bilan
+
+
+ setDate(e.target.value)} />
+
+
+
+
+
+
+
+
+
+ )
+}
+```
+
+- [ ] **Step 2:** Commit
+```bash
+git add src/app/routes/NewReportRoute.tsx
+git commit -m "feat(new): NewReportRoute wires forms + practitioner cache"
+```
+
+### Task 15.3 — EditorRoute
+
+**Files:**
+- Modify: `src/app/routes/EditorRoute.tsx`
+
+- [ ] **Step 1:** Implement
+```tsx
+import { useEffect, useMemo, useState } from 'react'
+import { useNavigate } from 'react-router-dom'
+import AnatomyCanvas from '@/components/canvas/AnatomyCanvas'
+import DetailModal from '@/components/canvas/DetailModal'
+import ObservationList from '@/components/observation/ObservationList'
+import ObservationEditor from '@/components/observation/ObservationEditor'
+import VertebraPicker from '@/components/observation/VertebraPicker'
+import ConclusionPanel from '@/components/report/ConclusionPanel'
+import ReportHeader from '@/components/report/ReportHeader'
+import Button from '@/components/ui/Button'
+import { useReportStore } from '@/state/reportStore'
+import { getSpecies } from '@/domain/species/registry'
+import { loadSvg } from '@/anatomy/svgLoader'
+import { parseSvgBones } from '@/anatomy/svgConvention'
+import type { Bone, BoneState } from '@/anatomy/types'
+import type { Observation, ObservationZone } from '@/domain/schema/observation'
+import type { Pathology } from '@/domain/schema/pathology'
+import { exportReportToPdf } from '@/pdf/export'
+
+export default function EditorRoute() {
+ const navigate = useNavigate()
+ const report = useReportStore((s) => s.report)
+ const activeIndex = useReportStore((s) => s.activeObservationIndex)
+ const addObservation = useReportStore((s) => s.addObservation)
+ const updateObservation = useReportStore((s) => s.updateObservation)
+ const removeObservation = useReportStore((s) => s.removeObservation)
+ const moveObservationUp = useReportStore((s) => s.moveObservationUp)
+ const moveObservationDown = useReportStore((s) => s.moveObservationDown)
+ const setActiveObservation = useReportStore((s) => s.setActiveObservation)
+ const setConclusion = useReportStore((s) => s.setConclusion)
+ const setRecommendations = useReportStore((s) => s.setRecommendations)
+ const setNextAppointment = useReportStore((s) => s.setNextAppointment)
+
+ const [bones, setBones] = useState