All files / pages/public LegalDocPage.tsx

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33                                    10x       10x 1x     9x            
// src/pages/public/LegalDocPage.tsx
import type {ReactElement} from 'react';
import NotFoundPage from './NotFoundPage';
import LegalPageShell from '../../components/layout/LegalPageShell';
import LegalDocumentView from '../../components/legal/LegalDocumentView';
import {LEGAL_DOCS} from '../../content/legal';
 
interface LegalDocPageProps {
	/** Registry slug of the document to render (e.g. "privacy"). */
	slug: string;
}
 
/**
 * Public page for a single static legal/policy document. Content lives in
 * src/content/legal/ (generated from counsel's source files); this component
 * just resolves the slug and hands it to the shared renderer.
 */
export default function LegalDocPage({slug}: LegalDocPageProps): ReactElement {
	const doc = LEGAL_DOCS[slug];
 
	// An unregistered slug is a dead link like any other — say so rather than
	// bouncing the visitor to the landing page (FSC-167).
	if (doc === undefined) {
		return <NotFoundPage/>;
	}
 
	return (
		<LegalPageShell title={doc.title} lastUpdated={doc.lastUpdated}>
			<LegalDocumentView doc={doc}/>
		</LegalPageShell>
	);
}