feat(editor): four tabs, Annotations sections, references from the header

U1 Lot B1. Four tabs (Général, Annotations, Constats, Vérification); views,
categories and regions become full-width Annotations sections opened from the
overview panel; references move to a header-toggled panel (minimal, Lot D
completes it); « Aller à » goes through EditorTarget and the navigation hook.
EditorWorkspace owns the navigation; DraftHeader split in HeaderActions and
SaveLine; EditorTabs split in TabList and MoreTabs.

R-24, assertions removed or rewritten (file: old -> new):
unit
- editor-route.test: seven tab names -> four; « Plus » at 800 px with
  Références clicked -> no « Plus »; below 640 px five others -> Général,
  Constats, and Constats opens the findings tab; + references panel cases
- editor-route-recovery.test: tab Références + editor-tab-references label ->
  header button + editor-references-panel labelled by its heading
- editor-mode.test: small tier `more` of five -> [general, findings]
- editor-focus-request.test: {key,serial} -> {target,serial}; ReferencesTab and
  VertebraeTab -> ReferencesPanel and RegionsSection; issueTarget tab/key ->
  target place/section/key (vertebrae tab -> annotations/regions); consumed
  context (serial) -> (serial, outcome); annotation case adds heading focus
- editor-verification.test: onGoTo('annotations', key) -> navigate(targetOfKey
  (key), opener); props onSelectTab/onGoTo -> navigate
- editor-annotations-tab.test: props onSelectTab -> navigate + section props;
  no_category text « (onglet Général) » -> « (Annotations, section
  Catégories) »
- editor-tabs-general.test: categories cases render GeneralTab ->
  CategoriesSection(doc); + Général holds no categories editor
- editor-tabs-lists.test: tab imports -> panel and section; read-only
  references « no button » -> only « Fermer les références »
- editor-tabs-views, editor-drawing-upload, editor-repair.test: ViewsTab ->
  ViewsSection import, assertions kept; editor-findings.test: navigate prop
e2e
- support/editor selectTab: exact name -> pattern (error badge in the name);
  + place, openSection, showDrawing, backToDrawing, openReferences, TABS
- support/warm-up: seven tabs -> four + sections + references panel
- editor-access: seven-tab axe loops -> four tabs + three sections + panel
  (edit and read-only); narrow widths add panel overflow and axe
- editor-drawings: tab Vues -> openSection views; tab Annotations ->
  showDrawing
- editor-structures: tab Général (categories) -> openSection categories, axe
  label « general tab » -> « categories section »; tab Références ->
  openReferences/closeReferences; tab Vertèbres -> openSection regions; tab
  Annotations -> showDrawing
- editor-geometry: three tab Vues -> openSection views
- editor-equine: tab Général (categories add) -> openSection categories; five
  tabs loop -> two tabs + sections + panel; tab Annotations -> showDrawing
- editor-journey: tab Vues, tab Général (category), tab Annotations ->
  openSection views/categories, showDrawing; frozen axe scrolls to the header
- lan/trial-lan (not run): tab Vues -> Annotations tab + views entry

Verified: typecheck, lint, vitest 107 files / 1125 tests, whole shell suite on
the sandbox 151 passed, 49 skipped, 0 failed.
This commit is contained in:
bchanot committed 2026-11-06 20:25:35 +01:00
1 parent 95b1b7e461
commit bc2dba7c14
56 files changed
+2419 -699

No files matched your search

@@ -4,7 +4,12 @@ import { act, cleanup, render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { SheetFailure } from '@faunosteo/supabase'
import VerificationTab from '@/components/editor/tabs/VerificationTab'
import { ISSUE_CODES, issueMessageKey } from '@/editor/verification'
import {
ISSUE_CODES,
issueMessageKey,
issueTarget,
placeKey,
} from '@/editor/verification'
import { getDict } from '@/i18n'
import { useLocaleStore } from '@/state/localeStore'
import { insert, point } from '../helpers/editorFixtures'
@@ -27,10 +32,9 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const onSelectTab = vi.fn()
const navigate = vi.fn()
const reloadSheet = vi.fn()
const onGoTo = vi.fn()
const props = { readOnly: false, onSelectTab, onGoTo, reloadSheet }
const props = { readOnly: false, navigate, reloadSheet }
const SUBMIT = 'Soumettre à la revue'
/** An annotation without geometry: a blocking error of the core. */
@@ -48,8 +52,7 @@ beforeEach(() => useLocaleStore.setState({ locale: 'fr' }))
afterEach(() => {
cleanup()
resetStore()
onSelectTab.mockReset()
onGoTo.mockReset()
navigate.mockReset()
reloadSheet.mockReset()
})
@@ -81,10 +84,15 @@ describe('Vérification panel', () => {
await user.click(
screen.getAllByRole('button', { name: 'Aller à Sans tracé' })[0],
)
expect(onGoTo).toHaveBeenCalledWith('annotations', {
kind: 'annotation',
id: 'anno-bare',
})
expect(navigate).toHaveBeenCalledWith(
{
place: 'tab',
tab: 'annotations',
section: 'drawing',
key: { kind: 'annotation', id: 'anno-bare' },
},
expect.any(HTMLElement),
)
expect(screen.queryByText('Aucun problème détecté')).toBeNull()
})
@@ -204,6 +212,62 @@ describe('Submission', () => {
})
})
describe('issueTarget', () => {
const at = (path: string) => issueTarget(doc(), path, 'fr')?.target
const doc = () => JSON.parse(store.getState().documentText)
it('each issue root names its place and the element it resolves to', async () => {
await openReady({ text: textWithError() })
expect(at('views[0].frame')).toMatchObject({
place: 'tab',
tab: 'annotations',
section: 'views',
key: { kind: 'view', id: 'view-main' },
})
expect(at('categories[0].name')).toMatchObject({
place: 'tab',
tab: 'annotations',
section: 'categories',
key: { kind: 'category', id: 'cat-a' },
})
expect(at('vertebral_config.regions[0].count')).toMatchObject({
place: 'tab',
tab: 'annotations',
section: 'regions',
})
expect(at('references[0].citation')).toMatchObject({
place: 'references',
citedBy: null,
})
expect(at('finding_zones[0].name')).toMatchObject({
place: 'tab',
tab: 'findings',
})
expect(at('annotations[0].geometry')).toMatchObject({
tab: 'annotations',
section: 'drawing',
})
})
it('a path whose element is gone names the place alone, and the label names it', async () => {
await openReady({ text: textWithError() })
const gone = at('views[9].frame')
expect(gone).toEqual({
place: 'tab',
tab: 'annotations',
section: 'views',
key: null,
})
expect(placeKey(gone!)).toBe('editor.place.views')
expect(placeKey(at('references[9].citation')!)).toBe(
'editor.place.references',
)
expect(placeKey(at('annotations[9].geometry')!)).toBe(
'editor.tab.annotations',
)
})
})
describe('Issue messages', () => {
it('has an FR and an EN message for every known code', () => {
for (const code of ISSUE_CODES) {