Commit Graph
72 Commits
Author SHA1 Message Date
Bastien ChanotandClaude Opus 4.7 e8c29c1fdf fix(editor,pdf): accordion observation cards + seed 1 obs + native SVG rasterization
Three issues from manual QA:

1. UX restructure — observations are now an accordion list. Each card has
   a header that's always visible (title + chips + chevron + action
   buttons) and a body that expands inline showing zones / pathologies /
   severity / comment. Click the header (or the chevron) to toggle.
   ObservationEditor has been merged into ObservationCard so each card
   owns its own details. Only one observation is expanded at a time; the
   chevron on the active card collapses everything. EditorRoute uses
   activeObservationIndex === -1 to represent "all collapsed".

2. App used to start with 2 observations instead of 1. Root cause:
   EditorRoute had a "seed first observation" useEffect that fired twice
   under React 19 StrictMode in dev, both invocations seeing length=0 and
   queueing addObservation(). Fixed by moving the seed into the store's
   initReport (synchronous, one-shot) and removing the useEffect entirely.
   Store tests updated to assert the seed behaviour (90/90 pass).

3. PDF export still failed with "The input is not a PNG file!" — canvg
   was returning bytes that pdf-lib rejected at embedPng(). Switched
   rasterizeSvg to the browser-native pipeline: serialize the SVG into a
   Blob URL, load it with an Image element, drawImage onto a 2D canvas,
   then toBlob → PNG bytes (with a toDataURL fallback). Validates the
   PNG signature before returning. Tree-shaking dropped canvg from the
   bundle (979 kB → 874 kB JS).

Tests updated for the new initReport behaviour and the new svgToPng
pipeline (Image mock + dataURL fallback case). lint + typecheck + build
all clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 23:32:01 +02:00
Bastien ChanotandClaude Opus 4.7 bdf5e6475b fix(bugs): obs card click + next-RDV radio + PDF toBlob fallback + head svg interactivity
Five fixes from manual QA:

1. ObservationCard — clicking anywhere on the card now selects it.
   The wrapping button only covered the text rows; empty space was dead.
   The whole card is now role="button" with keyboard (Enter/Space) support;
   inner action buttons (↑ ↓ 🗑) stop propagation so they don't double-fire.
   This was also the root cause of "details look stuck" — the active
   observation simply wasn't being switched.

2. NextAppointmentPicker — when value === undefined the "Date" radio was
   still showing as checked because `kind` defaulted to 'date'. The three
   radios now read from the raw `value?.kind` (which can be undefined),
   so "Aucun" is the only checked option when no next RDV is set.

3. svgToPng.rasterizeSvg — `canvas.toBlob` can return null in some
   browsers when the canvas state is unusual; the call now falls back to
   `canvas.toDataURL('image/png')` and decodes the base64 payload. Also
   paints a white background before canvg renders (so the PDF embed is
   opaque) and clamps width/height to >= 1px to avoid zero-area canvases.
   canvg errors are caught + logged instead of propagating, so the export
   still produces a (possibly blank) page rather than throwing.

4. svgConvention.parseSvgBones — clickable bones are now distinguished
   from decorative ones. Interactive = has a hitbox element OR category
   is spine-zone OR head. Decorative bones (teeth, malar, mandible,
   nasal-bone, facial-crest, individual vertebrae paths…) get
   `pointer-events: none` applied to their elements and are excluded from
   the returned map. Result: in Horse_head.svg, frontal/temporal/parietal/
   sphenoid/occipital/atm/ssb/c0-c1/hyoid become clickable as intended,
   while teeth / malar / mandible no longer intercept the clicks.

