From d464040d8e35fb64195e286155c35156fd69a627 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sat, 8 Aug 2020 10:11:24 +0300 Subject: [PATCH] Router: add more 404s. --- src/Calendars/Main.tsx | 4 +++- src/Contacts/Main.tsx | 4 +++- src/PageNotFound.tsx | 19 ++++++++++++++++--- src/SyncGate.tsx | 3 +++ src/Tasks/Main.tsx | 4 +++- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/Calendars/Main.tsx b/src/Calendars/Main.tsx index 6e38ebe..acdebcb 100644 --- a/src/Calendars/Main.tsx +++ b/src/Calendars/Main.tsx @@ -19,7 +19,7 @@ import Calendar from "./Calendar"; import Event from "./Event"; import LoadingIndicator from "../widgets/LoadingIndicator"; import EventEdit from "./EventEdit"; -import PageNotFound from "../PageNotFound"; +import PageNotFound, { PageNotFoundRoute } from "../PageNotFound"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemDelete, itemSave } from "../Pim/helpers"; import { historyPersistor } from "../persist-state-history"; @@ -220,10 +220,12 @@ export default function CalendarsMain() { + ); }} /> + ); } diff --git a/src/Contacts/Main.tsx b/src/Contacts/Main.tsx index d56825d..7b64aae 100644 --- a/src/Contacts/Main.tsx +++ b/src/Contacts/Main.tsx @@ -18,7 +18,7 @@ import SearchableAddressBook from "./SearchableAddressBook"; import Contact from "./Contact"; import LoadingIndicator from "../widgets/LoadingIndicator"; import ContactEdit from "./ContactEdit"; -import PageNotFound from "../PageNotFound"; +import PageNotFound, { PageNotFoundRoute } from "../PageNotFound"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemSave, itemDelete } from "../Pim/helpers"; @@ -183,10 +183,12 @@ export default function ContactsMain() { + ); }} /> + ); } diff --git a/src/PageNotFound.tsx b/src/PageNotFound.tsx index 2e684de..661c4fe 100644 --- a/src/PageNotFound.tsx +++ b/src/PageNotFound.tsx @@ -2,13 +2,26 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from "react"; +import { Route } from "react-router"; import Container from "./widgets/Container"; +export function PageNotFoundRoute(props: { container?: boolean }) { + return ( + + {props.container ? ( + + + + ) : ( + + )} + + ); +} + export default function PageNotFound() { return ( - -

404 Page Not Found

-
+

404 Page Not Found

); } diff --git a/src/SyncGate.tsx b/src/SyncGate.tsx index 6769d06..d3a82a3 100644 --- a/src/SyncGate.tsx +++ b/src/SyncGate.tsx @@ -27,6 +27,7 @@ import { StoreState } from "./store"; import { performSync } from "./store/actions"; import { useCredentials } from "./credentials"; import PimNavigationTabs from "./Pim/NavigationTabs"; +import { PageNotFoundRoute } from "./PageNotFound"; export default function SyncGate() { const etebase = useCredentials(); @@ -98,6 +99,7 @@ export default function SyncGate() { + )} /> + ); } diff --git a/src/Tasks/Main.tsx b/src/Tasks/Main.tsx index 7319baa..6276aec 100644 --- a/src/Tasks/Main.tsx +++ b/src/Tasks/Main.tsx @@ -18,7 +18,7 @@ import TaskList from "./TaskList"; import Task from "./Task"; import LoadingIndicator from "../widgets/LoadingIndicator"; import TaskEdit from "./TaskEdit"; -import PageNotFound from "../PageNotFound"; +import PageNotFound, { PageNotFoundRoute } from "../PageNotFound"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemSave, itemDelete } from "../Pim/helpers"; @@ -185,10 +185,12 @@ export default function TasksMain() { + ); }} /> + ); }