From e064a4eed0156f8b878958fc22163b0ec52d3958 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 23 Nov 2026 18:12:33 +0100 Subject: [PATCH] feat(app): access labels on the editor, the catalogue and the bilan --- .../src/app/routes/app/anatomy/SheetRoute.tsx | 1 + .../src/components/canvas/AnatomyCanvas.tsx | 11 ++ .../components/catalogue/CatalogueCanvas.tsx | 23 +++- .../editor/annotations/AnnotationCanvas.tsx | 46 +++++++- .../components/editor/tabs/AnnotationsTab.tsx | 1 + .../unit/components.AnatomyCanvas.test.tsx | 56 ++++++++++ .../unit/editor-annotations-tab.test.tsx | 102 ++++++++++++++++++ apps/app/tests/unit/routes.catalogue.test.tsx | 46 ++++++++ 8 files changed, 283 insertions(+), 3 deletions(-) diff --git a/apps/app/src/app/routes/app/anatomy/SheetRoute.tsx b/apps/app/src/app/routes/app/anatomy/SheetRoute.tsx index c9c098db..73bd053b 100644 --- a/apps/app/src/app/routes/app/anatomy/SheetRoute.tsx +++ b/apps/app/src/app/routes/app/anatomy/SheetRoute.tsx @@ -154,6 +154,7 @@ function LoadedSheet({ versions, version, preview, state }: LoadedSheetProps) { detail={view.kind === 'detail'} selectedId={selectedId} onAnnotation={onAnnotation} + onAccess={setViewId} /> diff --git a/apps/app/src/components/canvas/AnatomyCanvas.tsx b/apps/app/src/components/canvas/AnatomyCanvas.tsx index 2ef90830..a4f03423 100644 --- a/apps/app/src/components/canvas/AnatomyCanvas.tsx +++ b/apps/app/src/components/canvas/AnatomyCanvas.tsx @@ -11,6 +11,7 @@ import { pickLocaleLabel } from '@/i18n/pickLocaleLabel' import Button from '@/components/ui/Button' import Notice from '@/components/ui/Notice' import { useT } from '@/i18n/useT' +import AccessLabels from './AccessLabels' export interface AnatomyCanvasProps { index: SheetIndex @@ -53,6 +54,8 @@ export default function AnatomyCanvas({ // Each retry builds again; a failed build leaves the canvas empty behind the notice. const [attempt, setAttempt] = useState(0) const [failure, setFailure] = useState(null) + // Bumped after each svg rebuild: the labels measure the drawing as rebuilt. + const [built, setBuilt] = useState(0) // Derived at render: an engine failure shown while the engine stops becomes the stopped text. const stopped = useCoreStopped() const unsaved = useReportStore(isUnsaved) @@ -71,6 +74,7 @@ export default function AnatomyCanvas({ const build = buildViewSvg(index, viewId) setFailure(build.ok ? null : build.failure) host.replaceChildren(...(build.ok ? [build.svg] : [])) + setBuilt((n) => n + 1) }, [index, viewId, attempt]) useEffect(() => { @@ -152,6 +156,13 @@ export default function AnatomyCanvas({ className={`w-full h-full [&>svg]:max-w-full [&>svg]:max-h-full [&>svg]:mx-auto ${detail ? BAND_BACKGROUND : ''}`} />
+