From ff4ee494b69d62eb2dcea86ab9074a187e50477c Mon Sep 17 00:00:00 2001 From: vivek12311 Date: Sat, 17 Feb 2024 16:03:28 -0600 Subject: [PATCH 1/7] Using React-icons. Probably need to take out later --- package-lock.json | 9 ++ package.json | 1 + pnpm-lock.yaml | 11 ++ src/assets/logo.png | Bin 0 -> 13866 bytes src/stories/components/PopupMain.stories.tsx | 23 +++ src/views/components/PopupMain.tsx | 146 ++++++++++++++++--- 6 files changed, 173 insertions(+), 17 deletions(-) create mode 100644 src/assets/logo.png diff --git a/package-lock.json b/package-lock.json index 1599b14b..686431a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "react": "^18.2.0", "react-devtools-core": "^5.0.0", "react-dom": "^18.2.0", + "react-icons": "^5.0.1", "react-window": "^1.8.10", "sass": "^1.70.0", "sql.js": "1.10.2", @@ -20112,6 +20113,14 @@ "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==", "dev": true }, + "node_modules/react-icons": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.0.1.tgz", + "integrity": "sha512-WqLZJ4bLzlhmsvme6iFdgO8gfZP17rfjYEJ2m9RsZjZ+cc4k1hTzknEz63YS1MeT50kVzoa1Nz36f4BEx+Wigw==", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/package.json b/package.json index 4cda8c17..11366e9d 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "react": "^18.2.0", "react-devtools-core": "^5.0.0", "react-dom": "^18.2.0", + "react-icons": "^5.0.1", "react-window": "^1.8.10", "sass": "^1.70.0", "sql.js": "1.10.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7795c182..d94f93c7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,6 +43,9 @@ dependencies: react-dom: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) + react-icons: + specifier: ^5.0.1 + version: 5.0.1(react@18.2.0) react-window: specifier: ^1.8.10 version: 1.8.10(react-dom@18.2.0)(react@18.2.0) @@ -11193,6 +11196,14 @@ packages: resolution: {integrity: sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==} dev: true + /react-icons@5.0.1(react@18.2.0): + resolution: {integrity: sha512-WqLZJ4bLzlhmsvme6iFdgO8gfZP17rfjYEJ2m9RsZjZ+cc4k1hTzknEz63YS1MeT50kVzoa1Nz36f4BEx+Wigw==} + peerDependencies: + react: '*' + dependencies: + react: 18.2.0 + dev: false + /react-is@16.13.1: resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..294a3dc83445945b466b9f52c9e484a9015ff109 GIT binary patch literal 13866 zcmch7WmH_v(k^a6X3*fnAi-UNhJgtV!QFzpy9Wpv+})kv5Foe*2^QQnc#z=1@8mt_ zJKtIN{=a*zo~qqX)l=PFy?eU%+TqGd(l}UTSO^FRII=QORRjb?FudSnpuuZ&`WMI% z5U}4^OG+xsN=ky1T^uc}?aUDnWWtlR(6!ZuiF5Q4;>0B|K_L1|2AB*ch(459+~+GW z0U^KtB?hyHnMzM%o(Up(D|5kuwMYMW!NR=>1foOo!ed7fYrnO|@6>O7<$gVI{9$jj z#dQQBFCdtOcrT9(VLRfSo~!36s%V=K?K3$@oFEPX`A2iR2p0=8Gle+0$n)yjYS7w` zYN4Tqr^RO@#YB#wpNK(FNY=o_&m9Rr0784jtCVeI@uag|wTo}u*yKM_x>0Bh8T&}F z^y&MovD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>2u7%kG#k-!BGR)LK zgTC?_T2o3e>oGjxyE6g#!fjxZjdU8Ek~~=^?hb@%83`kc0>+|A{Z*&m^tU(BcK2A@ zY5(+l$v%G5g10|%=o8`4csW*>b6@yy33j~Nee;+4C-n!BxN+&n8tMLvV8MqTG1rYT zt&l6Pgzg_fZurbs@Z=qus^4Jii&RgA%@LIh6L4lps`3ETm(yZsg6oGz(ry!o^BSV2>aEF}kZfuV!gc$3Sp`vUR0Gco|pwVGhnI<4k&EYws^i z9GW1SlT?mpS@xd}I828dX7pg1IEaj%PYtdGS9V-RaV2qIE#?Jr=9#M_WAPKd91Bo3 zkF4U$P+wzOM)7MD#B8xrUszC@^B2`1EooW$0wILDPE83DnuAiRXyoCoYA9XgY1vY8 zoD>A#?L&#Fvndt)DDgVh<}Ic*AsvK>5wV5u6Mnp2yL4koC@&ViBPtp4IaXLytxs@@8Ks&k4H%N*Kc? zB^&&HxpOQ~mBX5ldyJ&)W?IA}p-UZ{08LdFXfJ~AXQE^dxC}sxC?%j=H46_Sel|IR zIFuU#`hpDwRXtFg>hpzdfxgIQk$4qbU9MxY-^0e5U4`M(uj_;#5Ii6*D%#W!fk!Wij5gKnTK5g&Xfr- zzS)JP8Da?)+h}fA4#Jm7@BQ!__!?*a_&JB?Z{f_3Llz_&P#%;pm`EM%ZQeGV>;EI| aGxDD$M2S^o?4iG(#mT-^f>uiy2mc>6iIWZh literal 0 HcmV?d00001 diff --git a/src/stories/components/PopupMain.stories.tsx b/src/stories/components/PopupMain.stories.tsx index e69de29b..dc452909 100644 --- a/src/stories/components/PopupMain.stories.tsx +++ b/src/stories/components/PopupMain.stories.tsx @@ -0,0 +1,23 @@ +import { Meta, StoryObj } from '@storybook/react'; +import PopupMain from 'src/views/components/PopupMain'; + +const meta = { + title: 'Components/Common/PopupMain', + component: PopupMain, + parameters: { + layout: 'centered', + }, + tags: ['autodocs'], + argTypes: { + + }, +} satisfies Meta; +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + args: { + + }, +}; \ No newline at end of file diff --git a/src/views/components/PopupMain.tsx b/src/views/components/PopupMain.tsx index fa97323d..bc437c96 100644 --- a/src/views/components/PopupMain.tsx +++ b/src/views/components/PopupMain.tsx @@ -1,24 +1,136 @@ -import { background } from '@shared/messages'; import React from 'react'; -import useSchedules from '../hooks/useSchedules'; -import { Button } from './common/Button/Button'; +import { FaCalendarAlt, FaCog, FaRedo } from 'react-icons/fa'; // Added FaRedo for the refresh icon +import { StatusIcon } from '@shared/util/icons'; import ExtensionRoot from './common/ExtensionRoot/ExtensionRoot'; +import PopupCourseBlock from './common/PopupCourseBlock/PopupCourseBlock'; +import Text from './common/Text/Text'; +import Divider from './common/Divider/Divider'; +import logoImage from '../../assets/logo.png'; // Adjust the path as necessary +import List from './common/List/List'; // Ensure this path is correctly pointing to your List component + + export default function PopupMain() { - const [activeSchedule, schedules] = useSchedules(); + const courses = [ + { + uniqueId: '47280', + department: 'BIO', + number: '311C', + instructors: [{ lastName: 'Fritz' }], + status: 'OPEN', + }, + { + uniqueId: '51180', + department: 'C S', + number: '374L', + instructors: [{ lastName: 'Baer' }], + status: 'CLOSED', + }, + { + uniqueId: '60020', + department: 'S W', + number: '310', + instructors: [{ lastName: 'Whalley' }], + status: 'WAITLISTED', + }, + { + uniqueId: '13190', + department: 'PED', + number: '106C', + instructors: [{ lastName: 'Rich' }], + status: 'CANCELLED', + }, + { + uniqueId: '44435', + department: 'WGS', + number: '301', + instructors: [{ lastName: 'RODRIGUEZ' }], + status: 'TEMP', + }, + ]; - // TODO: Add a button to to switch the active schedule - return ( - - - - ); + // Manually applying colors for the demonstration + const colors = { + OPEN: { primaryColor: '#34D399', secondaryColor: '#059669' }, + CLOSED: { primaryColor: '#818cf8', secondaryColor: '#4f46e5' }, + WAITLISTED: { primaryColor: '#F59E00', secondaryColor: '#B45309' }, + CANCELLED: { primaryColor: '#EF4444', secondaryColor: '#b91c1c' }, + TEMP: { primaryColor: '#fde047', secondaryColor: '#eab308' }, + }; + + const draggableElements = courses.map((course) => ( + +)); + + +return ( + +

