From 0efeb5b39c45e8660424b10ba4562d142173ecb0 Mon Sep 17 00:00:00 2001 From: Woobensky Pierre Date: Thu, 29 May 2025 08:32:14 -0400 Subject: [PATCH 1/4] s25 schedule panel was constantly spinning for non faculty staff - fixing that --- .../components/SchedulePanel/index.tsx | 29 ++++++++++++------- src/components/Profile/index.tsx | 1 + 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/Profile/components/SchedulePanel/index.tsx b/src/components/Profile/components/SchedulePanel/index.tsx index 135b8a6382..98ac0999a6 100644 --- a/src/components/Profile/components/SchedulePanel/index.tsx +++ b/src/components/Profile/components/SchedulePanel/index.tsx @@ -17,6 +17,7 @@ import styles from './ScheduleHeader.module.css'; import scheduleService, { CourseEvent, Schedule } from 'services/schedule'; import sessionService from 'services/session'; import { Profile } from 'services/user'; +import { AuthError } from '@azure/msal-browser'; type Props = { profile: Profile; @@ -38,17 +39,25 @@ const GordonSchedulePanel = ({ profile, myProf }: Props) => { Promise.all([ scheduleService.getAllSessionSchedules(profile.AD_Username), sessionService.getCurrent(), - ]).then(([allSessionSchedules, currentSession]) => { - setAllSchedules(allSessionSchedules); - const defaultSchedule = - // If there is a schedule for the current session, make it d4fault - allSessionSchedules.find((s) => s.session.SessionCode === currentSession.SessionCode) ?? - // Otherwise, use the most recent session - allSessionSchedules[0]; - setSelectedSchedule(defaultSchedule); - setLoading(false); - }); + ]) + .then(([allSessionSchedules, currentSession]) => { + setAllSchedules(allSessionSchedules); + const defaultSchedule = + // If there is a schedule for the current session, make it d4fault + allSessionSchedules.find((s) => s.session.SessionCode === currentSession.SessionCode) ?? + // Otherwise, use the most recent session + allSessionSchedules[0]; + setSelectedSchedule(defaultSchedule); + setLoading(false); + console.log(profile); + }) + .catch((reason: AuthError) => { + console.log('this is the type'); + console.log(profile.Type); + setLoading(false); + }); }, [profile.AD_Username]); + const toggleIsScheduleOpen = () => { setIsScheduleOpen((wasOpen) => { localStorage.setItem(scheduleOpenKey, String(!wasOpen)); diff --git a/src/components/Profile/index.tsx b/src/components/Profile/index.tsx index f1fd9209a2..a998fbfdb1 100644 --- a/src/components/Profile/index.tsx +++ b/src/components/Profile/index.tsx @@ -27,6 +27,7 @@ const Profile = ({ profile, myProf }: Props) => { const viewerIsPolice = useAuthGroups(AuthGroup.Police); const [canReadStudentSchedules, setCanReadStudentSchedules] = useState(); const profileIsStudent = profile.PersonType?.includes('stu'); + const profileIsStaff = profile.Type == 'Staff'; const createSnackbar = useCallback((message: string, severity: AlertColor) => { setSnackbar({ message, severity, open: true }); From a710fc6677901242ce0e14d849821d5d7e1cf521 Mon Sep 17 00:00:00 2001 From: Woobensky Pierre Date: Thu, 29 May 2025 09:06:33 -0400 Subject: [PATCH 2/4] comments --- src/components/Profile/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Profile/index.tsx b/src/components/Profile/index.tsx index a998fbfdb1..24de0f6312 100644 --- a/src/components/Profile/index.tsx +++ b/src/components/Profile/index.tsx @@ -27,7 +27,7 @@ const Profile = ({ profile, myProf }: Props) => { const viewerIsPolice = useAuthGroups(AuthGroup.Police); const [canReadStudentSchedules, setCanReadStudentSchedules] = useState(); const profileIsStudent = profile.PersonType?.includes('stu'); - const profileIsStaff = profile.Type == 'Staff'; + const profileIsStaff = profile.Type == 'Staff'; // should we create an dict enum of the possible values? const createSnackbar = useCallback((message: string, severity: AlertColor) => { setSnackbar({ message, severity, open: true }); @@ -69,7 +69,7 @@ const Profile = ({ profile, myProf }: Props) => { )} - {(myProf || !profileIsStudent || canReadStudentSchedules) && ( + {(myProf || (!profileIsStudent && !profileIsStaff) || canReadStudentSchedules) && ( // is it only faculty that have schedule? could we say if faculty instead here? From e14dacbd0cda20ea4fad8bc3a194ab5f8ceb16ab Mon Sep 17 00:00:00 2001 From: Woobensky Pierre Date: Mon, 2 Jun 2025 10:48:08 -0400 Subject: [PATCH 3/4] preparing for quad design update --- .env.development | 4 ++-- package-lock.json | 13 +++++++------ package.json | 2 +- .../components/ScheduleCalendar/index.tsx | 11 +++++++++++ .../Profile/components/SchedulePanel/index.tsx | 5 +---- src/components/Profile/index.tsx | 5 +++-- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.env.development b/.env.development index 0f66bff550..38904617a3 100644 --- a/.env.development +++ b/.env.development @@ -4,8 +4,8 @@ # VITE_API_URL=https://360Api.gordon.edu/ # @TRAIN - VITE_API_URL=https://360ApiTrain.gordon.edu/ +# VITE_API_URL=https://360ApiTrain.gordon.edu/ # @LOCALHOST -# VITE_API_URL=http://localhost:51660/ + VITE_API_URL=http://localhost:51634/ diff --git a/package-lock.json b/package-lock.json index ae0094ab25..05bc1a07cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "lodash": "^4.17.21", "prop-types": ">=15.7.2", "react": "^18.3.1", - "react-big-calendar": "^1.10.3", + "react-big-calendar": "^1.19.2", "react-chartjs-2": "^5.2.0", "react-cropper": "^2.3.3", "react-csv": "^2.0.3", @@ -8555,9 +8555,10 @@ } }, "node_modules/react-big-calendar": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/react-big-calendar/-/react-big-calendar-1.10.3.tgz", - "integrity": "sha512-LmIWlFfGUn8yt4RxcVkGNmjM3GcWynr1bfDwKrrz4KKj517+DH3OGmQzErURN6Zb0OB88HF4oH2dvDHpBQJgIw==", + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/react-big-calendar/-/react-big-calendar-1.19.2.tgz", + "integrity": "sha512-2orH+TOXPJBlQGwSl9ZnTK2WZR9OfVf0r1s8mnbpjvtENZfmWHP6nXqxmten1vkvzOMqefVGjh5GurM27HHOZw==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.20.7", "clsx": "^1.2.1", @@ -8577,8 +8578,8 @@ "uncontrollable": "^7.2.1" }, "peerDependencies": { - "react": "^16.14.0 || ^17 || ^18", - "react-dom": "^16.14.0 || ^17 || ^18" + "react": "^16.14.0 || ^17 || ^18 || ^19", + "react-dom": "^16.14.0 || ^17 || ^18 || ^19" } }, "node_modules/react-chartjs-2": { diff --git a/package.json b/package.json index 3dacd5ef46..1828b3b907 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "lodash": "^4.17.21", "prop-types": ">=15.7.2", "react": "^18.3.1", - "react-big-calendar": "^1.10.3", + "react-big-calendar": "^1.19.2", "react-chartjs-2": "^5.2.0", "react-cropper": "^2.3.3", "react-csv": "^2.0.3", diff --git a/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/index.tsx b/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/index.tsx index 4c46823bf1..9d74940131 100644 --- a/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/index.tsx +++ b/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/index.tsx @@ -1,4 +1,5 @@ import { Calendar, dateFnsLocalizer } from 'react-big-calendar'; +import EventCell from 'react-big-calendar'; import { CourseEvent, Schedule, scheduleCalendarResources } from 'services/schedule'; import './ScheduleCalendar.css'; import { format, getDay, startOfWeek } from 'date-fns'; @@ -20,6 +21,15 @@ type Props = { onSelectEvent: (event: CourseEvent) => void; }; +const EventComponent = () => { + return ( +
+ test + test +
+ ); +}; + const GordonScheduleCalendar = ({ schedule, onSelectEvent }: Props) => { const dayStart = new Date(); dayStart.setHours(8, 0, 0, 0); @@ -40,6 +50,7 @@ const GordonScheduleCalendar = ({ schedule, onSelectEvent }: Props) => { return ( { allSessionSchedules[0]; setSelectedSchedule(defaultSchedule); setLoading(false); - console.log(profile); }) .catch((reason: AuthError) => { - console.log('this is the type'); - console.log(profile.Type); setLoading(false); }); }, [profile.AD_Username]); diff --git a/src/components/Profile/index.tsx b/src/components/Profile/index.tsx index 24de0f6312..bebd14aec3 100644 --- a/src/components/Profile/index.tsx +++ b/src/components/Profile/index.tsx @@ -69,11 +69,12 @@ const Profile = ({ profile, myProf }: Props) => { )} - {(myProf || (!profileIsStudent && !profileIsStaff) || canReadStudentSchedules) && ( // is it only faculty that have schedule? could we say if faculty instead here? + { + // is it only faculty that have schedule? could we say if faculty instead here? - )} + } From 006273d42881f5227aa3b85e2af5d513be2f57d1 Mon Sep 17 00:00:00 2001 From: Woobensky Pierre Date: Mon, 2 Jun 2025 16:24:58 -0400 Subject: [PATCH 4/4] implement visual changes for quad classes --- .../SchedulePanel/ScheduleHeader.module.scss | 5 +++ .../ScheduleCalendar/ScheduleCalendar.scss | 15 +++++++++ .../components/ScheduleCalendar/index.tsx | 31 +++++++++++++------ src/services/schedule.ts | 3 ++ 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/components/Profile/components/SchedulePanel/ScheduleHeader.module.scss b/src/components/Profile/components/SchedulePanel/ScheduleHeader.module.scss index d8dbf449ca..fe8f07e18e 100644 --- a/src/components/Profile/components/SchedulePanel/ScheduleHeader.module.scss +++ b/src/components/Profile/components/SchedulePanel/ScheduleHeader.module.scss @@ -30,3 +30,8 @@ border-top-right-radius: 4px; } } + +.quad-course { + max-width: 50%; + background-color: red; +} diff --git a/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/ScheduleCalendar.scss b/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/ScheduleCalendar.scss index ec529f2f89..edadeacdfd 100644 --- a/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/ScheduleCalendar.scss +++ b/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/ScheduleCalendar.scss @@ -293,3 +293,18 @@ button.rbc-input::-moz-focus-inner { border-bottom: 1px solid var(--mui-palette-neutral-dark); flex-shrink: 0; } + +.subterm { + max-width: 55% !important; + padding-left: 2px; + filter: brightness(145%); + left: auto !important; +} + +.subterm1 { + left: 0%; +} + +.subterm2 { + right: 0%; +} diff --git a/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/index.tsx b/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/index.tsx index 9d74940131..db1bb34e1f 100644 --- a/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/index.tsx +++ b/src/components/Profile/components/SchedulePanel/components/ScheduleCalendar/index.tsx @@ -1,9 +1,9 @@ import { Calendar, dateFnsLocalizer } from 'react-big-calendar'; -import EventCell from 'react-big-calendar'; import { CourseEvent, Schedule, scheduleCalendarResources } from 'services/schedule'; import './ScheduleCalendar.css'; import { format, getDay, startOfWeek } from 'date-fns'; import { enUS } from 'date-fns/locale'; +import EventWrapper from 'react-big-calendar/lib/addons/dragAndDrop'; const locales = { 'en-US': enUS, @@ -21,13 +21,8 @@ type Props = { onSelectEvent: (event: CourseEvent) => void; }; -const EventComponent = () => { - return ( -
- test - test -
- ); +const EventWrapperCustom = ({ label }: { label: CourseEvent }) => { + return test {label.title}; }; const GordonScheduleCalendar = ({ schedule, onSelectEvent }: Props) => { @@ -45,13 +40,31 @@ const GordonScheduleCalendar = ({ schedule, onSelectEvent }: Props) => { : course.location.includes('null') ? (title = tempTitle) : (title = tempTitle + `\n${course.location}`); + return { ...course, title }; }); + console.log(courseFormat); + return ( { + const firstQuadOfSemester = ['Fall 1', 'Spring 1', 'Summer 1']; + const secondQuadOfSemester = ['Fall 2', 'Spring 2', 'Summer 2']; + let subtermClassNames = ['subterm']; + console.log(event.subtermCode); + console.log(secondQuadOfSemester.includes(event.subtermCode)); + if (firstQuadOfSemester.includes(event.subtermCode)) { + subtermClassNames.push('subterm1'); + } else if (secondQuadOfSemester.includes(event.subtermCode)) { + subtermClassNames.push('subterm2'); + } else { + return {}; + } + return { className: subtermClassNames.join(' ') }; + }} events={courseFormat} localizer={localizer} min={dayStart} diff --git a/src/services/schedule.ts b/src/services/schedule.ts index c9b7b43807..6ba022e1fd 100644 --- a/src/services/schedule.ts +++ b/src/services/schedule.ts @@ -19,6 +19,7 @@ type DbCourse = { BEGIN_TIME?: string; /** A timespan of the format HH:mm:ss, stringified */ END_TIME?: string; + SUB_TERM_CDE?: string; Role: string; }; @@ -62,6 +63,7 @@ export type CourseEvent = { name: string; title: string; location: string; + subtermCode: string; start: Date; end: Date; allDay?: boolean; @@ -89,6 +91,7 @@ function formatCoursesFromDb(courses: DbCourse[]): CourseEvent[] { name: course.CRS_TITLE.trim(), title: course.CRS_CDE.trim(), location: course.BLDG_CDE + '\u00A0' + course.ROOM_CDE, + subtermCode: course.SUB_TERM_CDE, }; if (course.ROOM_CDE === 'ASY') {