import { useMemo } from 'react' import type { AnatomicalSheetDocument, SheetView, } from '@faunosteo/core-wasm/types' import Input from '@/components/ui/Input' import { groupAnnotations, useOverviewCounts, } from '@/editor/annotations/overview' import type { AnnotationSection } from '@/editor/navigation' import { usePlural } from '@/editor/plural' import { useT } from '@/i18n/useT' import { useLocaleStore } from '@/state/localeStore' import AnnotationList, { annotationName } from './AnnotationList' const CARD = 'space-y-2 rounded-xl border border-[var(--color-border)] p-4' const TITLE = 'text-sm font-semibold' const ROW = 'flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]' const ENTRY = 'inline-flex min-h-11 items-center rounded-lg border border-[var(--color-border)] px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]' export interface OverviewPanelProps { doc: AnatomicalSheetDocument /** The view the canvas shows. */ viewId: string /** Read-only modes only consult: the entries read « Voir … ». */ readOnly: boolean /** Put before every id (the read-only twin beside the kept edit panel). */ idPrefix?: string /** The « Filtrer par nom » term, held by the parent so a selection does not lose it. */ filter: string onFilter: (term: string) => void onSelectView: (viewId: string) => void /** The selection, marked in the list (A3). */ selectedId: string | null onSelectAnnotation: (annotationId: string) => void /** Enter on the selected row: its properties dialog (A1). */ onOpenAnnotation: (annotationId: string) => void onOpenSection: (section: AnnotationSection, opener: HTMLElement) => void } function SectionEntry({ section, label, onOpen, }: { section: AnnotationSection label: string onOpen: OverviewPanelProps['onOpenSection'] }) { return ( ) } function ViewRow({ view, current, count, onSelect, }: { view: SheetView current: boolean count: number onSelect: () => void }) { const t = useT() const plural = usePlural() const locale = useLocaleStore((s) => s.locale) return (
{t('editor.overview.categories_empty')}
)}{t( total === 0 ? 'editor.annotations.list_empty' : 'editor.overview.no_match', )}
)}