feat(editor): board 01 annotation card, side column from 1 024 px

Annotations of the view move from under the drawing to the overview card
(grouped by category, name filter, all rows); side column from lg.
Properties panel gains « Toutes les annotations ».

E2E mapping (R-24): after a creation the card is hidden (the new annotation is
selected), so list(...).getByText(name) became selectionTag toContainText
(annotations, geometry, journey); row clicks go through pickAnnotation
(annotations, geometry, journey, structures); geometry's list count 0 while a
creation is pending became selectionTag count 0.
This commit is contained in:
bchanot committed 2026-11-06 21:40:25 +01:00
1 parent 51fd3db608
commit 6131225288
16 files changed
+404 -94

No files matched your search

+39 -1
View File
@@ -1,5 +1,10 @@
import { useMemo } from 'react'
import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types'
import type {
AnatomicalSheetDocument,
Annotation,
AnnotationCategory,
} from '@faunosteo/core-wasm/types'
import { folded } from '@/catalogue/useCatalogue'
/**
* What the overview panel counts, read once per parsed document: the annotations of each
@@ -24,3 +29,36 @@ export function useOverviewCounts(
): OverviewCounts {
return useMemo(() => overviewCounts(doc), [doc])
}
/** The annotations of one category in the shown view; `category` is null for strays. */
export interface AnnotationGroup {
category: AnnotationCategory | null
annotations: Annotation[]
}
/**
* The annotations of a view grouped by category in document order, keeping those whose
* displayed name contains `term` (case and accents ignored). A group « Sans catégorie »
* exists only when an annotation names a category the document does not hold.
*/
export function groupAnnotations(
doc: AnatomicalSheetDocument,
viewId: string,
term: string,
nameOf: (annotation: Annotation) => string,
): AnnotationGroup[] {
const wanted = folded(term.trim())
const shown = doc.annotations.filter(
(a) => a.view_id === viewId && folded(nameOf(a)).includes(wanted),
)
const known = new Set(doc.categories.map((category) => category.id))
const groups: AnnotationGroup[] = doc.categories.map((category) => ({
category,
annotations: shown.filter((a) => a.category_id === category.id),
}))
groups.push({
category: null,
annotations: shown.filter((a) => !known.has(a.category_id)),
})
return groups.filter((group) => group.annotations.length > 0)
}