import type { ComponentType } from 'react' import type { AnnotationSection } from '@/editor/navigation' import { panelDomId, type EditorPlaceProps, type EditorTabId, } from '@/editor/tabs' import { useT } from '@/i18n/useT' import AnnotationsTab from './tabs/AnnotationsTab' import FindingsTab from './tabs/FindingsTab' import GeneralTab from './tabs/GeneralTab' import VerificationTab from './tabs/VerificationTab' const BODIES: Record< Exclude, ComponentType > = { general: GeneralTab, findings: FindingsTab, verification: VerificationTab, } /** What only the Annotations tab needs beyond the common place props. */ export interface AnnotationNav { section: AnnotationSection onOpenSection: (section: AnnotationSection, opener: HTMLElement) => void onBack: () => void } interface Props extends EditorPlaceProps { tab: EditorTabId annotations: AnnotationNav } /** The panel of the active tab; a place unmounts when left (kept alive in Lot B2). */ export default function EditorTabBody({ tab, annotations, ...props }: Props) { const t = useT() const Body = tab === 'annotations' ? null : BODIES[tab] return (
{Body ? ( ) : ( )}
) }