58 lines
2.2 KiB
TypeScript
58 lines
2.2 KiB
TypeScript
import { useRouterState } from '@tanstack/react-router';
|
|
import useHydrated from '@/hooks/useHydrated';
|
|
import { t } from '@/i18n';
|
|
import { isShootSectionPath } from '@/lib/isShootSectionPath';
|
|
import LinkButton from '../LinkButton';
|
|
import StatusPage from './StatusPage';
|
|
|
|
// Pagina voor een onbekende URL, binnen de shell (FR-09). Een globale
|
|
// not-found heeft geen eigen route-head; React 19 zet <title> en <meta>
|
|
// daarom zelf in <head> en haalt ze weer weg bij het verlaten (BR-404-02).
|
|
// Onder /soorten-fotoshoots/ komt er een knop naar het overzicht bij
|
|
// (FR-ST-14).
|
|
export default function NotFound() {
|
|
// De prerender is gemaakt voor /404; het echte pad telt pas na de
|
|
// hydratatie, anders verschilt de eerste render van de HTML (BR-404-04)
|
|
const hydrated = useHydrated();
|
|
const pathname = useRouterState({
|
|
select: (routerState) => routerState.location.pathname,
|
|
});
|
|
|
|
return (
|
|
<>
|
|
<title>
|
|
{t('common.status.documentTitle', {
|
|
title: t('common.status.notFound.title'),
|
|
siteName: t('common.site.name'),
|
|
})}
|
|
</title>
|
|
<meta name="robots" content="noindex" />
|
|
<StatusPage
|
|
title={t('common.status.notFound.title')}
|
|
actions={
|
|
hydrated && isShootSectionPath(pathname) ? (
|
|
<>
|
|
<LinkButton
|
|
to="/soorten-fotoshoots"
|
|
variant="accent"
|
|
data-testid="status-page-section-link"
|
|
>
|
|
{t('common.status.backToShoots')}
|
|
</LinkButton>
|
|
<LinkButton
|
|
to="/"
|
|
variant="outline"
|
|
data-testid="status-page-home-link"
|
|
>
|
|
{t('common.actions.backHome')}
|
|
</LinkButton>
|
|
</>
|
|
) : undefined
|
|
}
|
|
>
|
|
{t('common.status.notFound.text')}
|
|
</StatusPage>
|
|
</>
|
|
);
|
|
}
|