aboutsummaryrefslogtreecommitdiffstats
path: root/thallium-frontend/src
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-08-17 02:05:58 +0100
committerGravatar Joe Banks <[email protected]>2024-08-17 02:05:58 +0100
commit586045d6ff5338abdb21a3f00005063a843f295a (patch)
treeb3bcb52a5a9d50f5d6c2df2e0b3aa572f5e46bcb /thallium-frontend/src
parentSplit Header to independent component (diff)
Add error page
Diffstat (limited to 'thallium-frontend/src')
-rw-r--r--thallium-frontend/src/pages/ErrorPage.tsx33
1 files changed, 33 insertions, 0 deletions
diff --git a/thallium-frontend/src/pages/ErrorPage.tsx b/thallium-frontend/src/pages/ErrorPage.tsx
new file mode 100644
index 0000000..a649e25
--- /dev/null
+++ b/thallium-frontend/src/pages/ErrorPage.tsx
@@ -0,0 +1,33 @@
+import { useRouteError } from 'react-router-dom';
+
+import Card from '../components/Card';
+
+const LandingPage = () => {
+ const error: any = useRouteError() || {};
+
+ let title, message, isUnexpected = false;
+
+ if (error.status === 404) {
+ title = 'Not Found';
+ message = 'The requested page could not be found.';
+ } else {
+ title = 'Error';
+ message = error.message || error.statusText;
+ isUnexpected = true;
+ }
+
+ return (
+ <>
+ <div>
+ <Card title={title}>
+ {isUnexpected && <strong>An error occurred:</strong>}
+ <p>
+ {message}
+ </p>
+ </Card>
+ </div>
+ </>
+ );
+};
+
+export default LandingPage;