Skip to content

Commit

Permalink
Merge pull request #51 from SELab-2/indiening_student
Browse files Browse the repository at this point in the history
Indiening student
  • Loading branch information
mathis2003 authored Mar 13, 2024
2 parents 5e8a6bf + 45cb67d commit 86cb45e
Show file tree
Hide file tree
Showing 13 changed files with 444 additions and 120 deletions.
File renamed without changes
31 changes: 22 additions & 9 deletions frontend/frontend/src/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,43 @@ import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";

const english = {
logo: "./src/assets/logo_UGent_EN_RGB_2400_white.png",
logo_blue: "./src/assets/logo_UGent_EN_RGB_2400_color.png",
logo: "/assets/logo_UGent_EN_RGB_2400_white.png",
logo_blue: "/assets/logo_UGent_EN_RGB_2400_color.png",
login: "Log in with your UGent account",
back : "Back",
back: "Back",
current_courses: "Current courses",
archived: "Archived",
students: "Students: ",
no_deadline: "No deadline",
submission: "Submission",
error: "Something went wrong.",
assignment: "Assignment:",
filename: "Submitted file:",
restrictions: "Restrictions:",
current_projects: "Current projects",
};
const dutch = {
logo: "./src/assets/logo_UGent_NL_RGB_2400_wit.png",
logo_blue: "./src/assets/logo_UGent_NL_RGB_2400_kleur.png",
logo: "/assets/logo_UGent_NL_RGB_2400_wit.png",
logo_blue: "/assets/logo_UGent_NL_RGB_2400_kleur.png",
login: "Log in met je UGent account",
back : "Terug",
back: "Terug",
current_courses: "Huidige vakken",
archived: "Gearchiveerd",
students: "Studenten: ",
no_deadline: "Geen deadline",

submission: "Indiening",
error: "Er is iets misgegaan.",
assignment: "Opgave:",
filename: "Ingediend bestand:",
restrictions: "Restricties:",
current_projects: "Huidige projecten",
};

i18n.use(initReactI18next).use(LanguageDetector).init({ fallbackLng: "en",
debug:true, interpolation: {escapeValue: false},
resources: {en: {translation: english}, nl: {translation: dutch}}});
i18n.use(initReactI18next).use(LanguageDetector).init({
fallbackLng: "en",
debug: true, interpolation: {escapeValue: false},
resources: {en: {translation: english}, nl: {translation: dutch}}
});

export default i18n;
7 changes: 7 additions & 0 deletions frontend/frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import { AssignmentStudentPage } from "./pages/assignmentPage/assignmentStudentP
import { AssignmentTeacherPage } from "./pages/assignmentPage/assignmentTeacherPage.tsx";
import { GroupsPage } from "./pages/groupsPage/groupsPage.tsx";
import {SubjectsStudentPage} from "./pages/subjects_page/SubjectsStudentPage.tsx";
import {SubmissionPage} from "./pages/submissionPage/SubmissionPage.tsx";
import {SimpleRequestsPage} from "./pages/simpleRequestsPage/SimpleRequestsPage.tsx";


const router = createBrowserRouter([
{
path: "/",
Expand Down Expand Up @@ -55,6 +57,11 @@ const router = createBrowserRouter([
element: <SubjectsStudentPage/>,
},
{

path: "/submission/:project",
element: <SubmissionPage/>,
},
{
path: "/test_requests",
element: <SimpleRequestsPage/>,
}
Expand Down
122 changes: 113 additions & 9 deletions frontend/frontend/src/pages/ErrorPage.tsx
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>
</>
);
}
Loading

0 comments on commit 86cb45e

Please sign in to comment.