feat(editor): findings tree picker + scope disclaimer + PDF render

Replaces the flat PathologyPicker with FindingsTreePicker — breadcrumb
navigation, drill into intermediate categories, toggle leaves, optional
vet-referral badge, optional description rendering. One picker per zone
that has a catalog entry; zones without a tree fall back to the free-text
input (renamed FreeTextFindingInput to match the new vocabulary).

EditorRoute now loads SpeciesFindings instead of a Pathology[] and shows
the scope_disclaimer once per session via a sessionStorage flag so the
practitioner is reminded of the legal perimeter the first time.

PDF observationPage renders findings via the snapshotted FR label and
prefixes ⚠ on vet-referral items, keeping the existing layout pipeline
intact (LRN-007/008/009 still apply).

Also drops the unused Toast and ZoneTooltip stubs, refreshes the
CLAUDE.md folder map, and adds a FindingsTreePicker test covering
navigation, leaf toggle, vet-referral flag, and back-out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude Opus 4.7 committed 2026-05-20 03:49:11 +02:00
1 parent d08d773d74
commit b67f4cd82b
12 files changed
+473 -186

No files matched your search

@@ -0,0 +1,68 @@
import { useState } from 'react'
import Input from '@/components/ui/Input'
import Button from '@/components/ui/Button'
import Badge from '@/components/ui/Badge'
export interface FreeTextFindingInputProps {
items: string[]
onChange: (next: string[]) => void
}
export default function FreeTextFindingInput({
items,
onChange,
}: FreeTextFindingInputProps) {
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 (
<div className="space-y-2">
<div className="flex gap-2">
<Input
value={v}
onChange={(e) => setV(e.target.value)}
placeholder="Observation additionnelle (texte libre)"
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.preventDefault()
add()
}
}}
aria-label="Observation libre"
/>
<Button onClick={add} variant="secondary">
Ajouter
</Button>
</div>
{items.length > 0 && (
<ul className="flex flex-wrap gap-2">
{items.map((it, i) => (
<li key={`${it}-${i}`}>
<Badge tone="accent" className="gap-1">
{it}
<button
type="button"
aria-label={`Retirer ${it}`}
onClick={() => remove(i)}
className="ml-1 text-[var(--color-accent-strong)] hover:text-[var(--color-danger)]"
>
✕
</button>
</Badge>
</li>
))}
</ul>
)}
</div>
)
}