Skip to content

Commit

Permalink
Prettified /upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MatricalDefunkt committed May 8, 2024
1 parent 0aadd24 commit 267ba9c
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 165 deletions.
20 changes: 12 additions & 8 deletions src/frontend/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import "@fontsource/roboto/700.css";
import "./App.css";
import TimetableNewPage from "./Pages/TimetableNewPage";
import TimetableCombined from "./Pages/TimetableCombined";
import BatchAndSubdiviionUpload from "./Components/CSV/BatchAndSubdivision";
import ClassroomUpload from "./Components/CSV/Classrooms";
import SubjectAndTeacherUpload from "./Components/CSV/SubjectAndTeacers";
import LandingPage from "./Pages/LandingPage";
import DataUpload from "./Pages/DataUpload";

export default function App() {
return (
Expand Down Expand Up @@ -50,14 +48,20 @@ export default function App() {
path="/upload"
element={
<>
<BatchAndSubdiviionUpload /> <br />
<ClassroomUpload />
<br />
<SubjectAndTeacherUpload /> <br />
<div
style={{
minHeight: "100vh",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<DataUpload />
</div>
</>
}
/>
</Routes>
</Router>
);
}
}
83 changes: 0 additions & 83 deletions src/frontend/Components/CSV/AddCSV.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const VisuallyHiddenInput = styled("input")({
width: 1,
});

export default function InputFileUpload() {
export default function BatchAndSubdivisionUpload() {
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const file = event.target.files?.[0] ?? null;
if (file === null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const VisuallyHiddenInput = styled("input")({
width: 1,
});

export default function InputFileUpload() {
export default function ClassroomUpload() {
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const file = event.target.files?.[0] ?? null;
if (file === null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const VisuallyHiddenInput = styled("input")({
width: 1,
});

export default function InputFileUpload() {
export default function SubjectAndTeacherUpload() {
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const file = event.target.files?.[0] ?? null;
if (file === null) return;
Expand All @@ -25,7 +25,7 @@ export default function InputFileUpload() {
fetch("http://localhost:3000/csv/subjectAndTeachers", {
method: "POST",
body: formData,
});
});
};
return (
<Button
Expand All @@ -34,7 +34,7 @@ export default function InputFileUpload() {
variant="contained"
tabIndex={-1}
startIcon={<CloudUploadIcon />}
sx={{margin: "0.5rem"}}
sx={{ margin: "0.5rem" }}
>
Subject And Teacher Upload
<VisuallyHiddenInput type="file" accept=".csv" onChange={handleFileChange} />
Expand Down
28 changes: 0 additions & 28 deletions src/frontend/Components/CSV/Upload.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions src/frontend/Components/CSV/UploadCSV.css

This file was deleted.

5 changes: 5 additions & 0 deletions src/frontend/Components/CSV/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import BatchAndSubdivisionUpload from "./BatchAndSubdivisionUpload";
import ClassroomUpload from "./ClassroomUpload";
import SubjectAndTeacherUpload from "./SubjectAndTeacherUpload";

export { BatchAndSubdivisionUpload, ClassroomUpload, SubjectAndTeacherUpload };
58 changes: 58 additions & 0 deletions src/frontend/Pages/DataUpload.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from "react";
import {
ButtonGroup,
Card,
CardActionArea,
CardContent,
CardHeader,
List,
ListItem,
Paper,
Typography,
} from "@mui/material";
import {
BatchAndSubdivisionUpload,
ClassroomUpload,
SubjectAndTeacherUpload,
} from "../Components/CSV";

export default function DataUpload() {
return (
<Card
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
maxWidth: "35rem",
}}
variant="outlined"
>
<CardHeader title={"DATA UPLOAD"} />
<CardContent>
<Typography>
Use this page to upload the required data for the timetable generation. The data
required is as follows:{" "}
<List>
<ListItem>1. Batch and Subdivision Data </ListItem>
<ListItem>2. Classroom Data</ListItem>
<ListItem>3. Subject and Teacher Data</ListItem>
</List>
</Typography>
</CardContent>
<Paper
sx={{
display: "flex",
flexDirection: "column",
maxWidth: "25rem",
margin: "1rem",
padding: "1rem",
}}
variant="outlined"
>
<BatchAndSubdivisionUpload />
<ClassroomUpload />
<SubjectAndTeacherUpload />
</Paper>
</Card>
);
}

0 comments on commit 267ba9c

Please sign in to comment.