From 6bfa8a10c3868caeaa2f09a9c1797a05c65465a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cxavilien=E2=80=9D?= <“xavilien@gmail.com”>
Date: Thu, 28 Mar 2024 01:03:45 -0400
Subject: [PATCH 1/5] Add units to summary
---
frontend/src/components/ScheduleData.tsx | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/frontend/src/components/ScheduleData.tsx b/frontend/src/components/ScheduleData.tsx
index 9a1ae13..ede9a2b 100644
--- a/frontend/src/components/ScheduleData.tsx
+++ b/frontend/src/components/ScheduleData.tsx
@@ -72,6 +72,10 @@ const ScheduleData = ({ scheduled }: ScheduleDataProps) => {
{roundTo(aggregatedSelectedData.workload, 2)} hrs/week
{message === "" ? "" : "*"}
+
+ {scheduledResults.reduce((acc, curr) => acc + parseInt(curr.units), 0)} units
+ {message === "" ? "" : "*"}
+
From 9a3a1d080f17a4c243eb7334cce1dafcb5a9d4a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cxavilien=E2=80=9D?= <“xavilien@gmail.com”>
Date: Thu, 28 Mar 2024 01:14:56 -0400
Subject: [PATCH 2/5] Toggle schedules top bar
---
frontend/src/app/ui.ts | 5 +++
frontend/src/components/ScheduleData.tsx | 43 ++++++++++++++++--------
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/frontend/src/app/ui.ts b/frontend/src/app/ui.ts
index 254bde3..8432cc3 100644
--- a/frontend/src/app/ui.ts
+++ b/frontend/src/app/ui.ts
@@ -7,6 +7,7 @@ export interface UIState {
loginModalShown: boolean;
loginModalOpen: boolean;
};
+ schedulesTopbarOpen: boolean;
}
const initialState: UIState = {
@@ -16,6 +17,7 @@ const initialState: UIState = {
loginModalShown: false,
loginModalOpen: false,
},
+ schedulesTopbarOpen: false,
};
export const uiSlice = createSlice({
@@ -35,6 +37,9 @@ export const uiSlice = createSlice({
state.session.loginModalShown = true;
state.session.loginModalOpen = false;
},
+ toggleSchedulesTopbarOpen: (state) => {
+ state.schedulesTopbarOpen = !state.schedulesTopbarOpen;
+ },
},
});
diff --git a/frontend/src/components/ScheduleData.tsx b/frontend/src/components/ScheduleData.tsx
index ede9a2b..ae8e64c 100644
--- a/frontend/src/components/ScheduleData.tsx
+++ b/frontend/src/components/ScheduleData.tsx
@@ -7,6 +7,9 @@ import {
selectSelectedCoursesInActiveSchedule,
userSchedulesSlice,
} from "../app/userSchedules";
+import { FlushedButton } from "./Buttons";
+import { uiSlice } from "../app/ui";
+import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/20/solid";
type ScheduleDataProps = {
scheduled: string[];
@@ -62,6 +65,8 @@ const ScheduleData = ({ scheduled }: ScheduleDataProps) => {
);
};
+ const open = useAppSelector((state) => state.ui.schedulesTopbarOpen);
+
return (
<>
@@ -69,29 +74,39 @@ const ScheduleData = ({ scheduled }: ScheduleDataProps) => {
Total Workload{" "}
- {roundTo(aggregatedSelectedData.workload, 2)} hrs/week
+ {scheduledResults.reduce((acc, curr) => acc + parseInt(curr.units), 0)} units,
{message === "" ? "" : "*"}
- {scheduledResults.reduce((acc, curr) => acc + parseInt(curr.units), 0)} units
+ {roundTo(aggregatedSelectedData.workload, 2)} hrs/week
{message === "" ? "" : "*"}
+
-
+ {(open &&
-
- |
-
- Course ID
- |
-
- Course Name
- |
- Units |
- Workload |
+
+ |
+
+ Course ID
+ |
+
+ Course Name
+ |
+ Units |
+ Workload |
@@ -122,7 +137,7 @@ const ScheduleData = ({ scheduled }: ScheduleDataProps) => {
})}
-
+
)}
{message === "" ? "" : `*${message}`}
From 67682f3ac22fa77edd63de3c054ff188f38b3727 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cxavilien=E2=80=9D?= <“xavilien@gmail.com”>
Date: Mon, 1 Apr 2024 14:02:32 -0400
Subject: [PATCH 3/5] Added showSchedules so that one can easily see who is
teaching it next semester
---
frontend/src/components/CourseList.tsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/frontend/src/components/CourseList.tsx b/frontend/src/components/CourseList.tsx
index 81f689c..f14bddd 100644
--- a/frontend/src/components/CourseList.tsx
+++ b/frontend/src/components/CourseList.tsx
@@ -37,6 +37,7 @@ const CourseList = ({ courseIDs, children }: Props) => {
key={course.courseID}
showFCEs={true}
showCourseInfo={true}
+ showSchedules={true}
/>
))}
From 1a4517fb57a052c1631484ab6b3ed101dbd63869 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cxavilien=E2=80=9D?= <“xavilien@gmail.com”>
Date: Mon, 1 Apr 2024 14:17:38 -0400
Subject: [PATCH 4/5] parseFloat instead of parseInt because some courses have
half units
---
frontend/src/components/ScheduleData.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/components/ScheduleData.tsx b/frontend/src/components/ScheduleData.tsx
index ae8e64c..6197692 100644
--- a/frontend/src/components/ScheduleData.tsx
+++ b/frontend/src/components/ScheduleData.tsx
@@ -74,7 +74,7 @@ const ScheduleData = ({ scheduled }: ScheduleDataProps) => {
Total Workload{" "}
- {scheduledResults.reduce((acc, curr) => acc + parseInt(curr.units), 0)} units,
+ {scheduledResults.reduce((acc, curr) => acc + parseFloat(curr.units), 0)} units,
{message === "" ? "" : "*"}
From 155faa6b1b1acf3877f5f2f27e06467cbf1a34c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cxavilien=E2=80=9D?= <“xavilien@gmail.com”>
Date: Mon, 1 Apr 2024 14:20:27 -0400
Subject: [PATCH 5/5] Apparently the order of lines matters to ESLint
---
frontend/src/components/ScheduleData.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frontend/src/components/ScheduleData.tsx b/frontend/src/components/ScheduleData.tsx
index 6197692..8434f80 100644
--- a/frontend/src/components/ScheduleData.tsx
+++ b/frontend/src/components/ScheduleData.tsx
@@ -28,6 +28,8 @@ const ScheduleData = ({ scheduled }: ScheduleDataProps) => {
selectFCEResultsForCourses(scheduled || [])
);
+ const open = useAppSelector((state) => state.ui.schedulesTopbarOpen);
+
if (!loggedIn) {
return (
@@ -65,8 +67,6 @@ const ScheduleData = ({ scheduled }: ScheduleDataProps) => {
);
};
- const open = useAppSelector((state) => state.ui.schedulesTopbarOpen);
-
return (
<>