feat(app): Aller à selects the element in its tab, reload after submit

This commit is contained in:
bchanot committed 2026-11-04 14:06:09 +01:00
1 parent 2a54fa4c78
commit 4f223e04cd
24 files changed
+473 -66

No files matched your search

@@ -0,0 +1,20 @@
import type {
AnatomicalSheetDocument,
ElementKey,
} from '@faunosteo/core-wasm/types'
/** What « Aller à … » seeds in the Annotations tab: a view, and maybe an annotation. */
export function annotationFocus(
doc: AnatomicalSheetDocument,
key: ElementKey,
): { viewId: string; annotationId: string | null } | null {
if (key.kind === 'view') {
const view = doc.views.find((v) => v.id === key.id)
return view ? { viewId: view.id, annotationId: null } : null
}
if (key.kind !== 'annotation') return null
const annotation = doc.annotations.find((a) => a.id === key.id)
return annotation
? { viewId: annotation.view_id, annotationId: annotation.id }
: null
}