diff --git a/src/shared/types/CourseMeeting.ts b/src/shared/types/CourseMeeting.ts index d915f3df7..531ae3959 100644 --- a/src/shared/types/CourseMeeting.ts +++ b/src/shared/types/CourseMeeting.ts @@ -128,7 +128,7 @@ export class CourseMeeting { /** * Options to control the format of the time string */ -type TimeStringOptions = { +export type TimeStringOptions = { /** the separator between the start and end times */ separator: string; /** capitalizes the AM/PM */ diff --git a/src/stories/components/calendar/CalendarGrid.stories.tsx b/src/stories/components/calendar/CalendarGrid.stories.tsx index 9472d5e9d..7fea609c2 100644 --- a/src/stories/components/calendar/CalendarGrid.stories.tsx +++ b/src/stories/components/calendar/CalendarGrid.stories.tsx @@ -1,6 +1,3 @@ -<<<<<<< Updated upstream -import { Meta, StoryObj } from '@storybook/react'; -======= import { Course, Status } from '@shared/types/Course'; import { getCourseColors } from '@shared/util/colors'; import type { Meta, StoryObj } from '@storybook/react'; @@ -10,11 +7,8 @@ import { CourseMeeting, DAY_MAP } from 'src/shared/types/CourseMeeting'; import { CourseSchedule } from 'src/shared/types/CourseSchedule'; import Instructor from 'src/shared/types/Instructor'; import { UserSchedule } from 'src/shared/types/UserSchedule'; ->>>>>>> Stashed changes import CalendarGrid from 'src/views/components/calendar/CalendarGrid/CalendarGrid'; -import { getCourseColors } from '@shared/util/colors'; -import { CalendarGridCourse } from '@views/hooks/useFlattenedCourseSchedule'; -import { Status } from '@shared/types/Course'; + const meta = { title: 'Components/Calendar/CalendarGrid', @@ -29,9 +23,6 @@ const meta = { } satisfies Meta; export default meta; -<<<<<<< Updated upstream -const testData: CalendarGridCourse[] = [ -======= const exampleCourse: Course = new Course({ uniqueId: 50805, number: '314', @@ -84,7 +75,6 @@ const exampleSchedule = new UserSchedule({ } as Serialized); export const exampleCalendarGridCourses: CalendarGridCourse[] = [ ->>>>>>> Stashed changes { calendarGridPoint: { dayIndex: 4, diff --git a/src/views/components/PopupMain.tsx b/src/views/components/PopupMain.tsx index abad23589..2fd6ba0d7 100644 --- a/src/views/components/PopupMain.tsx +++ b/src/views/components/PopupMain.tsx @@ -3,14 +3,6 @@ import { FaCalendarAlt, FaCog, FaRedo } from 'react-icons/fa'; // Added FaRedo f import { StatusIcon } from '@shared/util/icons'; import { Status } from 'src/shared/types/Course'; import { test_colors } from 'src/stories/components/PopupCourseBlock.stories'; -<<<<<<< Updated upstream -======= - -import logoImage from '../../assets/logo.png'; // Adjust the path as necessary -import useSchedules from '../hooks/useSchedules'; -import { openTabFromContentScript } from '../lib/openNewTabFromContentScript'; -import Divider from './common/Divider/Divider'; ->>>>>>> Stashed changes import ExtensionRoot from './common/ExtensionRoot/ExtensionRoot'; import PopupCourseBlock from './common/PopupCourseBlock/PopupCourseBlock'; import Text from './common/Text/Text'; diff --git a/src/views/components/calendar/Calendar/Calendar.tsx b/src/views/components/calendar/Calendar/Calendar.tsx index 4806aed2a..0422028ff 100644 --- a/src/views/components/calendar/Calendar/Calendar.tsx +++ b/src/views/components/calendar/Calendar/Calendar.tsx @@ -3,7 +3,6 @@ import { Course } from 'src/shared/types/Course'; import { exampleCourse } from 'src/stories/components/PopupCourseBlock.stories'; import CalendarHeader from 'src/views/components/calendar/CalendarHeader/CalenderHeader'; import { useFlattenedCourseSchedule } from 'src/views/hooks/useFlattenedCourseSchedule'; - import CourseCatalogInjectedPopup from '../../injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup'; import { CalendarBottomBar } from '../CalendarBottomBar/CalendarBottomBar'; import CalendarGrid from '../CalendarGrid/CalendarGrid'; @@ -23,6 +22,7 @@ interface Props { export function Calendar(): JSX.Element { const courseCells = useFlattenedCourseSchedule(); const [showPopup, setShowPopup] = React.useState(false); + console.log(courseCells); return ( <> diff --git a/src/views/components/calendar/CalendarGrid/CalendarGrid.tsx b/src/views/components/calendar/CalendarGrid/CalendarGrid.tsx index 6aa176d27..9b64016bb 100644 --- a/src/views/components/calendar/CalendarGrid/CalendarGrid.tsx +++ b/src/views/components/calendar/CalendarGrid/CalendarGrid.tsx @@ -5,6 +5,7 @@ import { CalendarGridCourse } from 'src/views/hooks/useFlattenedCourseSchedule'; /* import calIcon from 'src/assets/icons/cal.svg'; import pngIcon from 'src/assets/icons/png.svg'; */ +import { getCourseColors } from 'src/shared/util/colors'; import CalendarCell from '../CalendarGridCell/CalendarGridCell'; import CalendarCourseCell from '../CalendarCourseCell/CalendarCourseCell'; import styles from './CalendarGrid.module.scss'; @@ -20,12 +21,12 @@ interface Props { * @param props */ function CalendarGrid({ courseCells, saturdayClass, setShowPopup }: React.PropsWithChildren): JSX.Element { - const [grid, setGrid] = useState([]); + // const [grid, setGrid] = useState([]); const calendarRef = useRef(null); // Create a ref for the calendar grid const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key)); const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8); - + console.log(courseCells); /* const saveAsPNG = () => { htmlToImage .toPng(calendarRef.current, { @@ -59,33 +60,33 @@ function CalendarGrid({ courseCells, saturdayClass, setShowPopup }: React.PropsW }); }; */ - useEffect(() => { - const newGrid = []; - for (let i = 0; i < 13; i++) { - const row = []; - let hour = hoursOfDay[i]; - let styleProp = { - gridColumn: '1', - gridRow: `${2 * i + 2}`, - }; - row.push( -
-
-

{(hour % 12 === 0 ? 12 : hour % 12) + (hour < 12 ? ' AM' : ' PM')}

-
+ + const grid = []; + for (let i = 0; i < 13; i++) { + const row = []; + let hour = hoursOfDay[i]; + let styleProp = { + gridColumn: '1', + gridRow: `${2 * i + 2}`, + }; + row.push( +
+
+

{(hour % 12 === 0 ? 12 : hour % 12) + (hour < 12 ? ' AM' : ' PM')}

- ); - for (let k = 0; k < 5; k++) { - styleProp = { - gridColumn: `${k + 2}`, - gridRow: `${2 * i + 2} / ${2 * i + 4}`, - }; - row.push(); - } - newGrid.push(row); +
+ ); + for (let k = 0; k < 5; k++) { + styleProp = { + gridColumn: `${k + 2}`, + gridRow: `${2 * i + 2} / ${2 * i + 4}`, + }; + row.push(); } - setGrid(newGrid); - }, []); + grid.push(row); + } + // setGrid(newGrid); + return (
@@ -154,8 +155,8 @@ function AccountForCourseConflicts({ courseCells, setShowPopup }: AccountForCour
setShowPopup(true)} />
diff --git a/src/views/components/calendar/CalendarHeader/CalenderHeader.tsx b/src/views/components/calendar/CalendarHeader/CalenderHeader.tsx index a269d0e68..3d5a5422c 100644 --- a/src/views/components/calendar/CalendarHeader/CalenderHeader.tsx +++ b/src/views/components/calendar/CalendarHeader/CalenderHeader.tsx @@ -1,26 +1,17 @@ import { Status } from '@shared/types/Course'; import React from 'react'; import calIcon from 'src/assets/logo.png'; - import MenuIcon from '~icons/material-symbols/menu'; -<<<<<<< Updated upstream import LogoIcon from '~icons/material-symbols/add-circle-outline'; import UndoIcon from '~icons/material-symbols/undo'; -======= ->>>>>>> Stashed changes import RedoIcon from '~icons/material-symbols/redo'; import SettingsIcon from '~icons/material-symbols/settings'; -import UndoIcon from '~icons/material-symbols/undo'; - import { Button } from '../../common/Button/Button'; import CourseStatus from '../../common/CourseStatus/CourseStatus'; -<<<<<<< Updated upstream -import { handleOpenOptions } from '../../PopupMain'; -======= import Divider from '../../common/Divider/Divider'; import ScheduleTotalHoursAndCourses from '../../common/ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses'; import Text from '../../common/Text/Text'; ->>>>>>> Stashed changes +import { handleOpenOptions } from '../../PopupMain'; const CalendarHeader = () => (
@@ -29,15 +20,9 @@ const CalendarHeader = () => (