Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Improve error page

Dave Earleyfd5592b5c633
diff --git a/frontend/src/components/common/ErrorDisplay/ErrorDisplay.module.scss b/frontend/src/components/common/ErrorDisplay/ErrorDisplay.module.scss
index 156c8f4b8..164f28fa2 100644
--- a/frontend/src/components/common/ErrorDisplay/ErrorDisplay.module.scss
+++ b/frontend/src/components/common/ErrorDisplay/ErrorDisplay.module.scss
@@ -5,6 +5,17 @@
flex-direction: column;
}
+.logo {
+ display: flex;
+ justify-content: center;
+ margin-bottom: var(--mantine-spacing-xl);
+
+ img {
+ width: 100px;
+ height: 100px;
+ }
+}
+
.label {
text-align: center;
font-weight: 900;
@@ -27,4 +38,15 @@
text-align: center;
font-weight: 900;
font-size:38px;
+}
+
+.actions {
+ display: flex;
+ justify-content: center;
+ margin-top: var(--mantine-spacing-xl);
+
+ .link {
+ font-weight: 900;
+ margin: 0 var(--mantine-spacing-xs);
+ }
}
\ No newline at end of file
diff --git a/frontend/src/components/common/ErrorDisplay/index.tsx b/frontend/src/components/common/ErrorDisplay/index.tsx
index ad0c26542..08c9b5a68 100644
--- a/frontend/src/components/common/ErrorDisplay/index.tsx
+++ b/frontend/src/components/common/ErrorDisplay/index.tsx
@@ -1,17 +1,31 @@
import {Container} from '@mantine/core';
import classes from './ErrorDisplay.module.scss';
import {useRouteError} from "react-router-dom";
+import {t} from "@lingui/macro";
export const ErrorDisplay = () => {
- const error = useRouteError();
+ const error = useRouteError() as any
- console.error(error);
+ const title = error?.status === 404
+ ? t`Page not found`
+ : t`Something went wrong`;
+
+ const description = error?.status === 404
+ ? t`The page you are looking for does not exist`
+ : t`An error occurred while loading the page`;
return (
<Container className={classes.root}>
- <h2 className={classes.title}>Something went wrong</h2>
+ <div className={classes.logo}>
+ <img src="/logo-dark.svg" alt="Error"/>
+ </div>
+ <h2 className={classes.title}>{title}</h2>
<div className={classes.description}>
- Please refresh the page or try again later
+ {description}
+ </div>
+
+ <div className={classes.actions}>
+ Go back to the <a href="/" className={classes.link}>home page</a>
</div>
</Container>
);
diff --git a/frontend/src/router.tsx b/frontend/src/router.tsx
index 701de39b3..bc8bd6320 100644
--- a/frontend/src/router.tsx
+++ b/frontend/src/router.tsx
@@ -24,6 +24,7 @@ export const router: RouteObject[] = [
{
path: "",
element: <Root/>,
+ errorElement: <ErrorPage/>
},
{
path: "auth",