Skip to content

Commit 13f256c

Browse files
committed
run pre-commit
1 parent 80e9df9 commit 13f256c

File tree

5 files changed

+51
-48
lines changed

5 files changed

+51
-48
lines changed

src/pages/courses/index.tsx

+24-22
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import { backend_post, useAxiosRequest } from "../../utils";
77
import { Course, Empty } from "../../types/common";
88
import { IsAdmin } from "../../utils";
99
import { User } from "../../types/common";
10-
import { Button, Checkbox, IconButton, Typography, styled } from "@mui/material";
10+
import {
11+
Button,
12+
Checkbox,
13+
IconButton,
14+
Typography,
15+
styled
16+
} from "@mui/material";
1117
import MoreVertIcon from "@mui/icons-material/MoreVert";
1218
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
1319
import Avatar from "@mui/material/Avatar";
@@ -20,7 +26,7 @@ const Courses = () => {
2026
Empty,
2127
ResponseData
2228
>();
23-
const [ course_data, setCourseData ] = useState()
29+
const [course_data, setCourseData] = useState();
2430

2531
const alternatingColor = [
2632
"rgba(255, 255, 255, 0.5)",
@@ -115,9 +121,9 @@ const Courses = () => {
115121
<th className="type-column">Students</th>
116122
{IsAdmin() ? (
117123
<th className="actions-column">Actions</th>
118-
) :
124+
) : (
119125
<th className="actions-column">Enroll</th>
120-
}
126+
)}
121127
</tr>
122128
</thead>
123129
<tbody>
@@ -152,30 +158,26 @@ const Courses = () => {
152158
<MoreVertIcon />
153159
</IconButton>
154160
</td>
155-
) :
156-
<Checkbox
157-
checked={
158-
course.enrolled
159-
}
160-
onChange={handleEnrollment(
161-
course.id,
162-
!course.enrolled
163-
)}
164-
sx={{
165-
"& .MuiSvgIcon-root": {
166-
color: "white"
167-
}
168-
}}
169-
/>
170-
}
161+
) : (
162+
<Checkbox
163+
checked={course.enrolled}
164+
onChange={handleEnrollment(
165+
course.id,
166+
!course.enrolled
167+
)}
168+
sx={{
169+
"& .MuiSvgIcon-root": {
170+
color: "white"
171+
}
172+
}}
173+
/>
174+
)}
171175
</tr>
172176
))}
173177
</tbody>
174178
</StyledTable>
175179
</Container>
176180
</RootPage>
177-
178-
179181
);
180182
};
181183

src/pages/create_course/index.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Container from "@mui/material/Container";
66
import Avatar from "@mui/material/Avatar";
77
import Typography from "@mui/material/Typography";
88
import { Box, MenuItem, Select } from "@mui/material";
9-
import AppRegistrationIcon from '@mui/icons-material/AppRegistration';
9+
import AppRegistrationIcon from "@mui/icons-material/AppRegistration";
1010

