Skip to content

Commit

Permalink
Split out NotFound page to its own component, improve.
Browse files Browse the repository at this point in the history
  • Loading branch information
meiamsome committed Jan 5, 2025
1 parent 4448e7b commit 2d5eb5b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
22 changes: 22 additions & 0 deletions packages/react/src/components/common/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Button } from "@/shadcn/ui/button";
import { Helmet } from "react-helmet-async";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";

export default function NotFound() {
const { t } = useTranslation();

return (
<>
<Helmet>
<title>{t("views.notFound.title")} - Holodex</title>
</Helmet>
<div className="text-center">
<h1 className="my-10 text-xl font-bold">{t("views.notFound.title")}</h1>
<Button asChild variant="secondary">
<Link to="/">{t("views.notFound.back")}</Link>
</Button>
</div>
</>
);
}
2 changes: 1 addition & 1 deletion packages/react/src/locales/en/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ views:
dateuploadedLatestFirst: Upload date, latest first
dateuploadedEarliestFirst: Upload date, earliest first
notFound:
title: Content not found
title: Content Not Found
back: Return Home
search:
sort:
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/routes/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const Watch = lazy(() =>
const ResetClientPage = lazy(() =>
import("./debug").then((module) => ({ default: module.ResetClientPage })),
);
const NotFound = lazy(() => import("@/components/common/NotFound"));
const Playlist = lazy(() => import("./playlist"));
const Multiview = lazy(() =>
import("./multiview/multiview").then((module) => ({
Expand Down Expand Up @@ -174,6 +175,6 @@ export const routes = (
<Route path="watch/:id" Component={Watch} />
<Route path="debug" Component={ResetClientPage} />
<Route path="debug/run" element={<div>Debug Run</div>} />
<Route path="*" element={<div>Not found</div>} />
<Route path="*" Component={NotFound} />
</Route>
);

0 comments on commit 2d5eb5b

Please sign in to comment.