fix: fixed bug with course cells after 12 PM extending past midnight (#122)

* Temporarily uninstalling husky cause github desktop has issues with it

* Cleaned up some code. Removed unnecessary state value on injected popup

* Should've fixed popup alignment issue. Still need to integrate course schedule with calendar. Still debugging.

* Updated CalendarGridStories

* Fix: change to ExampleCourse from exampleCourse

* setCourse and calendar header need work

* Update as part of merge

* Fix: fixed build errors

* Fix: Added Todo

* Chore: Cleaned up useFlattenedCourseSchedule hook

* fix: List now keeps track of state when existing items are switched, while adding new items to the end

* Added back husky

* Update src/views/components/calendar/Calendar/Calendar.tsx

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>

* refactor: added type-safety, destructuring, etc. ready for re-review

* refactor: got rid of ts-ignore in openNewTabFromContentScript

* Update src/views/components/calendar/CalendarHeader/CalenderHeader.tsx

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>

* refactor: using path aliasing

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>

* refactor: using path aliasing

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>

* refactor: using satisfies instead of as

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>

* refactor: using satisfies instead of as

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>

* style: reformatted spacing

* style: eslint import order

* refactor: added new constructor for UserSchedule to avoid passing down null values to child props

* fix: fixed bug with course cell times starting and after 12 PM. commented in CourseMeeting class

* Update src/views/hooks/useFlattenedCourseSchedule.ts

* fix: fixed build errors by removing old apis

* refactor: added type-safety and destructuring

---------

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>
This commit is contained in:
Som Gupta
2024-03-03 15:30:18 -06:00
committed by doprz
parent 5abb2a4d4f
commit f22a3cd7c0
10 changed files with 11003 additions and 344 deletions

View File

@@ -15,8 +15,8 @@ const meta = {
tags: ['autodocs'],
},
argTypes: {
dummySchedules: { control: 'object' },
dummyActiveIndex: { control: 'number' },
// dummySchedules: { control: 'object' },
// dummyActiveIndex: { control: 'number' },
},
render: (args: any) => (
<div>
@@ -138,7 +138,7 @@ const schedules = [
export const Default: Story = {
args: {
dummySchedules: schedules,
dummyActiveIndex: 0,
// dummySchedules: schedules,
// dummyActiveIndex: 0,
},
};

View File

@@ -11,99 +11,99 @@ const exampleSchedule: UserSchedule = new UserSchedule({
});
// TODO (achadaga): import this after
// https://github.com/Longhorn-Developers/UT-Registration-Plus/pull/106 is merged
const bevoCourse: Course = new Course({
uniqueId: 47280,
number: '311C',
fullName: "BVO 311C BEVO'S SEMINAR LONGHORN CARE",
courseName: "BEVO'S SEMINAR LONGHORN CARE",
department: 'BVO',
creditHours: 3,
status: Status.OPEN,
instructors: [new Instructor({ fullName: 'BEVO', firstName: '', lastName: 'BEVO', middleInitial: '' })],
isReserved: false,
description: [
'Restricted to Students in the School of Longhorn Enthusiasts',
'Immerse yourself in the daily routine of a longhorn—sunrise pasture walks and the best shady spots for a midday siesta. Understand the behavioral science behind our mascots stoic demeanor during games.',
'BVO 311C and 312H may not both be counted.',
'Prerequisite: Grazing 311 or 311H.',
'May be counted toward the Independent Inquiry flag requirement. May be counted toward the Writing flag requirement',
'Offered on the letter-grade basis only.',
],
schedule: new CourseSchedule({
meetings: [
new CourseMeeting({
days: ['Tuesday', 'Thursday'],
startTime: 480,
endTime: 570,
location: { building: 'UTC', room: '123' },
}),
new CourseMeeting({
days: ['Thursday'],
startTime: 570,
endTime: 630,
location: { building: 'JES', room: '123' },
}),
],
}),
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/',
flags: ['Independent Inquiry', 'Writing'],
instructionMode: 'In Person',
semester: {
code: '12345',
year: 2024,
season: 'Spring',
},
});
// const bevoCourse: Course = new Course({
// uniqueId: 47280,
// number: '311C',
// fullName: "BVO 311C BEVO'S SEMINAR LONGHORN CARE",
// courseName: "BEVO'S SEMINAR LONGHORN CARE",
// department: 'BVO',
// creditHours: 3,
// status: Status.OPEN,
// instructors: [new Instructor({ fullName: 'BEVO', firstName: '', lastName: 'BEVO', middleInitial: '' })],
// isReserved: false,
// description: [
// 'Restricted to Students in the School of Longhorn Enthusiasts',
// 'Immerse yourself in the daily routine of a longhorn—sunrise pasture walks and the best shady spots for a midday siesta. Understand the behavioral science behind our mascots stoic demeanor during games.',
// 'BVO 311C and 312H may not both be counted.',
// 'Prerequisite: Grazing 311 or 311H.',
// 'May be counted toward the Independent Inquiry flag requirement. May be counted toward the Writing flag requirement',
// 'Offered on the letter-grade basis only.',
// ],
// schedule: new CourseSchedule({
// meetings: [
// new CourseMeeting({
// days: ['Tuesday', 'Thursday'],
// startTime: 480,
// endTime: 570,
// location: { building: 'UTC', room: '123' },
// }),
// new CourseMeeting({
// days: ['Thursday'],
// startTime: 570,
// endTime: 630,
// location: { building: 'JES', room: '123' },
// }),
// ],
// }),
// url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/',
// flags: ['Independent Inquiry', 'Writing'],
// instructionMode: 'In Person',
// semester: {
// code: '12345',
// year: 2024,
// season: 'Spring',
// },
// });
const meta = {
title: 'Components/Injected/CourseCatalogInjectedPopup',
component: CourseCatalogInjectedPopup,
args: {
course: exampleCourse,
activeSchedule: exampleSchedule,
onClose: () => {},
},
argTypes: {
course: {
control: {
type: 'object',
},
},
activeSchedule: {
control: {
type: 'object',
},
},
onClose: {
control: {
type: 'function',
},
},
},
} satisfies Meta<typeof CourseCatalogInjectedPopup>;
// const meta = {
// title: 'Components/Injected/CourseCatalogInjectedPopup',
// component: CourseCatalogInjectedPopup,
// args: {
// course: exampleCourse,
// activeSchedule: exampleSchedule,
// onClose: () => {},
// },
// argTypes: {
// course: {
// control: {
// type: 'object',
// },
// },
// activeSchedule: {
// control: {
// type: 'object',
// },
// },
// onClose: {
// control: {
// type: 'function',
// },
// },
// },
// } satisfies Meta<typeof CourseCatalogInjectedPopup>;
export default meta;
type Story = StoryObj<typeof meta>;
// export default meta;
// type Story = StoryObj<typeof meta>;
export const OpenCourse: Story = {
args: {
course: exampleCourse,
activeSchedule: exampleSchedule,
onClose: () => {},
},
};
// export const OpenCourse: Story = {
// args: {
// course: exampleCourse,
// activeSchedule: exampleSchedule,
// onClose: () => {},
// },
// };
export const ClosedCourse: Story = {
args: {
course: {
...exampleCourse,
status: Status.CLOSED,
} satisfies Course,
},
};
// export const ClosedCourse: Story = {
// args: {
// course: {
// ...exampleCourse,
// status: Status.CLOSED,
// } satisfies Course,
// },
// };
export const CourseWithNoData: Story = {
args: {
course: bevoCourse,
},
};
// export const CourseWithNoData: Story = {
// args: {
// course: bevoCourse,
// },
// };