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

+14 -14
View File
@@ -7,7 +7,7 @@ import type {
AnatomicalSheetDocument,
NewElement,
} from '@faunosteo/core-wasm/types'
import ViewsTab from '@/components/editor/tabs/ViewsTab'
import ViewsSection from '@/components/editor/annotations/sections/ViewsSection'
import { useLocaleStore } from '@/state/localeStore'
import { ASSET, emptyText, insert, point } from '../helpers/editorFixtures'
import {
@@ -29,7 +29,7 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const props = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const props = { readOnly: false, navigate: vi.fn(), reloadSheet: vi.fn() }
const doc = (): AnatomicalSheetDocument =>
JSON.parse(store.getState().documentText)
const detail = (
@@ -56,7 +56,7 @@ afterEach(() => {
async function openCrop(text: string) {
await openReady({ text })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
await user.click(
screen.getByRole('button', { name: 'Modifier le recadrage' }),
)
@@ -77,7 +77,7 @@ const cropField = (name: string) =>
describe('Vues et illustrations: drawing states', () => {
it('a valid main drawing shows its state and no hint', async () => {
await openReady()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(screen.getByText('Illustration valide')).toBeTruthy()
expect(
screen.queryByText(/Utilisez « Choisir une illustration »/),
@@ -86,7 +86,7 @@ describe('Vues et illustrations: drawing states', () => {
it('a main view without drawing shows the hint pointing at the button', async () => {
await openReady({ text: emptyText() })
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(screen.getByText('Aucune illustration')).toBeTruthy()
expect(
screen.getByText(/Utilisez « Choisir une illustration »/),
@@ -104,7 +104,7 @@ describe('Vues et illustrations: drawing states', () => {
)
store.getState().open('ver-1', 'user-1', { canEdit: true })
await vi.waitFor(() => expect(store.getState().status).toBe('ready'))
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(screen.getByText(/Illustration introuvable/)).toBeTruthy()
expect(
screen.getByText(/Utilisez « Choisir une illustration »/),
@@ -124,7 +124,7 @@ describe('Vues et illustrations: drawing states', () => {
sb.downloadSheetDrawing.mockResolvedValue(bytes)
store.getState().open('ver-1', 'user-1', { canEdit: true })
await vi.waitFor(() => expect(store.getState().status).toBe('ready'))
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(
screen.getByText(
/Illustration refusée : elle n'est pas sous la forme enregistrée/,
@@ -143,7 +143,7 @@ describe('Vues et illustrations: drawing states', () => {
)
store.getState().open('ver-1', 'user-1', { canEdit: true })
await vi.waitFor(() => expect(store.getState().status).toBe('ready'))
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(
screen.getByText(/ne correspond pas à son empreinte SHA-256 enregistrée/),
).toBeTruthy()
@@ -155,7 +155,7 @@ describe('Vues et illustrations: drawing states', () => {
;(own.value as { svg_asset_id: string | null }).svg_asset_id = ASSET
await openReady({ text: insert(baseText(), own) })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
const open = () =>
user.click(
screen.getByRole('button', {
@@ -182,7 +182,7 @@ describe('Vues et illustrations: drawing states', () => {
it('read-only shows states as text and no action', async () => {
await openReady({ text: insert(baseText(), detail()) })
render(<ViewsTab {...props} readOnly />)
render(<ViewsSection {...props} readOnly />)
expect(screen.getByText('Illustration valide')).toBeTruthy()
expect(screen.queryByRole('button')).toBeNull()
expect(screen.queryByRole('textbox')).toBeNull()
@@ -193,7 +193,7 @@ describe('Vues et illustrations: detail views', () => {
it('adds a detail view with names and a crop, in one insert', async () => {
await openReady()
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
await user.click(screen.getByRole('button', { name: 'Ajouter la vue' }))
expect(screen.getByRole('alert')).toHaveTextContent('Renseignez les noms')
await user.type(document.getElementById('view-new-fr')!, 'Tête')
@@ -224,7 +224,7 @@ describe('Vues et illustrations: detail views', () => {
it('renames on blur and refuses a blank name locally', async () => {
await openReady({ text: insert(baseText(), detail()) })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
const name = document.getElementById('view-view-d-name-en')!
await user.clear(name)
await user.type(name, 'Lower leg')
@@ -243,7 +243,7 @@ describe('Vues et illustrations: detail views', () => {
)
await openReady({ text })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
await user.click(screen.getByRole('button', { name: 'Supprimer' }))
const dialog = await screen.findByRole('dialog')
expect(within(dialog).getByText(/ne peut pas être supprimé/)).toBeTruthy()
@@ -359,7 +359,7 @@ describe('Vues et illustrations: crop group under the frame check', () => {
const text = insert(insert(baseText(), detail()), detail2())
await openReady({ text })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
await user.selectOptions(
document.getElementById('view-view-d-parent')!,
'view-e',