-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from SELab-2/indiening_student
Indiening student
- Loading branch information
Showing
13 changed files
with
444 additions
and
120 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,122 @@ | ||
import { useRouteError } from "react-router-dom"; | ||
import {isRouteErrorResponse, useRouteError} from "react-router-dom"; | ||
import {Box, Typography} from "@mui/material"; | ||
import {t} from "i18next"; | ||
|
||
//TODO:: fix a decent error page | ||
export default function ErrorPage() { | ||
|
||
const error = useRouteError(); | ||
console.error(error); | ||
let errorMessage: string; | ||
|
||
if (isRouteErrorResponse(error)) { | ||
// error is type `ErrorResponse` | ||
errorMessage = error.error?.message || error.statusText; | ||
} else if (error instanceof Error) { | ||
errorMessage = error.message; | ||
} else if (typeof error === 'string') { | ||
errorMessage = error; | ||
} else { | ||
console.error(error); | ||
errorMessage = 'Unknown error'; | ||
} | ||
|
||
return ( | ||
<div id="error-page"> | ||
<h1>Oops!</h1> | ||
<p>Sorry, an unexpected error has occurred.</p> | ||
<p> | ||
error | ||
</p> | ||
</div> | ||
<> | ||
<Box | ||
position="fixed" | ||
top={0} | ||
left={0} | ||
height="100%" | ||
width="100%" | ||
component="div" | ||
sx={{ | ||
backgroundColor: "secondary.main", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
display: "flex", | ||
backgroundSize: "cover", | ||
}} | ||
> | ||
<Box | ||
className="background-image" | ||
component="div" | ||
height="100%" | ||
width="100%" | ||
top={0} | ||
left={0} | ||
sx={{ | ||
backgroundImage: `url(/assets/ufo-logo-3375276369.png)`, | ||
opacity: 0.2, | ||
position: "fixed", | ||
backgroundSize: "cover", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
flexDirection: "column", | ||
padding: 0, | ||
margin: 0, | ||
zIndex: -1, | ||
}} | ||
/> | ||
<Box | ||
component="div" | ||
className="contentContainer" | ||
display="flex" | ||
position={"relative"} | ||
flexDirection="column" | ||
alignItems="center" | ||
justifyContent={"center"} | ||
alignSelf={"center"} | ||
maxWidth="60%" | ||
maxHeight="60%" | ||
> | ||
<Box | ||
component="div" | ||
className="upperContainer" | ||
display="flex" | ||
flexDirection="row" | ||
alignItems="center" | ||
justifyContent={"center"} | ||
alignSelf={"center"} | ||
> | ||
<Box | ||
component="img" | ||
src={t("logo_blue")} | ||
alt="logo" | ||
sx={{ | ||
maxHeight: "20%", | ||
maxWidth: "30%", | ||
}} | ||
/> | ||
<Box | ||
component="div" | ||
display="flex" | ||
flexDirection="column" | ||
maxWidth={"40%"} | ||
maxHeight={"30%"} | ||
|
||
> | ||
<Typography | ||
variant="h4" | ||
sx={{ | ||
color: "error.main", | ||
maxWidth: "100%", | ||
maxHeight: "50%", | ||
}} | ||
> | ||
{t("error")} | ||
</Typography> | ||
<Typography variant={"h5"} sx={{ | ||
color: "error.main", | ||
maxWidth: "100%", | ||
maxHeight: "50%", | ||
}}> | ||
{errorMessage} | ||
</Typography> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</> | ||
); | ||
} |
Oops, something went wrong.