feat(editor): unified spine picker — show all regions, click opens own tab

The vertebra picker now edits the whole spine at once instead of a single
zone. Seed it with the union of vertebrae across every spine zone of the
observation (collectSpineVertebrae) so switching tabs reveals selections made
on other zones. Clicking a zone always opens its own region tab (initialRegion
now takes priority over the first existing selection).

On confirm, syncSpineZones reconciles authoritatively per region: replace each
region's vertebrae (deselection sticks), prune a spine zone whose region drops
to zero, spawn a zone for a newly picked region. Non-spine zones and their
order are preserved untouched. Supersedes the additive distribute model.

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-27 19:22:42 +02:00
1 parent fc7069c2cb
commit 38888cb3d1
5 files changed
+137 -96

No files matched your search

@@ -63,7 +63,7 @@ describe('VertebraPicker', () => {
)
})
it('region of first existing selection wins over initialRegion', () => {
it('opens on initialRegion even when other regions are pre-selected', () => {
render(
<VertebraPicker
open
@@ -71,11 +71,11 @@ describe('VertebraPicker', () => {
onConfirm={() => {}}
initial={[{ region: 'S', index: 2 }]}
formula={EQUINE_VERTEBRAL_FORMULA}
title="Vertèbres sacrales"
title="Vertèbres cervicales"
initialRegion="C"
/>,
)
expect(screen.getByRole('tab', { name: /Sacrales/ })).toHaveAttribute(
expect(screen.getByRole('tab', { name: /Cervicales/ })).toHaveAttribute(
'aria-selected',
'true',
)