Files
dynamicbrain.neuroinf.jp/src/common/lib/PageNotFound.tsx
T
orrisroot 87c0274bc1 feat: migrate from Create React App to Vite
Rebuild the site on the stack the other converted sites share: Vite 8,
React 19, TypeScript 7, react-router 8, Biome and sanitize.css, with the
site data moved out of the bundle into static-contents/.

- base the database, credits and pico code on cerebellum.neuroinf.jp,
  keeping this site's item types, rankings and menus
- port the MediaWiki pages to function components
- serve all module data from modules/, redirecting the old download and
  /database/file URLs
- tile the plate texture and keep form controls on white
- track page views with GA4
2026-09-14 16:57:14 +09:00

45 lines
1.2 KiB
TypeScript

import { Helmet } from '@dr.pogodin/react-helmet';
import { useEffect } from 'react';
import { useLocation, useNavigate } from 'react-router';
import type { MultiLang } from '../../config';
import Functions from '../../functions';
interface Props {
lang: MultiLang;
}
const TOP_URL = '/';
const PageNotFound = (props: Props) => {
const { lang } = props;
const location = useLocation();
const navigate = useNavigate();
useEffect(() => {
if (location.pathname === TOP_URL) {
return;
}
const timer = setTimeout(() => {
void navigate(TOP_URL);
}, 5000);
return () => clearTimeout(timer);
}, [location.pathname, navigate]);
return (
<div>
<Helmet>
<title>Page Not Found - {Functions.siteTitle(lang)}</title>
</Helmet>
<h1>Page Not Found</h1>
<section>
<p>The page you were trying to access doesn't exist.</p>
<p>
If the page does not automatically reload, please go to the <a href={TOP_URL}>top page</a>
</p>
</section>
</div>
);
};
export default PageNotFound;