refactor(anatomy): category becomes free-form string, no enum / no auto-trigger

User asked that the app interact with anything carrying data-anno-*
attributes without hardcoding any specific category, id, or name. Future
SVGs may introduce new categories, and the existing SVGs may be updated.

Changes:
- `BoneCategory` is now `type BoneCategory = string`. The closed union
  is gone; the parser accepts any non-empty value. New categories don't
  require code changes.
- `VALID_CATEGORIES` and `isValidCategory()` removed from
  svgConvention.ts. `validateBoneElement()` now only enforces presence
  of `data-anno-id` and `data-anno-category`.
- EditorRoute no longer auto-triggers the vertebra picker when the
  clicked annotation is `zone-colonne`. Any zone is added the same way
  to the active observation regardless of category.
- ObservationCard shows a "Vertèbres…" link on every zone badge (was
  conditional on `category === 'zone-colonne'`). The praticien picks
  vertebrae only when relevant — the UI no longer knows or cares which
  zones are spinal.
- Tests rewritten: removed the `isValidCategory` enum assertions and
  the "rejects unknown category" branch. New test demonstrates that
  parseSvgBones accepts a completely novel category string.

90/90 tests pass, lint clean, build clean.

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-19 04:10:54 +02:00
1 parent cad94a49db
commit 21b678c3d5
5 files changed
+41 -76

No files matched your search

+8 -10
View File
@@ -187,20 +187,18 @@ export default function ObservationCard({
<ul className="flex flex-wrap gap-2">
{observation.zones.map((z, i) => {
const b = bones.get(z.boneId)
const isSpine = b?.category === 'zone-colonne'
return (
<li key={`${z.boneId}-${i}`}>
<Badge tone="accent" className="gap-2">
{describeZone(z, bones)}
{isSpine && (
<button
type="button"
onClick={() => onOpenVertebraPicker(i)}
className="underline text-xs text-[var(--color-accent-strong)]"
>
Préciser…
</button>
)}
<button
type="button"
onClick={() => onOpenVertebraPicker(i)}
className="underline text-xs text-[var(--color-accent-strong)]"
title="Préciser les vertèbres pour cette zone"
>
Vertèbres…
</button>
<button
type="button"
aria-label={`Retirer ${b?.fr ?? z.boneId}`}