1111
import RootPage from "../root";
1212
import "./create.css"; // Import CSS file for additional styling
@@ -22,7 +22,10 @@ const CreateCourse = () => {
2222
event: React.FormEvent<HTMLFormElement>
2323
) => {
2424
console.log(data);
25-
if (!("course_name" in data) || typeof data["course_name"] !== "string") {
25+
if (
26+
!("course_name" in data) ||
27+
typeof data["course_name"] !== "string"
28+
) {
2629
setRegStatus("failed");
2730
return;
2831
} else {
@@ -39,10 +42,10 @@ const CreateCourse = () => {
3942
backend_post(
4043
"course/create/",
4144
JSON.stringify({
42-
course_name: data.get("course_name"),
45+
course_name: data.get("course_name")
4346
})
4447
)
45-
.then((resp) => (resp.json()))
48+
.then((resp) => resp.json())
4649
.then((data) => handleResponse(data, event))
4750
.catch((error) => console.log(error));
4851
};

src/pages/create_lecture/index.tsx

+18-20
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import Container from "@mui/material/Container";
66
import Avatar from "@mui/material/Avatar";
77
import Typography from "@mui/material/Typography";
88
import { Box, MenuItem, Select } from "@mui/material";
9-
import AppRegistrationIcon from '@mui/icons-material/AppRegistration';
10-
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
11-
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
12-
import { DesktopDateTimePicker } from '@mui/x-date-pickers/DesktopDateTimePicker';
9+
import AppRegistrationIcon from "@mui/icons-material/AppRegistration";
10+
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
11+
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
12+
import { DesktopDateTimePicker } from "@mui/x-date-pickers/DesktopDateTimePicker";
1313

1414
import RootPage from "../root";
1515
import "./create.css"; // Import CSS file for additional styling
@@ -28,8 +28,7 @@ const CreateLecture = () => {
2828
console.log(data);
2929
if ("ok" in data) {
3030
setRegStatus("success");
31-
}
32-
else{
31+
} else {
3332
setRegStatus("failed");
3433
}
3534
};
@@ -39,24 +38,24 @@ const CreateLecture = () => {
3938
setRegStatus("submitting");
4039
event.preventDefault();
4140
const data = new FormData(event.currentTarget);
42-
const start_time = data.get("start_time")
43-
const end_time = data.get("end_time")
44-
45-
if (start_time == null || end_time == null) return
46-
if (start_time == "" || end_time == "") return
41+
const start_time = data.get("start_time");
42+
const end_time = data.get("end_time");
43+
44+
if (start_time == null || end_time == null) return;
45+
if (start_time == "" || end_time == "") return;
4746

48-
const start_date = new Date(Date.parse(start_time.toString()))
49-
const end_date = new Date(Date.parse(end_time.toString()))
47+
const start_date = new Date(Date.parse(start_time.toString()));
48+
const end_date = new Date(Date.parse(end_time.toString()));
5049

5150
backend_post(
5251
"course/lecture/" + id + "/add",
5352
JSON.stringify({
5453
start_time: start_date.toISOString(),
5554
end_time: end_date.toISOString(),
56-
lecture_type: data.get("lecture_type"),
55+
lecture_type: data.get("lecture_type")
5756
})
5857
)
59-
.then((resp) => (resp.json()))
58+
.then((resp) => resp.json())
6059
.then((data) => handleResponse(data, event))
6160
.catch((error) => console.log(error));
6261
};
@@ -86,15 +85,15 @@ const CreateLecture = () => {
8685
color={"primary"}
8786
>
8887
<LocalizationProvider dateAdapter={AdapterDayjs}>
89-
<DesktopDateTimePicker
88+
<DesktopDateTimePicker
9089
label="Start time"
9190
name="start_time"
92-
slotProps={{ textField: { required: true,},}}
91+
slotProps={{ textField: { required: true } }}
9392
/>
94-
<DesktopDateTimePicker
93+
<DesktopDateTimePicker
9594
label="End time"
9695
name="end_time"
97-
slotProps={{ textField: { required: true,},}}
96+
slotProps={{ textField: { required: true } }}
9897
/>
9998
</LocalizationProvider>
10099
<Select
@@ -114,7 +113,6 @@ const CreateLecture = () => {
114113
<MenuItem value="exam">Exam</MenuItem>
115114
</Select>
116115

117-
118116
{regStatus === "success" && (
119117
<Typography variant="body1" color="success">
120118
Creation successful!

src/pages/create_user/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const CreateUser = () => {
6060
role: data.get("role")
6161
})
6262
)
63-
.then((resp) => (resp.json()))
63+
.then((resp) => resp.json())
6464
.then((data) => handleTokenResponse(data, event))
6565
.catch((error) => console.log(error));
6666
};

src/pages/schedule/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const AttendancePage: React.FC = () => {
102102
}
103103
}}
104104
/>
105-
<Checkbox
105+
<Checkbox
106106
sx={{
107107
"& .MuiSvgIcon-root": {
108108
// Overrides the color of the checkbox icon

0 commit comments

Comments
 (0)