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

@@ -24,7 +24,7 @@ export interface VertebraPickerProps {
initial: Vertebra[]
formula: VertebralFormula
title: string
/** Preselected tab. Overridden by the region of the first existing selection. */
/** Tab to open on. Takes priority so a click always lands on its own zone. */
initialRegion?: VertebralRegion
}
@@ -40,7 +40,7 @@ export default function VertebraPicker({
const t = useT()
const [selected, setSelected] = useState<Vertebra[]>(initial)
const [activeRegion, setActiveRegion] = useState<VertebralRegion>(
() => initial[0]?.region ?? initialRegion ?? 'C',
() => initialRegion ?? initial[0]?.region ?? 'C',
)
const has = (r: VertebralRegion, i: number) =>