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

+37 -5
View File
@@ -19,11 +19,13 @@ 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 type { SpeciesFindings } from '@/domain/schema/findings'
import type { Practitioner } from '@/domain/schema/practitioner'
import type { Animal, Owner } from '@/domain/schema/animal'
import { exportReportToPdf } from '@/pdf/export'
const DISCLAIMER_FLAG = 'osteo:disclaimer-shown'
export default function EditorRoute() {
const navigate = useNavigate()
const report = useReportStore((s) => s.report)
@@ -43,7 +45,8 @@ export default function EditorRoute() {
const [bones, setBones] = useState<Map<string, Bone>>(new Map())
const [detailBones, setDetailBones] = useState<Map<string, Bone>>(new Map())
const [pathologies, setPathologies] = useState<Pathology[]>([])
const [findings, setFindings] = useState<SpeciesFindings | null>(null)
const [disclaimer, setDisclaimer] = useState<string | null>(null)
const [detail, setDetail] = useState<{
id: string
src: string
@@ -86,6 +89,13 @@ export default function EditorRoute() {
closeEditInfos()
}
function acknowledgeDisclaimer() {
if (typeof sessionStorage !== 'undefined') {
sessionStorage.setItem(DISCLAIMER_FLAG, '1')
}
setDisclaimer(null)
}
useEffect(() => {
if (!report) navigate('/')
}, [report, navigate])
@@ -98,9 +108,16 @@ export default function EditorRoute() {
useEffect(() => {
if (!species) return
loadSvg(species.mainSvg).then((root) => setBones(parseSvgBones(root)))
species.pathologies().then((m) => setPathologies(m.default))
species.findings().then((m) => setFindings(m.default))
}, [species])
useEffect(() => {
if (!findings) return
if (typeof sessionStorage === 'undefined') return
if (sessionStorage.getItem(DISCLAIMER_FLAG)) return
setDisclaimer(findings.scope_disclaimer)
}, [findings])
useEffect(() => {
if (!detail) return
let cancelled = false
@@ -248,8 +265,7 @@ export default function EditorRoute() {
onMoveUp={moveObservationUp}
onMoveDown={moveObservationDown}
bones={allBones}
speciesId={species.id}
pathologyPool={pathologies}
findings={findings}
onChange={(i, next: Observation) => updateObservation(i, next)}
onOpenVertebraPicker={(_i, zoneIndex) =>
setVertebraTarget(zoneIndex)
@@ -332,6 +348,22 @@ export default function EditorRoute() {
</Dialog>
)}
{disclaimer && (
<Dialog
open
onClose={acknowledgeDisclaimer}
title="Périmètre légal de l'ostéopathie animale"
size="md"
>
<div className="space-y-4">
<p className="text-sm text-[var(--color-ink)]">{disclaimer}</p>
<div className="flex justify-end">
<Button onClick={acknowledgeDisclaimer}>Compris</Button>
</div>
</div>
</Dialog>
)}
{vertebraTarget !== null &&
activeObs &&
activeObs.zones[vertebraTarget] && (