-
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 branch 'frontend' into mainpage
- Loading branch information
Showing
22 changed files
with
855 additions
and
154 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
62 changes: 62 additions & 0 deletions
62
frontend/frontend/src/components/AssignmentListItemSubjectsPage.tsx
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import {ListItem, ListItemButton, ListItemText, Divider} from "@mui/material"; | ||
import {useNavigate} from "react-router-dom"; | ||
import {t} from "i18next"; | ||
interface AssignmentListItemSubjectsPageProps { | ||
key: string; | ||
projectName: string; | ||
dueDate?: Date; | ||
submissions: number; | ||
score: number; | ||
isStudent: boolean; | ||
} | ||
|
||
/* | ||
* This component is used to display a single assignment in the list of assignments | ||
* @param key: string - the key of the assignment | ||
* @param projectName: string - the name of the project | ||
* @param dueDate: Date - the due date of the project | ||
* @param submissions: number - number of submissions for the project | ||
* @param score: number - assigned score on the project | ||
* @param isStudent: boolean - if the user is a student or a teacher | ||
*/ | ||
|
||
export function AssignmentListItemSubjectsPage({key,projectName, dueDate, submissions, score, isStudent}:AssignmentListItemSubjectsPageProps) { | ||
const navigate = useNavigate(); | ||
const handleProjectClick = () => { | ||
console.log("Project clicked"); | ||
navigate(`/${key}`) | ||
} | ||
|
||
return ( | ||
<> | ||
<ListItem key={projectName} sx={{margin:0}} disablePadding={true}> | ||
<ListItemButton onClick={handleProjectClick} sx={{ | ||
width: "100%", | ||
height: 30, | ||
display: "flex", | ||
flexDirection: "row", | ||
justifyContent: "space-between", | ||
paddingX: 1, | ||
paddingY: 3, | ||
borderRadius:2, | ||
}}> | ||
{isStudent? | ||
<> | ||
<ListItemText sx={{maxWidth:100}} primary={projectName}/> | ||
<ListItemText sx={{maxWidth:110}} primary={dueDate? dueDate.toLocaleDateString() : t("no_deadline")}/> | ||
<ListItemText sx={{maxWidth:100}} primary={submissions + " indieningen"}/> | ||
<ListItemText sx={{maxWidth:50}} primary={score + "/20"}/> | ||
</> | ||
: | ||
<> | ||
<ListItemText sx={{maxWidth:100}} primary={projectName}/> | ||
<ListItemText sx={{maxWidth:110}} primary={dueDate? dueDate.toLocaleDateString() : t("no_deadline")}/> | ||
<ListItemText sx={{maxWidth:40}} primary={"edit"}/> | ||
</> | ||
} | ||
</ListItemButton> | ||
</ListItem> | ||
<Divider color={"text.main"}></Divider> | ||
</> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import {ListItem, ListItemText, Divider, TextField, IconButton} from "@mui/material"; | ||
import DownloadIcon from '@mui/icons-material/Download'; | ||
import {t} from "i18next"; | ||
|
||
interface StudentScoreListItemProps { | ||
key: string; | ||
studentName: string; | ||
submissionFiles: string[]; | ||
} | ||
|
||
/* | ||
* This component is used to display a single assignment in the list of assignments | ||
* @param key: string - the key of the studentOnProject | ||
* @param studentName: string - the name of the student | ||
* @param submissionFiles: string[] - a list of all files submitted by this student | ||
*/ | ||
|
||
export function StudentScoreListItem({key, studentName, submissionFiles}:StudentScoreListItemProps) { | ||
return ( | ||
<> | ||
<ListItem key={studentName} sx={{margin:0}} disablePadding={true}> | ||
<ListItem sx={{ | ||
width: "100%", | ||
height: 30, | ||
display: "flex", | ||
flexDirection: "row", | ||
justifyContent: "space-between", | ||
paddingX: 1, | ||
paddingY: 3, | ||
borderRadius:2, | ||
}}> | ||
<> | ||
<ListItemText sx={{maxWidth:100}} primary={studentName}/> | ||
<ListItemText sx={{maxWidth:110}} primary={submissionFiles.length? submissionFiles.length + " indieningen" : "geen indieningen"}/> | ||
<ListItem sx={{maxWidth:100}}> | ||
<TextField hiddenLabel defaultValue="0" variant="filled" size="small" /> | ||
<ListItemText sx={{maxWidth:100}} primary="/20"/> | ||
</ListItem> | ||
<ListItem sx={{maxWidth:100}}> | ||
<IconButton edge="end" aria-label="download"> | ||
<DownloadIcon /> | ||
</IconButton> | ||
</ListItem> | ||
</> | ||
</ListItem> | ||
</ListItem> | ||
<Divider color={"text.main"}></Divider> | ||
</> | ||
); | ||
} |
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> | ||
</> | ||
); | ||
} |
7 changes: 7 additions & 0 deletions
7
frontend/frontend/src/pages/SubjectsPage/ArchivedProjectsView.tsx
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function ArchivedProjectsView() { | ||
return ( | ||
<> | ||
|
||
</> | ||
); | ||
} |
Oops, something went wrong.