+
+
+ Logo +
+ UT Registration + Plus +
+
+
+ + +
+
+ +
+ MAIN SCHEDULE: +
+ 22 HOURS + 8 Courses +
+
+ {/* Integrate the List component here */} + +
+
+
+ +
+ WAITLISTED +
+
+
+ +
+ CLOSED +
+
+
+ +
+ CANCELLED +
+
+
+
+ DATA UPDATED ON: 12:00 AM 02/01/2024 + +
+
+
+ +); } From 7f76af7ab37a4325bf816832739af635bcd7c619 Mon Sep 17 00:00:00 2001 From: DhruvArora-03 Date: Mon, 19 Feb 2024 11:28:33 -0600 Subject: [PATCH 2/7] fix ConflictsWithWarning --- .../ConflictsWithWarning.stories.tsx | 102 +++++++++++++++++- .../ConflictsWithWarning.tsx | 38 +++---- 2 files changed, 113 insertions(+), 27 deletions(-) diff --git a/src/stories/components/ConflictsWithWarning.stories.tsx b/src/stories/components/ConflictsWithWarning.stories.tsx index f1f9855a..d81706a7 100644 --- a/src/stories/components/ConflictsWithWarning.stories.tsx +++ b/src/stories/components/ConflictsWithWarning.stories.tsx @@ -1,5 +1,96 @@ import { Meta, StoryObj } from '@storybook/react'; import ConflictsWithWarning from '@views/components/common/ConflictsWithWarning/ConflictsWithWarning'; +import { Course, Status } from 'src/shared/types/Course'; +import { CourseMeeting } from 'src/shared/types/CourseMeeting'; +import Instructor from 'src/shared/types/Instructor'; + +export const ExampleCourse: Course = new Course({ + courseName: 'ELEMS OF COMPTRS/PROGRAMMNG-WB', + creditHours: 3, + department: 'C S', + description: [ + 'Problem solving and fundamental algorithms for various applications in science, business, and on the World Wide Web, and introductory programming in a modern object-oriented programming language.', + 'Only one of the following may be counted: Computer Science 303E, 312, 312H. Credit for Computer Science 303E may not be earned after a student has received credit for Computer Science 314, or 314H. May not be counted toward a degree in computer science.', + 'May be counted toward the Quantitative Reasoning flag requirement.', + 'Designed to accommodate 100 or more students.', + 'Taught as a Web-based course.', + ], + flags: ['Quantitative Reasoning'], + fullName: 'C S 303E ELEMS OF COMPTRS/PROGRAMMNG-WB', + instructionMode: 'Online', + instructors: [ + new Instructor({ + firstName: 'Bevo', + lastName: 'Bevo', + fullName: 'Bevo Bevo', + }), + ], + isReserved: false, + number: '303E', + schedule: { + meetings: [ + new CourseMeeting({ + days: ['Tuesday', 'Thursday'], + endTime: 660, + startTime: 570, + }), + ], + }, + semester: { + code: '12345', + season: 'Spring', + year: 2024, + }, + status: Status.WAITLISTED, + uniqueId: 12345, + url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/', +}); +export const ExampleCourse2: Course = new Course({ + courseName: 'PRINCIPLES OF COMPUTER SYSTEMS', + creditHours: 3, + department: 'C S', + description: [ + 'Restricted to computer science majors.', + 'An introduction to computer systems software abstractions with an emphasis on the connection of these abstractions to underlying computer hardware. Key abstractions include threads, virtual memory, protection, and I/O. Requires writing of synchronized multithreaded programs and pieces of an operating system.', + 'Computer Science 439 and 439H may not both be counted.', + 'Prerequisite: Computer Science 429, or 429H with a grade of at least C-.', + 'May be counted toward the Independent Inquiry flag requirement.', + ], + flags: ['Independent Inquiry'], + fullName: 'C S 439 PRINCIPLES OF COMPUTER SYSTEMS', + instructionMode: 'In Person', + instructors: [ + new Instructor({ + firstName: 'Allison', + lastName: 'Norman', + fullName: 'Allison Norman', + }), + ], + isReserved: false, + number: '439', + schedule: { + meetings: [ + new CourseMeeting({ + days: ['Tuesday', 'Thursday'], + startTime: 930, + endTime: 1050, + }), + new CourseMeeting({ + days: ['Friday'], + startTime: 600, + endTime: 720, + }), + ], + }, + semester: { + code: '12345', + season: 'Spring', + year: 2024, + }, + status: Status.WAITLISTED, + uniqueId: 67890, + url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/', +}); const meta = { title: 'Components/Common/ConflictsWithWarning', @@ -9,8 +100,10 @@ const meta = { }, tags: ['autodocs'], argTypes: { - ConflictingCourse: { control: 'string' }, - SectionNumber: { control: 'string' }, + conflicts: { control: 'object' }, + }, + args: { + conflicts: [ExampleCourse, ExampleCourse2], }, } satisfies Meta; export default meta; @@ -19,7 +112,6 @@ type Story = StoryObj; export const Default: Story = { args: { - ConflictingCourse: 'BVO 311C', - SectionNumber: '47280', + conflicts: [ExampleCourse, ExampleCourse2], }, -}; \ No newline at end of file +}; diff --git a/src/views/components/common/ConflictsWithWarning/ConflictsWithWarning.tsx b/src/views/components/common/ConflictsWithWarning/ConflictsWithWarning.tsx index ca1cc9bf..30d08e77 100644 --- a/src/views/components/common/ConflictsWithWarning/ConflictsWithWarning.tsx +++ b/src/views/components/common/ConflictsWithWarning/ConflictsWithWarning.tsx @@ -1,43 +1,37 @@ import React from 'react'; +import { Course } from 'src/shared/types/Course'; +import clsx from 'clsx'; import Text from '../Text/Text'; /** * Props for ConflictWithWarningProps */ export interface ConflictsWithWarningProps { - ConflictingCourse: string; - SectionNumber: string; + className?: string; + conflicts: Course[]; } /** - * The ConflictsWithWarning component is used to display a warning message when a course conflicts + * The ConflictsWithWarning component is used to display a warning message when a course conflicts * with another course as part of the labels and details section * * @param props ConflictsWithWarningProps */ -export default function ConflictsWithWarning( { ConflictingCourse, SectionNumber }: ConflictsWithWarningProps): JSX.Element { - const UniqueCourseConflictText = `${ConflictingCourse} (${SectionNumber})`; - - return ( -
- - Conflicts With: - - - {UniqueCourseConflictText} - -
- ); -} - -function ConflictsWithoutWarningText( {children}: {children: string} ) { +export default function ConflictsWithWarning({ className, conflicts }: ConflictsWithWarningProps): JSX.Element { return ( - {children} +
Conflicts With:
+ {conflicts.map(course => ( +
+ {`${course.department} ${course.number} (${course.uniqueId})`} +
+ ))}
); } From 70c75ff481ff243b613bbcc42136996c46b3a901 Mon Sep 17 00:00:00 2001 From: DhruvArora-03 Date: Mon, 19 Feb 2024 11:29:24 -0600 Subject: [PATCH 3/7] add button to the rows, use new ConflictsWithWarning component --- .../components/injected/TableRow/TableRow.tsx | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/views/components/injected/TableRow/TableRow.tsx b/src/views/components/injected/TableRow/TableRow.tsx index e9c6796e..a6e82cb1 100644 --- a/src/views/components/injected/TableRow/TableRow.tsx +++ b/src/views/components/injected/TableRow/TableRow.tsx @@ -3,9 +3,9 @@ import { UserSchedule } from '@shared/types/UserSchedule'; import React, { useEffect, useState } from 'react'; import ReactDOM from 'react-dom'; import { Button } from '../../common/Button/Button'; -import Icon from '../../common/Icon/Icon'; -import Text from '../../common/Text/Text'; import styles from './TableRow.module.scss'; +import ConflictsWithWarning from '../../common/ConflictsWithWarning/ConflictsWithWarning'; +import AddIcon from '~icons/material-symbols/add-circle'; interface Props { isSelected: boolean; @@ -54,7 +54,7 @@ export default function TableRow({ row, isSelected, activeSchedule, onClick }: P return () => { element.classList.remove(styles.inActiveSchedule); }; - }, [activeSchedule, element.classList]); + }, [activeSchedule, course, element.classList]); useEffect(() => { if (!activeSchedule || !course) { @@ -84,20 +84,14 @@ export default function TableRow({ row, isSelected, activeSchedule, onClick }: P return ReactDOM.createPortal( <> - - {conflicts.length > 0 && ( -
-
- {conflicts.map(c => ( - - {c.department} {c.number} ({c.uniqueId}) - - ))} -
-
- )} + From c676be4765a49d2c382ac88dddf3933747c5dbcb Mon Sep 17 00:00:00 2001 From: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Mon, 19 Feb 2024 18:26:09 -0600 Subject: [PATCH 5/7] Fixed build errors and restructured Calendar page --- ....timestamp-1708365827408-19c5144af9dbf.mjs | 30 +++++++++++++++++++ .../components/CalendarBottomBar.stories.tsx | 2 +- .../components/CalendarCourse.stories.tsx | 2 +- .../components/CalendarCourseCell.stories.tsx | 4 +-- .../components/CalendarGrid.stories.tsx | 2 +- .../components/CalendarGridCell.stories.tsx | 18 +++++------ .../components/CalendarHeader.stories.tsx | 2 +- .../components/CalendarSchedules.stories.tsx | 4 +-- .../components/ImportantLinks.stories.tsx | 2 +- src/views/components/PopupMain.tsx | 15 +++++----- .../CalendarBottomBar/CalendarBottomBar.tsx | 4 +-- .../CalendarCourseMeeting.module.scss | 0 .../CalendarCourseMeeting.tsx | 0 .../CalendarCourseCell/CalendarCourseCell.tsx | 2 +- .../CalendarGrid/CalendarGrid.module.scss | 0 .../CalendarGrid/CalendarGrid.tsx | 0 .../CalendarGridCell.module.scss | 0 .../CalendarGridCell/CalendarGridCell.tsx | 0 .../CalendarHeader/CalenderHeader.tsx | 10 +++---- .../CalendarSchedules/CalendarSchedules.tsx | 8 ++--- .../{ => calendar}/ImportantLinks.tsx | 2 +- src/views/hooks/useFlattenedCourseSchedule.ts | 2 +- 22 files changed, 69 insertions(+), 40 deletions(-) create mode 100644 .storybook/vite-storybook.config.ts.timestamp-1708365827408-19c5144af9dbf.mjs rename src/views/components/{common => calendar}/CalendarBottomBar/CalendarBottomBar.tsx (94%) rename src/views/components/{common => calendar}/CalendarCourseBlock/CalendarCourseMeeting.module.scss (100%) rename src/views/components/{common => calendar}/CalendarCourseBlock/CalendarCourseMeeting.tsx (100%) rename src/views/components/{common => calendar}/CalendarCourseCell/CalendarCourseCell.tsx (98%) rename src/views/components/{common => calendar}/CalendarGrid/CalendarGrid.module.scss (100%) rename src/views/components/{common => calendar}/CalendarGrid/CalendarGrid.tsx (100%) rename src/views/components/{common => calendar}/CalendarGridCell/CalendarGridCell.module.scss (100%) rename src/views/components/{common => calendar}/CalendarGridCell/CalendarGridCell.tsx (100%) rename src/views/components/{common => calendar}/CalendarHeader/CalenderHeader.tsx (87%) rename src/views/components/{common => calendar}/CalendarSchedules/CalendarSchedules.tsx (82%) rename src/views/components/{ => calendar}/ImportantLinks.tsx (98%) diff --git a/.storybook/vite-storybook.config.ts.timestamp-1708365827408-19c5144af9dbf.mjs b/.storybook/vite-storybook.config.ts.timestamp-1708365827408-19c5144af9dbf.mjs new file mode 100644 index 00000000..fa5cdaf3 --- /dev/null +++ b/.storybook/vite-storybook.config.ts.timestamp-1708365827408-19c5144af9dbf.mjs @@ -0,0 +1,30 @@ +// .storybook/vite-storybook.config.ts +import react from "file:///C:/Users/somgu/OneDrive/Desktop/UT-Registration-Plus/node_modules/.pnpm/@vitejs+plugin-react-swc@3.6.0_vite@5.1.2/node_modules/@vitejs/plugin-react-swc/index.mjs"; +import { resolve } from "path"; +import UnoCSS from "file:///C:/Users/somgu/OneDrive/Desktop/UT-Registration-Plus/node_modules/.pnpm/unocss@0.58.5_postcss@8.4.35_vite@5.1.2/node_modules/unocss/dist/vite.mjs"; +import Icons from "file:///C:/Users/somgu/OneDrive/Desktop/UT-Registration-Plus/node_modules/.pnpm/unplugin-icons@0.18.5_@svgr+core@8.1.0/node_modules/unplugin-icons/dist/vite.js"; +import { defineConfig } from "file:///C:/Users/somgu/OneDrive/Desktop/UT-Registration-Plus/node_modules/.pnpm/vite@5.1.2_@types+node@20.11.17_sass@1.70.0/node_modules/vite/dist/node/index.js"; +var __vite_injected_original_dirname = "C:\\Users\\somgu\\OneDrive\\Desktop\\UT-Registration-Plus\\.storybook"; +var root = resolve(__vite_injected_original_dirname, "../src"); +var pagesDir = resolve(root, "pages"); +var assetsDir = resolve(root, "assets"); +var publicDir = resolve(__vite_injected_original_dirname, "../public"); +console.log(root); +var vite_storybook_config_default = defineConfig({ + plugins: [react(), UnoCSS(), Icons({ compiler: "jsx", jsx: "react" })], + resolve: { + alias: { + src: root, + "@assets": assetsDir, + "@pages": pagesDir, + "@public": publicDir, + "@shared": resolve(root, "shared"), + "@background": resolve(pagesDir, "background"), + "@views": resolve(root, "views") + } + } +}); +export { + vite_storybook_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLnN0b3J5Ym9vay92aXRlLXN0b3J5Ym9vay5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJDOlxcXFxVc2Vyc1xcXFxzb21ndVxcXFxPbmVEcml2ZVxcXFxEZXNrdG9wXFxcXFVULVJlZ2lzdHJhdGlvbi1QbHVzXFxcXC5zdG9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XO0FBQUEsTUFDWCxVQUFVO0FBQUEsTUFDVixXQUFXO0FBQUEsTUFDWCxXQUFXLFFBQVEsTUFBTSxRQUFRO0FBQUEsTUFDakMsZUFBZSxRQUFRLFVBQVUsWUFBWTtBQUFBLE1BQzdDLFVBQVUsUUFBUSxNQUFNLE9BQU87QUFBQSxJQUNuQztBQUFBLEVBQ0o7QUFDSixDQUFDOyIsCiAgIm5hbWVzIjogW10KfQo= diff --git a/src/stories/components/CalendarBottomBar.stories.tsx b/src/stories/components/CalendarBottomBar.stories.tsx index a1f1c5c7..1ee78750 100644 --- a/src/stories/components/CalendarBottomBar.stories.tsx +++ b/src/stories/components/CalendarBottomBar.stories.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Meta, StoryObj } from '@storybook/react'; import { Course, Status } from '@shared/types/Course'; import Instructor from '@shared/types/Instructor'; -import { CalendarBottomBar } from '@views/components/common/CalendarBottomBar/CalendarBottomBar'; +import { CalendarBottomBar } from 'src/views/components/calendar/CalendarBottomBar/CalendarBottomBar'; import { getCourseColors } from '../../shared/util/colors'; const exampleGovCourse: Course = new Course({ diff --git a/src/stories/components/CalendarCourse.stories.tsx b/src/stories/components/CalendarCourse.stories.tsx index 77ed8a2e..43cd032e 100644 --- a/src/stories/components/CalendarCourse.stories.tsx +++ b/src/stories/components/CalendarCourse.stories.tsx @@ -3,7 +3,7 @@ import { Course, Status } from '@shared/types/Course'; import { CourseMeeting, DAY_MAP } from '@shared/types/CourseMeeting'; import { CourseSchedule } from '@shared/types/CourseSchedule'; import Instructor from '@shared/types/Instructor'; -import CalendarCourse from '@views/components/common/CalendarCourseBlock/CalendarCourseMeeting'; +import CalendarCourse from 'src/views/components/calendar/CalendarCourseBlock/CalendarCourseMeeting'; const meta = { title: 'Components/Common/CalendarCourseMeeting', diff --git a/src/stories/components/CalendarCourseCell.stories.tsx b/src/stories/components/CalendarCourseCell.stories.tsx index 61cbdd33..cc3ae3aa 100644 --- a/src/stories/components/CalendarCourseCell.stories.tsx +++ b/src/stories/components/CalendarCourseCell.stories.tsx @@ -1,7 +1,7 @@ import { Course, Status } from '@shared/types/Course'; import { getCourseColors } from '@shared/util/colors'; import { Meta, StoryObj } from '@storybook/react'; -import CalendarCourseCell from '@views/components/common/CalendarCourseCell/CalendarCourseCell'; +import CalendarCourseCell from 'src/views/components/calendar/CalendarCourseCell/CalendarCourseCell'; import React from 'react'; import { exampleCourse } from './PopupCourseBlock.stories'; @@ -91,7 +91,7 @@ export const Variants: Story = { // uniqueId: 67890, // url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/', // }); - + colors={getCourseColors('green', 500)} /> ; export default meta; type Story = StoryObj; -export const Default: Story = {}; \ No newline at end of file +export const Default: Story = {}; diff --git a/src/stories/components/CalendarHeader.stories.tsx b/src/stories/components/CalendarHeader.stories.tsx index 047d8694..cd715035 100644 --- a/src/stories/components/CalendarHeader.stories.tsx +++ b/src/stories/components/CalendarHeader.stories.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Meta, StoryObj } from '@storybook/react'; -import CalendarHeader from '@views/components/common/CalendarHeader/CalenderHeader'; +import CalendarHeader from 'src/views/components/calendar/CalendarHeader/CalenderHeader'; const meta = { title: 'Components/Common/CalendarHeader', diff --git a/src/stories/components/CalendarSchedules.stories.tsx b/src/stories/components/CalendarSchedules.stories.tsx index 0dd60e2f..ccd13b4c 100644 --- a/src/stories/components/CalendarSchedules.stories.tsx +++ b/src/stories/components/CalendarSchedules.stories.tsx @@ -5,7 +5,7 @@ import React from 'react'; import { CourseMeeting, DAY_MAP } from 'src/shared/types/CourseMeeting'; import { CourseSchedule } from 'src/shared/types/CourseSchedule'; import Instructor from 'src/shared/types/Instructor'; -import { CalendarSchedules } from 'src/views/components/common/CalendarSchedules/CalendarSchedules'; +import { CalendarSchedules } from 'src/views/components/calendar/CalendarSchedules/CalendarSchedules'; const meta = { title: 'Components/Common/CalendarSchedules', @@ -17,7 +17,6 @@ const meta = { argTypes: { dummySchedules: { control: 'object' }, dummyActiveIndex: { control: 'number' }, - }, render: (args: any) => (
@@ -141,6 +140,5 @@ export const Default: Story = { args: { dummySchedules: schedules, dummyActiveIndex: 0, - }, }; diff --git a/src/stories/components/ImportantLinks.stories.tsx b/src/stories/components/ImportantLinks.stories.tsx index 9f8a606d..95619fa9 100644 --- a/src/stories/components/ImportantLinks.stories.tsx +++ b/src/stories/components/ImportantLinks.stories.tsx @@ -1,5 +1,5 @@ import { Meta, StoryObj } from '@storybook/react'; -import ImportantLinks from 'src/views/components/ImportantLinks'; +import ImportantLinks from 'src/views/components/calendar/ImportantLinks'; const meta = { title: 'Components/Common/ImportantLinks', diff --git a/src/views/components/PopupMain.tsx b/src/views/components/PopupMain.tsx index f831ed77..82edd17c 100644 --- a/src/views/components/PopupMain.tsx +++ b/src/views/components/PopupMain.tsx @@ -1,13 +1,14 @@ import React from 'react'; import { FaCalendarAlt, FaCog, FaRedo } from 'react-icons/fa'; // Added FaRedo for the refresh icon import { StatusIcon } from '@shared/util/icons'; +import { generateCourses } from 'src/stories/components/List.stories'; +import { Status } from 'src/shared/types/Course'; import ExtensionRoot from './common/ExtensionRoot/ExtensionRoot'; import PopupCourseBlock from './common/PopupCourseBlock/PopupCourseBlock'; import Text from './common/Text/Text'; import Divider from './common/Divider/Divider'; import logoImage from '../../assets/logo.png'; // Adjust the path as necessary import List from './common/List/List'; // Ensure this path is correctly pointing to your List component -import { generateCourses } from 'src/stories/components/List.stories'; export default function PopupMain() { const courses = generateCourses(5); @@ -52,7 +53,7 @@ return (
-
+
MAIN SCHEDULE:
22 HOURS @@ -67,22 +68,22 @@ return ( listWidth={350} // Adjust based on your layout/design gap={12} // Spacing between items /> -
+
- +
WAITLISTED
- +
CLOSED
- +
CANCELLED
@@ -90,7 +91,7 @@ return (
DATA UPDATED ON: 12:00 AM 02/01/2024 - +
diff --git a/src/views/components/common/CalendarBottomBar/CalendarBottomBar.tsx b/src/views/components/calendar/CalendarBottomBar/CalendarBottomBar.tsx similarity index 94% rename from src/views/components/common/CalendarBottomBar/CalendarBottomBar.tsx rename to src/views/components/calendar/CalendarBottomBar/CalendarBottomBar.tsx index 5b99ab8d..8bf5962b 100644 --- a/src/views/components/common/CalendarBottomBar/CalendarBottomBar.tsx +++ b/src/views/components/calendar/CalendarBottomBar/CalendarBottomBar.tsx @@ -1,8 +1,8 @@ import React from 'react'; import clsx from 'clsx'; -import Text from '../Text/Text'; +import Text from '../../common/Text/Text'; import CalendarCourseBlock, { CalendarCourseCellProps } from '../CalendarCourseCell/CalendarCourseCell'; -import { Button } from '../Button/Button'; +import { Button } from '../../common/Button/Button'; import ImageIcon from '~icons/material-symbols/image'; import CalendarMonthIcon from '~icons/material-symbols/calendar-month'; diff --git a/src/views/components/common/CalendarCourseBlock/CalendarCourseMeeting.module.scss b/src/views/components/calendar/CalendarCourseBlock/CalendarCourseMeeting.module.scss similarity index 100% rename from src/views/components/common/CalendarCourseBlock/CalendarCourseMeeting.module.scss rename to src/views/components/calendar/CalendarCourseBlock/CalendarCourseMeeting.module.scss diff --git a/src/views/components/common/CalendarCourseBlock/CalendarCourseMeeting.tsx b/src/views/components/calendar/CalendarCourseBlock/CalendarCourseMeeting.tsx similarity index 100% rename from src/views/components/common/CalendarCourseBlock/CalendarCourseMeeting.tsx rename to src/views/components/calendar/CalendarCourseBlock/CalendarCourseMeeting.tsx diff --git a/src/views/components/common/CalendarCourseCell/CalendarCourseCell.tsx b/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx similarity index 98% rename from src/views/components/common/CalendarCourseCell/CalendarCourseCell.tsx rename to src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx index 1ea60c25..da9db25f 100644 --- a/src/views/components/common/CalendarCourseCell/CalendarCourseCell.tsx +++ b/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx @@ -5,7 +5,7 @@ import { CourseColors, pickFontColor } from 'src/shared/util/colors'; import ClosedIcon from '~icons/material-symbols/lock'; import WaitlistIcon from '~icons/material-symbols/timelapse'; import CancelledIcon from '~icons/material-symbols/warning'; -import Text from '../Text/Text'; +import Text from '../../common/Text/Text'; export interface CalendarCourseCellProps { courseDeptAndInstr: string; diff --git a/src/views/components/common/CalendarGrid/CalendarGrid.module.scss b/src/views/components/calendar/CalendarGrid/CalendarGrid.module.scss similarity index 100% rename from src/views/components/common/CalendarGrid/CalendarGrid.module.scss rename to src/views/components/calendar/CalendarGrid/CalendarGrid.module.scss diff --git a/src/views/components/common/CalendarGrid/CalendarGrid.tsx b/src/views/components/calendar/CalendarGrid/CalendarGrid.tsx similarity index 100% rename from src/views/components/common/CalendarGrid/CalendarGrid.tsx rename to src/views/components/calendar/CalendarGrid/CalendarGrid.tsx diff --git a/src/views/components/common/CalendarGridCell/CalendarGridCell.module.scss b/src/views/components/calendar/CalendarGridCell/CalendarGridCell.module.scss similarity index 100% rename from src/views/components/common/CalendarGridCell/CalendarGridCell.module.scss rename to src/views/components/calendar/CalendarGridCell/CalendarGridCell.module.scss diff --git a/src/views/components/common/CalendarGridCell/CalendarGridCell.tsx b/src/views/components/calendar/CalendarGridCell/CalendarGridCell.tsx similarity index 100% rename from src/views/components/common/CalendarGridCell/CalendarGridCell.tsx rename to src/views/components/calendar/CalendarGridCell/CalendarGridCell.tsx diff --git a/src/views/components/common/CalendarHeader/CalenderHeader.tsx b/src/views/components/calendar/CalendarHeader/CalenderHeader.tsx similarity index 87% rename from src/views/components/common/CalendarHeader/CalenderHeader.tsx rename to src/views/components/calendar/CalendarHeader/CalenderHeader.tsx index 7f11d348..29ba99c3 100644 --- a/src/views/components/common/CalendarHeader/CalenderHeader.tsx +++ b/src/views/components/calendar/CalendarHeader/CalenderHeader.tsx @@ -1,15 +1,15 @@ import React from 'react'; import { Status } from '@shared/types/Course'; -import Divider from '../Divider/Divider'; -import { Button } from '../Button/Button'; -import Text from '../Text/Text'; +import Divider from '../../common/Divider/Divider'; +import { Button } from '../../common/Button/Button'; +import Text from '../../common/Text/Text'; import MenuIcon from '~icons/material-symbols/menu'; import LogoIcon from '~icons/material-symbols/add-circle-outline'; import UndoIcon from '~icons/material-symbols/undo'; import RedoIcon from '~icons/material-symbols/redo'; import SettingsIcon from '~icons/material-symbols/settings'; -import ScheduleTotalHoursAndCourses from '../ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses'; -import CourseStatus from '../CourseStatus/CourseStatus'; +import ScheduleTotalHoursAndCourses from '../../common/ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses'; +import CourseStatus from '../../common/CourseStatus/CourseStatus'; const CalendarHeader = () => (
diff --git a/src/views/components/common/CalendarSchedules/CalendarSchedules.tsx b/src/views/components/calendar/CalendarSchedules/CalendarSchedules.tsx similarity index 82% rename from src/views/components/common/CalendarSchedules/CalendarSchedules.tsx rename to src/views/components/calendar/CalendarSchedules/CalendarSchedules.tsx index f9a84e95..25b74ea7 100644 --- a/src/views/components/common/CalendarSchedules/CalendarSchedules.tsx +++ b/src/views/components/calendar/CalendarSchedules/CalendarSchedules.tsx @@ -1,9 +1,9 @@ import { UserSchedule } from '@shared/types/UserSchedule'; import React, { useState } from 'react'; import AddSchedule from '~icons/material-symbols/add'; -import List from '../List/List'; -import ScheduleListItem from '../ScheduleListItem/ScheduleListItem'; -import Text from '../Text/Text'; +import List from '../../common/List/List'; +import ScheduleListItem from '../../common/ScheduleListItem/ScheduleListItem'; +import Text from '../../common/Text/Text'; export type Props = { style?: React.CSSProperties; @@ -16,7 +16,7 @@ export function CalendarSchedules(props: Props) { const [schedules, setSchedules] = useState(props.dummySchedules || []); const scheduleComponents = schedules.map((schedule, index) => ( - + )); return ( diff --git a/src/views/components/ImportantLinks.tsx b/src/views/components/calendar/ImportantLinks.tsx similarity index 98% rename from src/views/components/ImportantLinks.tsx rename to src/views/components/calendar/ImportantLinks.tsx index f301a54d..a111ab08 100644 --- a/src/views/components/ImportantLinks.tsx +++ b/src/views/components/calendar/ImportantLinks.tsx @@ -1,6 +1,6 @@ import React from 'react'; import clsx from 'clsx'; -import Text from './common/Text/Text'; +import Text from '../common/Text/Text'; import OutwardArrowIcon from '~icons/material-symbols/arrow-outward'; type Props = { diff --git a/src/views/hooks/useFlattenedCourseSchedule.ts b/src/views/hooks/useFlattenedCourseSchedule.ts index da1a3bb3..5b4a6c4a 100644 --- a/src/views/hooks/useFlattenedCourseSchedule.ts +++ b/src/views/hooks/useFlattenedCourseSchedule.ts @@ -1,4 +1,4 @@ -import { CalendarCourseCellProps } from 'src/views/components/common/CalendarCourseCell/CalendarCourseCell'; +import { CalendarCourseCellProps } from 'src/views/components/calendar/CalendarCourseCell/CalendarCourseCell'; import useSchedules from './useSchedules'; const dayToNumber: { [day: string]: number } = { From 11fece0595fb8e54495a9983d2c4f12b683c5d0e Mon Sep 17 00:00:00 2001 From: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Mon, 19 Feb 2024 18:27:06 -0600 Subject: [PATCH 6/7] Merged in finished CalendarGrid --- .../components/CalendarGrid.stories.tsx | 126 +++++++++--- .../CalendarCourseCell/CalendarCourseCell.tsx | 4 +- .../CalendarGrid/CalendarGrid.module.scss | 19 +- .../calendar/CalendarGrid/CalendarGrid.tsx | 188 +++++++++++++----- .../CalendarGridCell.module.scss | 8 +- .../CalendarGridCell/CalendarGridCell.tsx | 16 +- src/views/hooks/useFlattenedCourseSchedule.ts | 3 + 7 files changed, 271 insertions(+), 93 deletions(-) diff --git a/src/stories/components/CalendarGrid.stories.tsx b/src/stories/components/CalendarGrid.stories.tsx index 1e01df74..de7e17f8 100644 --- a/src/stories/components/CalendarGrid.stories.tsx +++ b/src/stories/components/CalendarGrid.stories.tsx @@ -1,8 +1,8 @@ import { Meta, StoryObj } from '@storybook/react'; -import CalendarGrid from 'src/views/components/calendar/CalendarGrid/CalendarGrid'; -import { getCourseColors } from 'src/shared/util/colors'; -import { CalendarGridCourse } from 'src/views/hooks/useFlattenedCourseSchedule'; -import { Status } from 'src/shared/types/Course'; +import CalendarGrid from '@views/components/common/CalendarGrid/CalendarGrid'; +import { getCourseColors } from '@shared/util/colors'; +import { CalendarGridCourse } from '@views/hooks/useFlattenedCourseSchedule'; +import { Status } from '@shared/types/Course'; const meta = { title: 'Components/Common/CalendarGrid', @@ -18,33 +18,97 @@ const meta = { export default meta; const testData: CalendarGridCourse[] = [ - { - calendarGridPoint: { - dayIndex: 0, - startIndex: 1, - endIndex: 2, - }, - componentProps: { - courseDeptAndInstr: 'Course 1', - timeAndLocation: '9:00 AM - 10:00 AM, Room 101', - status: Status.OPEN, - colors: getCourseColors('emerald', 500), - }, - }, - { - calendarGridPoint: { - dayIndex: 1, - startIndex: 2, - endIndex: 3, - }, - componentProps: { - courseDeptAndInstr: 'Course 2', - timeAndLocation: '10:00 AM - 11:00 AM, Room 102', - status: Status.CLOSED, - colors: getCourseColors('emerald', 500), - }, - }, - // add more data as needed + { + calendarGridPoint: { + dayIndex: 4, + startIndex: 10, + endIndex: 11, + }, + componentProps: { + courseDeptAndInstr: 'Course 1', + timeAndLocation: '9:00 AM - 10:00 AM, Room 101', + status: Status.OPEN, + colors: getCourseColors('emerald', 500), + }, + }, + { + calendarGridPoint: { + dayIndex: 2, + startIndex: 5, + endIndex: 6, + }, + componentProps: { + courseDeptAndInstr: 'Course 1', + timeAndLocation: '9:00 AM - 10:00 AM, Room 101', + status: Status.OPEN, + colors: getCourseColors('emerald', 500), + }, + }, + { + calendarGridPoint: { + dayIndex: 1, + startIndex: 10, + endIndex: 12, + }, + componentProps: { + courseDeptAndInstr: 'Course 2', + timeAndLocation: '10:00 AM - 11:00 AM, Room 102', + status: Status.CLOSED, + colors: getCourseColors('emerald', 500), + }, + }, + { + calendarGridPoint: { + dayIndex: 4, + startIndex: 10, + endIndex: 11, + }, + componentProps: { + courseDeptAndInstr: 'Course 1', + timeAndLocation: '9:00 AM - 10:00 AM, Room 101', + status: Status.OPEN, + colors: getCourseColors('emerald', 500), + }, + }, + { + calendarGridPoint: { + dayIndex: 1, + startIndex: 10, + endIndex: 12, + }, + componentProps: { + courseDeptAndInstr: 'Course 2', + timeAndLocation: '10:00 AM - 11:00 AM, Room 102', + status: Status.CLOSED, + colors: getCourseColors('emerald', 500), + }, + }, + { + calendarGridPoint: { + dayIndex: 1, + startIndex: 10, + endIndex: 12, + }, + componentProps: { + courseDeptAndInstr: 'Course 3', + timeAndLocation: '10:00 AM - 11:00 AM, Room 102', + status: Status.CLOSED, + colors: getCourseColors('emerald', 500), + }, + }, + { + calendarGridPoint: { + dayIndex: 1, + startIndex: 10, + endIndex: 12, + }, + componentProps: { + courseDeptAndInstr: 'Course 4', + timeAndLocation: '10:00 AM - 11:00 AM, Room 102', + status: Status.CLOSED, + colors: getCourseColors('emerald', 500), + }, + }, ]; type Story = StoryObj; diff --git a/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx b/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx index da9db25f..fc05fc03 100644 --- a/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx +++ b/src/views/components/calendar/CalendarCourseCell/CalendarCourseCell.tsx @@ -36,12 +36,12 @@ const CalendarCourseCell: React.FC = ({ return (
-
+
!['S', 'SU'].includes(key)); +/* const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key)); const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8); const grid = []; for (let i = 0; i < 13; i++) { @@ -23,7 +24,7 @@ for (let i = 0; i < 13; i++) { ); row.push(Array.from({ length: 5 }, (_, j) => )); grid.push(row); -} +} */ interface Props { courseCells: CalendarGridCourse[]; @@ -35,9 +36,13 @@ interface Props { * @param props */ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren): JSX.Element { + const [grid, setGrid] = useState([]); const calendarRef = useRef(null); // Create a ref for the calendar grid - const saveAsPNG = () => { + const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key)); + const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8); + + /* const saveAsPNG = () => { htmlToImage .toPng(calendarRef.current, { backgroundColor: 'white', @@ -68,23 +73,47 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren { console.error('oops, something went wrong!', error); }); - }; + }; */ + + 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')}

+
+
+ ); + for (let k = 0; k < 5; k++) { + // let shouldRender = false; + styleProp = { + gridColumn: `${k + 2}`, + gridRow: `${2 * i + 2} / ${2 * i + 4}`, + }; + /* let shouldRenderChild = courseCells[iterator]?.calendarGridPoint && + k === courseCells[iterator].calendarGridPoint.dayIndex && i === courseCells[iterator].calendarGridPoint.startIndex; + let childElement =
; */ + /* let completeGridCell = shouldRenderChild ? + : ; */ + row.push(); + } + newGrid.push(row); + } + setGrid(newGrid); + }, []); return (
{/* Displaying the rest of the calendar */} -
- {/*
-
- {hoursOfDay.map((hour) => ( -
-
-

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

-
-
- ))} -
*/} +
{/* Displaying day labels */}
@@ -93,40 +122,103 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren ))} - {grid.map((row, index) => ( - {row} - ))} + {grid.map((row, rowIndex) => row)} + {accountForCourseConflicts(courseCells)} + {/* courseCells.map((block: CalendarGridCourse) => ( +
+ +
+ )) */}
- {courseCells.map((block: CalendarGridCourse) => ( -
- -
- ))} -
-
{/* First divider */} - -
{/* Second divider */} - -
); } export default CalendarGrid; + +function accountForCourseConflicts(courseCells: CalendarGridCourse[]): JSX.Element[] { + // Groups by dayIndex to identify overlaps + const days = courseCells.reduce((acc, cell: CalendarGridCourse) => { + const { dayIndex } = cell.calendarGridPoint; + if (!acc[dayIndex]) { + acc[dayIndex] = []; + } + acc[dayIndex].push(cell); + return acc; + }, {}); + + // Check for overlaps within each day and adjust gridColumnIndex and totalColumns + Object.values(days).forEach((dayCells: CalendarGridCourse[]) => { + // Sort by start time to ensure proper columnIndex assignment + dayCells.sort((a, b) => a.calendarGridPoint.startIndex - b.calendarGridPoint.startIndex); + + dayCells.forEach((cell, _, arr) => { + let columnIndex = 1; + cell.totalColumns = 1; + // Check for overlaps and adjust columnIndex as needed + for (let otherCell of arr) { + if (otherCell !== cell) { + const isOverlapping = + otherCell.calendarGridPoint.startIndex < cell.calendarGridPoint.endIndex && + otherCell.calendarGridPoint.endIndex > cell.calendarGridPoint.startIndex; + if (isOverlapping) { + console.log('Found overlapping element'); + // Adjust columnIndex to not overlap with the otherCell + if (otherCell.gridColumnStart && otherCell.gridColumnStart >= columnIndex) { + columnIndex = otherCell.gridColumnStart + 1; + console.log(columnIndex); + } + cell.totalColumns += 1; + } + } + } + cell.gridColumnStart = columnIndex; + cell.gridColumnEnd = columnIndex + 1; + }); + }); + + return courseCells.map(block => ( +
+ +
+ )); +} + +/*
+
+ +
+ +
*/ diff --git a/src/views/components/calendar/CalendarGridCell/CalendarGridCell.module.scss b/src/views/components/calendar/CalendarGridCell/CalendarGridCell.module.scss index b34ddb32..639c8fbb 100644 --- a/src/views/components/calendar/CalendarGridCell/CalendarGridCell.module.scss +++ b/src/views/components/calendar/CalendarGridCell/CalendarGridCell.module.scss @@ -1,7 +1,7 @@ .calendarCell { display: flex; - width: 213.8px; - height: 44.769px; + width: 100%; + height: 100%; min-width: 45px; min-height: 40px; flex-direction: column; @@ -11,8 +11,8 @@ } .hourLine { - width: 213.8px; + width: 100%; height: 1px; - border-radius: var(--border-radius-none, 0px); + border-radius: 0px; background: rgba(218, 220, 224, 0.25); } diff --git a/src/views/components/calendar/CalendarGridCell/CalendarGridCell.tsx b/src/views/components/calendar/CalendarGridCell/CalendarGridCell.tsx index 600a5712..77c35553 100644 --- a/src/views/components/calendar/CalendarGridCell/CalendarGridCell.tsx +++ b/src/views/components/calendar/CalendarGridCell/CalendarGridCell.tsx @@ -1,14 +1,20 @@ import React from 'react'; import styles from './CalendarGridCell.module.scss'; +interface Props { + styleProp: any; +} + /** * Component representing each 1 hour time block of a calendar * @param props */ -const CalendarCell: React.FC = props => ( -
-
-
-); +function CalendarCell({ styleProp }: Props): JSX.Element { + return ( +
+
+
+ ); +} export default CalendarCell; diff --git a/src/views/hooks/useFlattenedCourseSchedule.ts b/src/views/hooks/useFlattenedCourseSchedule.ts index 5b4a6c4a..fea3d400 100644 --- a/src/views/hooks/useFlattenedCourseSchedule.ts +++ b/src/views/hooks/useFlattenedCourseSchedule.ts @@ -21,6 +21,9 @@ interface CalendarGridPoint { export interface CalendarGridCourse { calendarGridPoint: CalendarGridPoint; componentProps: CalendarCourseCellProps; + gridColumnStart?: number; + gridColumnEnd?: number; + totalColumns?: number; } const convertMinutesToIndex = (minutes: number): number => Math.floor(minutes - 420 / 30); From 41e6d77d026d2e13342febe8ac5b4c9828af1c56 Mon Sep 17 00:00:00 2001 From: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Mon, 19 Feb 2024 18:34:42 -0600 Subject: [PATCH 7/7] Fixed import error --- src/stories/components/CalendarGrid.stories.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stories/components/CalendarGrid.stories.tsx b/src/stories/components/CalendarGrid.stories.tsx index de7e17f8..761c4dbc 100644 --- a/src/stories/components/CalendarGrid.stories.tsx +++ b/src/stories/components/CalendarGrid.stories.tsx @@ -1,5 +1,5 @@ import { Meta, StoryObj } from '@storybook/react'; -import CalendarGrid from '@views/components/common/CalendarGrid/CalendarGrid'; +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';