5. (covered by #1) — the per-observation details panel always read the
   active observation; the bug was the click handler scope. Confirmed by
   switching observations: the editor section now updates immediately.

88 tests still pass, lint clean, build clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:48:13 +02:00
Bastien ChanotandClaude Opus 4.7 9a99fc916b docs: reframe as multi-praticien + multi-species (equine = first data set, not specialization)
The app is open to any praticien who wants to use it (not 'single-praticien'),
and the architecture is multi-species — equine ships first, dog/cat/goat/cow/
pig/rabbit/donkey/sheep come as pure data drops following the same convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:20:03 +02:00
Bastien ChanotandClaude Opus 4.7 cfefde6aab docs(readme): sync status to v1.0 MVP complete (88 tests, build clean)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:16:59 +02:00
Bastien ChanotandClaude Opus 4.7 188e79e76d fix(review): address code-review yellows — onExport catch, vertebra picker fresh-read, draft validation
Three impactful fixes from the post-impl code review:

1. EditorRoute.onExport now catches PDF generation failures, logs to
   console, and alerts the praticien in French — previously errors were
   swallowed by try/finally with only `setExporting(false)`.
2. VertebraPicker onConfirm reads the active observation from the store
   at confirm time instead of closing over the render-scope `activeObs`.
   Prevents mutating a stale observation if the praticien switches active
   observation while the picker is open.
3. readPersistedDraft validates the parsed JSON with ReportSchema instead
   of a raw `as Report` cast. Corrupted drafts now return null cleanly
   rather than poisoning the store.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:16:12 +02:00
Bastien ChanotandClaude Opus 4.7 dabab59656 chore: drop dead svgToPngDataUrl stub (replaced by pdf/render/svgToPng.rasterizeSvg)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:06:26 +02:00
Bastien ChanotandClaude Opus 4.7 abd4f78a46 chore(memory): log MVP delivery in journal
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:02:45 +02:00
Bastien ChanotandClaude Opus 4.7 4355055a42 docs(species): document how to add a new species end-to-end
Replace the placeholder with a full 7-step walkthrough: SVG convention,
file placement under public/, species manifest at src/domain/species/<id>/,
registry wiring, vertebral formula, pathology seed (empty allowed in v1),
and the two mirror tests (registry + real-SVG parse + pathologies schema).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:02:29 +02:00
Bastien ChanotandClaude Opus 4.7 0aa8f46f5c test(qa): document MVP manual QA checklist outcome
Capture the plan §23.2 walkthrough as an unticked checklist with
deliberate TODO markers. Automated browser QA was out of scope for the
/init-project session; this file is the handoff for a manual pnpm dev
verification before delivery. Includes the matching automated coverage
table so reviewers know what is already enforced by CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:01:02 +02:00
Bastien ChanotandClaude Opus 4.7 a33693580f fix(lint): escape JSX entities and narrow useEffect dep
Escape French apostrophes/quotes in JSX text per react/no-unescaped-entities
and replace the report?.observations.length dependency with a derived
observationsCount value so react-hooks/exhaustive-deps is satisfied without
re-firing on every report change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:00:15 +02:00
Bastien ChanotandClaude Opus 4.7 3c32f66eb6 fix(docker): write env.js from APP_* env vars at container start
Wire index.html to actually load /env.js before the Vite bundle so the
runtime config injected by docker/entrypoint.sh takes effect. Add a
public/env.js stub so local dev and static builds don't 404 — the Docker
container overwrites it via the entrypoint.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 21:57:36 +02:00
Bastien Chanot 97ab4f67d1 feat(pdf): importReportFromPdf with ImportError on non-osteo PDFs 2026-05-18 21:55:03 +02:00
Bastien Chanot cf57297d2d feat(pdf): exportReportToPdf orchestrator with finalized page numbering 2026-05-18 21:53:55 +02:00
Bastien Chanot fb9a8fc3bd feat(pdf): attach + extract report JSON via pdf-lib (with fallback traversal) 2026-05-18 21:53:26 +02:00
Bastien Chanot 1c0b507458 feat(pdf): addConclusionPage with wrapped conclusion + recommendations + next RDV 2026-05-18 21:46:23 +02:00
Bastien Chanot 384d2918d4 feat(pdf): addObservationPage with rasterized colorized SVG + summary 2026-05-18 21:45:58 +02:00
Bastien Chanot 6cbc6ce328 feat(pdf): drawFooter with brand from runtime config 2026-05-18 21:45:26 +02:00
Bastien Chanot 099ebf326b feat(pdf): drawHeader with practitioner + animal/owner/date 2026-05-18 21:45:05 +02:00
Bastien Chanot ba30e0dbaf feat(pdf): embed Helvetica + Times-Roman standard fonts (MVP) 2026-05-18 21:44:25 +02:00
Bastien Chanot 55d9c32076 feat(pdf): rasterize SVG via canvg → PNG bytes 2026-05-18 21:43:58 +02:00
Bastien Chanot 3ea8f522c0 test(species): pin pathology DB integrity contract (empty allowed in v1) 2026-05-18 21:42:15 +02:00
Bastien Chanot a3a4d4e1f6 feat(app): NotFoundRoute 2026-05-18 21:38:55 +02:00
Bastien Chanot 337f8c3aea feat(editor): wire canvas + observation panel + conclusion + export 2026-05-18 21:38:38 +02:00
Bastien Chanot 2b2a7db63c feat(new): NewReportRoute wires forms + practitioner cache 2026-05-18 21:37:24 +02:00
Bastien Chanot 9271a79067 feat(home): HomeRoute with new + import PDF flows 2026-05-18 21:37:00 +02:00
Bastien Chanot c1483ff265 feat(report): ReportHeader with brand + animal/owner/date 2026-05-18 21:30:59 +02:00
Bastien Chanot 6b115a558e feat(report): ConclusionPanel + NextAppointmentPicker (date | period | none) 2026-05-18 21:30:43 +02:00
Bastien Chanot 71ecebfa72 feat(report): AnimalForm + owner name with species select 2026-05-18 21:30:08 +02:00
Bastien Chanot 2970e7fcf5 feat(report): PractitionerForm with required name + optional fields 2026-05-18 21:29:43 +02:00
Bastien Chanot 3ef1c60682 feat(observation): ObservationEditor wires zones + pathologies + severity + comment 2026-05-18 21:29:22 +02:00
Bastien Chanot 10fa676f1e feat(observation): ObservationList with add + per-card actions 2026-05-18 21:28:53 +02:00
Bastien Chanot 1e4e56d2e2 feat(observation): ObservationCard with reorder + delete affordances 2026-05-18 21:28:33 +02:00
Bastien Chanot c78fe004dd feat(observation): SeveritySelector radio chips 2026-05-18 21:28:06 +02:00
Bastien Chanot 241bb42c7d feat(observation): FreeTextPathologyInput with chip removal 2026-05-18 21:27:45 +02:00
Bastien Chanot 4c67c900b9 feat(observation): PathologyPicker filtered by species + zones 2026-05-18 21:27:11 +02:00
Bastien Chanot b3e1a87690 feat(observation): VertebraPicker dialog with region tabs + chip grid 2026-05-18 21:23:55 +02:00
Bastien Chanot 19baf0281f feat(canvas): DetailModal renders detail SVG in Dialog 2026-05-18 21:23:00 +02:00
Bastien Chanot bea3712851 feat(canvas): inline SVG load + delegated click + state classes 2026-05-18 21:22:39 +02:00
Bastien Chanot 90d398656c feat(brand): render brandName from runtime config 2026-05-18 21:19:20 +02:00
Bastien Chanot cc5f4d077a feat(styles): design tokens + svg-canvas state rules 2026-05-18 21:18:47 +02:00
Bastien Chanot afd58b386b feat(ui): Dialog with backdrop + escape + motion fade 2026-05-18 21:18:18 +02:00
Bastien Chanot a1453ec32e feat(ui): Chip toggle 2026-05-18 21:17:32 +02:00
Bastien Chanot 03332246d3 feat(ui): Badge with tones 2026-05-18 21:17:12 +02:00
Bastien Chanot b806bedc4f feat(ui): Select 2026-05-18 21:16:56 +02:00
Bastien Chanot 2ac996605a feat(ui): Textarea 2026-05-18 21:16:40 +02:00
Bastien Chanot 2cb1640384 feat(ui): Label 2026-05-18 21:16:23 +02:00
Bastien Chanot 92052a31c1 feat(ui): Input 2026-05-18 21:16:09 +02:00
Bastien Chanot 226678017f feat(ui): Card 2026-05-18 21:15:53 +02:00
Bastien Chanot fe5adcd249 feat(ui): Button with variants + sizes + disabled state 2026-05-18 21:15:33 +02:00
Bastien Chanot 86f65767de feat(state): implement practitioner localStorage cache 2026-05-18 21:06:18 +02:00