Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
letsgoo
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerwoud committed Apr 4, 2024
1 parent 07dee91 commit 7533fa7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
5 changes: 1 addition & 4 deletions frontend/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ import {
List,
Drawer,
Grid,
List,
ListItemButton,
ListItemText
} from "@mui/material";

import { Menu } from "@mui/icons-material";
import MenuIcon from "@mui/icons-material/Menu";
import { useTranslation } from 'react-i18next';
import { Link, useLocation } from 'react-router-dom';
import { useEffect, useState } from "react";
import LanguageIcon from "@mui/icons-material/Language";
import { Link, useLocation } from "react-router-dom";
Expand Down
20 changes: 11 additions & 9 deletions frontend/src/components/ProjectForm/ProjectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TextField,
FormControl
} from "@mui/material";
import {ChangeEvent, MouseEvent, useEffect, useState} from "react";
import React, {ChangeEvent, MouseEvent, SyntheticEvent, useEffect, useState} from "react";

Check failure on line 12 in frontend/src/components/ProjectForm/ProjectForm.tsx

View workflow job for this annotation

GitHub Actions / Frontend-tests

'MouseEvent' is defined but never used

Check failure on line 12 in frontend/src/components/ProjectForm/ProjectForm.tsx

View workflow job for this annotation

GitHub Actions / Frontend-tests

'SyntheticEvent' is defined but never used
import {DatePicker} from '@mui/x-date-pickers/DatePicker';
import {LocalizationProvider} from "@mui/x-date-pickers";
import {AdapterDayjs} from "@mui/x-date-pickers/AdapterDayjs";
Expand Down Expand Up @@ -47,7 +47,7 @@ export default function ProjectForm() {

// const [assignmentFile, setAssignmentFile] = useState('');

const [deadline, setDeadline] = useState(new Date());
const [deadline, setDeadline] = useState<Date>(new Date());

const [visibleForStudents, setVisibleForStudents] = useState(false);

Expand Down Expand Up @@ -106,7 +106,7 @@ export default function ProjectForm() {
setRegexExpressions(newRegexExpressions);
};

const handleSubmit = async (event: MouseEvent<HTMLButtonElement, MouseEvent>) => {
const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement, globalThis.MouseEvent>) => {
event.preventDefault();

description == '' ? setDescriptionError(true) : setDescriptionError(false);
Expand Down Expand Up @@ -211,15 +211,17 @@ export default function ProjectForm() {
<DatePicker
label="Project deadline"
disablePast
onChange={(date) => {
setDeadline(date);
onChange={(date: Date | null) => {
if (date) {
setDeadline(date);
}
}}
slotProps={{ textField: { helperText: 'Please fill in a valid deadline for the project' } }}
/>
</LocalizationProvider>
</Grid>
<Grid item>
<FormControlLabel required control={<Checkbox />} label={t("visibleForStudents")} onChange={e => setVisibleForStudents(e.target.checked)}/>
<FormControlLabel control={<Checkbox defaultChecked />} label="Visible for students" onChange={e=>setVisibleForStudents((e.target as HTMLInputElement).checked)}/>
</Grid>
<Grid item>
<Button
Expand Down Expand Up @@ -254,7 +256,6 @@ export default function ProjectForm() {
placeholder="Regex structure"
error={titleError}
onChange={event => setRegex(event.target.value)}
onSubmit={event => appendRegex(event)}
/>
</Grid>
<Grid item>
Expand All @@ -270,8 +271,9 @@ export default function ProjectForm() {
</div>
</Grid>
<Grid item>
<Button variant="contained" onClick={e =>
handleSubmit(e)
<Button variant="contained" onClick={e => {
return handleSubmit(e);
}
}>Upload project</Button>
</Grid>
</Grid>
Expand Down

0 comments on commit 7533fa7

Please sign in to comment.