From 00dd63d9d51a63ff92ab27b2d25463202ed981fe Mon Sep 17 00:00:00 2001 From: DhruvArora-03 <93348668+DhruvArora-03@users.noreply.github.com> Date: Mon, 26 Feb 2024 20:08:30 -0600 Subject: [PATCH 1/4] fix: use StatusType --- .../calendar/CalendarCourseCell/CalendarCourseCell.tsx | 6 +++--- src/views/components/common/CourseStatus/CourseStatus.tsx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx b/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx index a3a3475d..f256d2f7 100644 --- a/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx +++ b/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx @@ -1,4 +1,4 @@ -import { Status } from '@shared/types/Course'; +import { Status, StatusType } from '@shared/types/Course'; import Text from '@views/components/common/Text/Text'; import clsx from 'clsx'; import React from 'react'; @@ -15,7 +15,7 @@ import CancelledIcon from '~icons/material-symbols/warning'; export interface CalendarCourseCellProps { courseDeptAndInstr: string; timeAndLocation?: string; - status: Status; + status: StatusType; colors: CourseColors; className?: string; } @@ -27,7 +27,7 @@ export interface CalendarCourseCellProps { * @param {CalendarCourseCellProps} props - The component props. * @param {string} props.courseDeptAndInstr - The course department and instructor. * @param {string} props.timeAndLocation - The time and location of the course. - * @param {Status} props.status - The status of the course. + * @param {StatusType} props.status - The status of the course. * @param {Colors} props.colors - The colors for styling the cell. * @param {string} props.className - Additional CSS class name for the cell. * @returns {JSX.Element} The rendered component. diff --git a/src/views/components/common/CourseStatus/CourseStatus.tsx b/src/views/components/common/CourseStatus/CourseStatus.tsx index dd7fdf76..3dcad8aa 100644 --- a/src/views/components/common/CourseStatus/CourseStatus.tsx +++ b/src/views/components/common/CourseStatus/CourseStatus.tsx @@ -1,4 +1,4 @@ -import type { Status } from '@shared/types/Course'; +import type { StatusType } from '@shared/types/Course'; import { StatusIcon } from '@shared/util/icons'; import clsx from 'clsx'; import React from 'react'; @@ -11,7 +11,7 @@ type SizeType = 'small' | 'mini'; * Props for CourseStatus */ export interface CourseStatusProps { - status: Status; + status: StatusType; size: SizeType; } From 86572eaf883e011defe8e89a625cfaf24d94fcf9 Mon Sep 17 00:00:00 2001 From: DhruvArora-03 <93348668+DhruvArora-03@users.noreply.github.com> Date: Mon, 26 Feb 2024 20:09:11 -0600 Subject: [PATCH 2/4] fix: use AutoLoadStatus --- src/views/components/injected/AutoLoad/AutoLoad.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/components/injected/AutoLoad/AutoLoad.tsx b/src/views/components/injected/AutoLoad/AutoLoad.tsx index 224ccba2..e0a237ee 100644 --- a/src/views/components/injected/AutoLoad/AutoLoad.tsx +++ b/src/views/components/injected/AutoLoad/AutoLoad.tsx @@ -4,6 +4,7 @@ import { CourseCatalogScraper } from '@views/lib/CourseCatalogScraper'; import { SiteSupport } from '@views/lib/getSiteSupport'; import { AutoLoadStatus, + AutoLoadStatusType, loadNextCourseCatalogPage, removePaginationButtons, } from '@views/lib/loadNextCourseCatalogPage'; @@ -22,7 +23,7 @@ type Props = { */ export default function AutoLoad({ addRows }: Props) { const [container, setContainer] = useState(null); - const [status, setStatus] = useState(AutoLoadStatus.IDLE); + const [status, setStatus] = useState(AutoLoadStatus.IDLE); useEffect(() => { const portalContainer = document.createElement('div'); From ae518dbba07f1fa0fd1b2daa7e058d1c456d29b8 Mon Sep 17 00:00:00 2001 From: DhruvArora-03 <93348668+DhruvArora-03@users.noreply.github.com> Date: Mon, 26 Feb 2024 20:11:33 -0600 Subject: [PATCH 3/4] fix: use typof SiteSupport.* --- src/views/components/CourseCatalogMain.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/components/CourseCatalogMain.tsx b/src/views/components/CourseCatalogMain.tsx index 6fd944e6..0a74bd13 100644 --- a/src/views/components/CourseCatalogMain.tsx +++ b/src/views/components/CourseCatalogMain.tsx @@ -5,7 +5,7 @@ import { useKeyPress } from '../hooks/useKeyPress'; import useSchedules from '../hooks/useSchedules'; import { CourseCatalogScraper } from '../lib/CourseCatalogScraper'; import getCourseTableRows from '../lib/getCourseTableRows'; -import type { SiteSupport } from '../lib/getSiteSupport'; +import type { SiteSupport, SiteSupportType } from '../lib/getSiteSupport'; import { populateSearchInputs } from '../lib/populateSearchInputs'; import ExtensionRoot from './common/ExtensionRoot/ExtensionRoot'; import AutoLoad from './injected/AutoLoad/AutoLoad'; @@ -17,7 +17,7 @@ import TableRow from './injected/TableRow/TableRow'; import TableSubheading from './injected/TableSubheading/TableSubheading'; interface Props { - support: SiteSupport.COURSE_CATALOG_DETAILS | SiteSupport.COURSE_CATALOG_LIST; + support: typeof SiteSupport.COURSE_CATALOG_DETAILS | typeof SiteSupport.COURSE_CATALOG_LIST; } /** From 77a76d789ab54a46386658f8ca7716d00e2abf16 Mon Sep 17 00:00:00 2001 From: DhruvArora-03 Date: Mon, 26 Feb 2024 20:49:11 -0600 Subject: [PATCH 4/4] fix: one more of Status to StatusType --- src/views/lib/CourseCatalogScraper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/lib/CourseCatalogScraper.ts b/src/views/lib/CourseCatalogScraper.ts index 6d881a48..046ce57f 100644 --- a/src/views/lib/CourseCatalogScraper.ts +++ b/src/views/lib/CourseCatalogScraper.ts @@ -1,4 +1,4 @@ -import type { InstructionMode, ScrapedRow, Semester } from '@shared/types/Course'; +import type { InstructionMode, ScrapedRow, Semester, StatusType } from '@shared/types/Course'; import { Course, Status } from '@shared/types/Course'; import { CourseSchedule } from '@shared/types/CourseSchedule'; import Instructor from '@shared/types/Instructor'; @@ -278,7 +278,7 @@ export class CourseCatalogScraper { * @param row the row of the course catalog table * @returns */ - getStatus(row: HTMLTableRowElement): [status: Status, isReserved: boolean] { + getStatus(row: HTMLTableRowElement): [status: StatusType, isReserved: boolean] { const div = row.querySelector(TableDataSelector.STATUS); if (!div) { throw new Error('Status not found');