Merge branch 'fix/Status-to-StatusType' into fix/divider-usage

This commit is contained in:
DhruvArora-03
2024-02-26 21:05:59 -06:00
5 changed files with 11 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ import { useKeyPress } from '../hooks/useKeyPress';
import useSchedules from '../hooks/useSchedules'; import useSchedules from '../hooks/useSchedules';
import { CourseCatalogScraper } from '../lib/CourseCatalogScraper'; import { CourseCatalogScraper } from '../lib/CourseCatalogScraper';
import getCourseTableRows from '../lib/getCourseTableRows'; import getCourseTableRows from '../lib/getCourseTableRows';
import type { SiteSupport } from '../lib/getSiteSupport'; import type { SiteSupport, SiteSupportType } from '../lib/getSiteSupport';
import { populateSearchInputs } from '../lib/populateSearchInputs'; import { populateSearchInputs } from '../lib/populateSearchInputs';
import ExtensionRoot from './common/ExtensionRoot/ExtensionRoot'; import ExtensionRoot from './common/ExtensionRoot/ExtensionRoot';
import AutoLoad from './injected/AutoLoad/AutoLoad'; import AutoLoad from './injected/AutoLoad/AutoLoad';
@@ -17,7 +17,7 @@ import TableRow from './injected/TableRow/TableRow';
import TableSubheading from './injected/TableSubheading/TableSubheading'; import TableSubheading from './injected/TableSubheading/TableSubheading';
interface Props { interface Props {
support: SiteSupport.COURSE_CATALOG_DETAILS | SiteSupport.COURSE_CATALOG_LIST; support: typeof SiteSupport.COURSE_CATALOG_DETAILS | typeof SiteSupport.COURSE_CATALOG_LIST;
} }
/** /**

View File

@@ -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 Text from '@views/components/common/Text/Text';
import clsx from 'clsx'; import clsx from 'clsx';
import React from 'react'; import React from 'react';
@@ -15,7 +15,7 @@ import CancelledIcon from '~icons/material-symbols/warning';
export interface CalendarCourseCellProps { export interface CalendarCourseCellProps {
courseDeptAndInstr: string; courseDeptAndInstr: string;
timeAndLocation?: string; timeAndLocation?: string;
status: Status; status: StatusType;
colors: CourseColors; colors: CourseColors;
className?: string; className?: string;
} }
@@ -27,7 +27,7 @@ export interface CalendarCourseCellProps {
* @param {CalendarCourseCellProps} props - The component props. * @param {CalendarCourseCellProps} props - The component props.
* @param {string} props.courseDeptAndInstr - The course department and instructor. * @param {string} props.courseDeptAndInstr - The course department and instructor.
* @param {string} props.timeAndLocation - The time and location of the course. * @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 {Colors} props.colors - The colors for styling the cell.
* @param {string} props.className - Additional CSS class name for the cell. * @param {string} props.className - Additional CSS class name for the cell.
* @returns {JSX.Element} The rendered component. * @returns {JSX.Element} The rendered component.

View File

@@ -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 { StatusIcon } from '@shared/util/icons';
import clsx from 'clsx'; import clsx from 'clsx';
import React from 'react'; import React from 'react';
@@ -11,7 +11,7 @@ type SizeType = 'small' | 'mini';
* Props for CourseStatus * Props for CourseStatus
*/ */
export interface CourseStatusProps { export interface CourseStatusProps {
status: Status; status: StatusType;
size: SizeType; size: SizeType;
} }

View File

@@ -4,6 +4,7 @@ import { CourseCatalogScraper } from '@views/lib/CourseCatalogScraper';
import { SiteSupport } from '@views/lib/getSiteSupport'; import { SiteSupport } from '@views/lib/getSiteSupport';
import { import {
AutoLoadStatus, AutoLoadStatus,
AutoLoadStatusType,
loadNextCourseCatalogPage, loadNextCourseCatalogPage,
removePaginationButtons, removePaginationButtons,
} from '@views/lib/loadNextCourseCatalogPage'; } from '@views/lib/loadNextCourseCatalogPage';
@@ -22,7 +23,7 @@ type Props = {
*/ */
export default function AutoLoad({ addRows }: Props) { export default function AutoLoad({ addRows }: Props) {
const [container, setContainer] = useState<HTMLDivElement | null>(null); const [container, setContainer] = useState<HTMLDivElement | null>(null);
const [status, setStatus] = useState<AutoLoadStatus>(AutoLoadStatus.IDLE); const [status, setStatus] = useState<AutoLoadStatusType>(AutoLoadStatus.IDLE);
useEffect(() => { useEffect(() => {
const portalContainer = document.createElement('div'); const portalContainer = document.createElement('div');

View File

@@ -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 { Course, Status } from '@shared/types/Course';
import { CourseSchedule } from '@shared/types/CourseSchedule'; import { CourseSchedule } from '@shared/types/CourseSchedule';
import Instructor from '@shared/types/Instructor'; import Instructor from '@shared/types/Instructor';
@@ -278,7 +278,7 @@ export class CourseCatalogScraper {
* @param row the row of the course catalog table * @param row the row of the course catalog table
* @returns * @returns
*/ */
getStatus(row: HTMLTableRowElement): [status: Status, isReserved: boolean] { getStatus(row: HTMLTableRowElement): [status: StatusType, isReserved: boolean] {
const div = row.querySelector(TableDataSelector.STATUS); const div = row.querySelector(TableDataSelector.STATUS);
if (!div) { if (!div) {
throw new Error('Status not found'); throw new Error('Status not found');