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>
This commit is contained in:
1 parent
9a99fc916b
commit
bdf5e6475b
5 files changed
+189
-37
No files matched your search
@@ -7,30 +7,53 @@ export interface NextAppointmentPickerProps {
|
||||
onChange: (next: Report['nextAppointment']) => void
|
||||
}
|
||||
|
||||
export default function NextAppointmentPicker({ value, onChange }: NextAppointmentPickerProps) {
|
||||
const kind = value?.kind ?? 'date'
|
||||
export default function NextAppointmentPicker({
|
||||
value,
|
||||
onChange,
|
||||
}: NextAppointmentPickerProps) {
|
||||
const kind = value?.kind
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<Label>Prochain rendez-vous</Label>
|
||||
<div className="flex gap-2 mb-2">
|
||||
<label className="text-sm flex items-center gap-1">
|
||||
<input type="radio" checked={kind === 'date'} onChange={() => onChange({ kind: 'date', date: '' })} />
|
||||
<input
|
||||
type="radio"
|
||||
checked={kind === 'date'}
|
||||
onChange={() => onChange({ kind: 'date', date: '' })}
|
||||
/>
|
||||
Date
|
||||
</label>
|
||||
<label className="text-sm flex items-center gap-1">
|
||||
<input type="radio" checked={kind === 'period'} onChange={() => onChange({ kind: 'period', text: '' })} />
|
||||
<input
|
||||
type="radio"
|
||||
checked={kind === 'period'}
|
||||
onChange={() => onChange({ kind: 'period', text: '' })}
|
||||
/>
|
||||
Période libre
|
||||
</label>
|
||||
<label className="text-sm flex items-center gap-1">
|
||||
<input type="radio" checked={value === undefined} onChange={() => onChange(undefined)} />
|
||||
<input
|
||||
type="radio"
|
||||
checked={value === undefined}
|
||||
onChange={() => onChange(undefined)}
|
||||
/>
|
||||
Aucun
|
||||
</label>
|
||||
</div>
|
||||
{value?.kind === 'date' && (
|
||||
<Input type="date" value={value.date} onChange={(e) => onChange({ kind: 'date', date: e.target.value })} />
|
||||
<Input
|
||||
type="date"
|
||||
value={value.date}
|
||||
onChange={(e) => onChange({ kind: 'date', date: e.target.value })}
|
||||
/>
|
||||
)}
|
||||
{value?.kind === 'period' && (
|
||||
<Input value={value.text} placeholder="ex. dans 3 semaines" onChange={(e) => onChange({ kind: 'period', text: e.target.value })} />
|
||||
<Input
|
||||
value={value.text}
|
||||
placeholder="ex. dans 3 semaines"
|
||||
onChange={(e) => onChange({ kind: 'period', text: e.target.value })}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user