Compare commits

...

7 Commits

Author SHA1 Message Date
knownotunknown
1506a19b61 PopupMain UI integrated 2024-02-19 11:51:51 -06:00
knownotunknown
ed039d4206 Merge remote-tracking branch 'origin/PopupMain' into Popup 2024-02-19 11:45:14 -06:00
knownotunknown
009b7c742a Merge remote-tracking branch 'origin/derek-vinson/build-errors' into Popup 2024-02-19 00:37:07 -06:00
Casey Charleston
357e041f05 Scuffed popup 2024-02-17 21:58:23 -06:00
697e81b7c2 Safely commenting it out 2024-02-17 17:42:48 -06:00
f0329f33aa Idk why this is erroring out 2024-02-17 17:22:39 -06:00
vivek12311
ff4ee494b6 Using React-icons. Probably need to take out later 2024-02-17 16:03:28 -06:00
13 changed files with 213 additions and 50 deletions

9
package-lock.json generated
View File

@@ -19,6 +19,7 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-devtools-core": "^5.0.0", "react-devtools-core": "^5.0.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"react-window": "^1.8.10", "react-window": "^1.8.10",
"sass": "^1.70.0", "sass": "^1.70.0",
"sql.js": "1.10.2", "sql.js": "1.10.2",
@@ -20112,6 +20113,14 @@
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==",
"dev": true "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": { "node_modules/react-is": {
"version": "16.13.1", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",

View File

@@ -30,6 +30,7 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-devtools-core": "^5.0.0", "react-devtools-core": "^5.0.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"react-window": "^1.8.10", "react-window": "^1.8.10",
"sass": "^1.70.0", "sass": "^1.70.0",
"sql.js": "1.10.2", "sql.js": "1.10.2",

11
pnpm-lock.yaml generated
View File

@@ -52,6 +52,9 @@ dependencies:
react-dom: react-dom:
specifier: ^18.2.0 specifier: ^18.2.0
version: 18.2.0(react@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: react-window:
specifier: ^1.8.10 specifier: ^1.8.10
version: 1.8.10(react-dom@18.2.0)(react@18.2.0) version: 1.8.10(react-dom@18.2.0)(react@18.2.0)
@@ -11321,6 +11324,14 @@ packages:
resolution: {integrity: sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==} resolution: {integrity: sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==}
dev: true 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: /react-is@16.13.1:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -14,6 +14,7 @@ export default async function createSchedule(scheduleName: string): Promise<stri
schedules.push({ schedules.push({
name: scheduleName, name: scheduleName,
courses: [], courses: [],
hours: 0
}); });
await UserScheduleStore.set('schedules', schedules); await UserScheduleStore.set('schedules', schedules);

View File

@@ -14,6 +14,7 @@ export const UserScheduleStore = createLocalStore<IUserScheduleStore>({
new UserSchedule({ new UserSchedule({
courses: [], courses: [],
name: 'Schedule 1', name: 'Schedule 1',
hours: 0,
}), }),
], ],
activeIndex: 0, activeIndex: 0,

View File

@@ -13,11 +13,10 @@ const meta = {
}, },
tags: ['autodocs'], tags: ['autodocs'],
argTypes: { argTypes: {
department: { control: { type: 'text' } }, courseDeptAndInstr: { control: { type: 'text' } },
courseNumber: { control: { type: 'text' } }, className: { control: { type: 'text' } },
instructorLastName: { control: { type: 'text' } },
status: { control: { type: 'select', options: Object.values(Status) } }, status: { control: { type: 'select', options: Object.values(Status) } },
meetingTime: { control: { type: 'text' } }, timeAndLocation: { control: { type: 'text' } },
colors: { control: { type: 'object' } }, colors: { control: { type: 'object' } },
}, },
render: (args: any) => ( render: (args: any) => (
@@ -26,11 +25,10 @@ const meta = {
</div> </div>
), ),
args: { args: {
department: exampleCourse.department, courseDeptAndInstr: exampleCourse.department,
courseNumber: exampleCourse.number, className: exampleCourse.number,
instructorLastName: exampleCourse.instructors[0].lastName,
status: exampleCourse.status, status: exampleCourse.status,
meetingTime: exampleCourse.schedule.meetings[0].getTimeString({ separator: '-' }), timeAndLocation: exampleCourse.schedule.meetings[0].getTimeString({ separator: '-' }),
colors: getCourseColors('emerald', 500), colors: getCourseColors('emerald', 500),
}, },
@@ -46,22 +44,69 @@ export const Variants: Story = {
<div className='grid grid-cols-2 h-40 max-w-60 w-90vw gap-x-4 gap-y-2'> <div className='grid grid-cols-2 h-40 max-w-60 w-90vw gap-x-4 gap-y-2'>
<CalendarCourseCell <CalendarCourseCell
{...props} {...props}
course={new Course({ ...exampleCourse, status: Status.OPEN })} // course={new Course({ ...exampleCourse, status: Status.OPEN })}
// 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/',
// });
colors={getCourseColors('green', 500)} colors={getCourseColors('green', 500)}
/> />
<CalendarCourseCell <CalendarCourseCell
{...props} {...props}
course={new Course({ ...exampleCourse, status: Status.CLOSED })} // course={new Course({ ...exampleCourse, status: Status.CLOSED })}
colors={getCourseColors('teal', 400)} colors={getCourseColors('teal', 400)}
/> />
<CalendarCourseCell <CalendarCourseCell
{...props} {...props}
course={new Course({ ...exampleCourse, status: Status.WAITLISTED })} // course={new Course({ ...exampleCourse, status: Status.WAITLISTED })}
colors={getCourseColors('indigo', 400)} colors={getCourseColors('indigo', 400)}
/> />
<CalendarCourseCell <CalendarCourseCell
{...props} {...props}
course={new Course({ ...exampleCourse, status: Status.CANCELLED })} // course={new Course({ ...exampleCourse, status: Status.CANCELLED })}
colors={getCourseColors('red', 500)} colors={getCourseColors('red', 500)}
/> />
</div> </div>

View File

@@ -9,7 +9,7 @@ import { test_colors } from './PopupCourseBlock.stories';
const numberOfCourses = 5; const numberOfCourses = 5;
const generateCourses = count => { export const generateCourses = count => {
const courses = []; const courses = [];
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
@@ -64,7 +64,7 @@ const generateCourses = count => {
const exampleCourses = generateCourses(numberOfCourses); const exampleCourses = generateCourses(numberOfCourses);
const generateCourseBlocks = (exampleCourses, colors) => const generateCourseBlocks = (exampleCourses, colors) =>
exampleCourses.map((course, i) => <PopupCourseBlock key={course.uniqueId} course={course} colors={colors[i]} />); exampleCourses.map((course, i) => <PopupCourseBlock key={course.uniqueId} course={course} colors={colors[i]} />);
const exampleCourseBlocks = generateCourseBlocks(exampleCourses, test_colors); export const exampleCourseBlocks = generateCourseBlocks(exampleCourses, test_colors);
const meta = { const meta = {
title: 'Components/Common/List', title: 'Components/Common/List',

View File

@@ -0,0 +1,23 @@
import { Meta, StoryObj } from '@storybook/react';
import PopupMain from '@views/components/PopupMain';
const meta = {
title: 'Components/Common/PopupMain',
component: PopupMain,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
},
} satisfies Meta<typeof PopupMain>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
},
};

View File

@@ -57,6 +57,7 @@ const exampleCourse: Course = new Course({
const exampleSchedule: UserSchedule = new UserSchedule({ const exampleSchedule: UserSchedule = new UserSchedule({
courses: [exampleCourse], courses: [exampleCourse],
name: 'Example Schedule', name: 'Example Schedule',
hours: 0,
}); });
const meta = { const meta = {
@@ -96,6 +97,7 @@ export const Open: Story = {
activeSchedule: new UserSchedule({ activeSchedule: new UserSchedule({
courses: [], courses: [],
name: 'Example Schedule', name: 'Example Schedule',
hours: 0,
}), }),
}, },
}; };

View File

@@ -1,24 +1,99 @@
import { background } from '@shared/messages';
import React from 'react'; import React from 'react';
import useSchedules from '../hooks/useSchedules'; import { FaCalendarAlt, FaCog, FaRedo } from 'react-icons/fa'; // Added FaRedo for the refresh icon
import { Button } from './common/Button/Button'; import { StatusIcon } from '@shared/util/icons';
import ExtensionRoot from './common/ExtensionRoot/ExtensionRoot'; 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() { export default function PopupMain() {
const [activeSchedule, schedules] = useSchedules(); const courses = generateCourses(5);
// 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) => (
<PopupCourseBlock
key={course.uniqueId}
course={course}
colors={colors[course.status]}
/>
));
// TODO: Add a button to to switch the active schedule
return ( return (
<ExtensionRoot> <ExtensionRoot>
<Button <div className="p-4 bg-white max-w-sm mx-auto rounded-lg shadow-md">
onClick={() => { <div className="mb-2 flex items-center justify-between bg-white">
if (!activeSchedule) return; <div className="flex items-center">
background.clearCourses({ scheduleName: activeSchedule?.name }); <img src={logoImage} alt="Logo" style={{ width: '40px', height: '40px', marginRight: '8px' }} />
}} <div>
> <Text as="div" variant="h1-course" style={{ color: '#bf5700', fontSize: '1.3rem' }}>UT Registration</Text>
Clear Courses <Text as="div" variant="h1-course" style={{ color: '#f8971f', fontSize: '1.3rem' }}>Plus</Text>
</Button> </div>
</div>
<div className="flex items-center">
<button style={{ backgroundColor: '#bf5700', borderRadius: '8px', padding: '8px' }}>
<FaCalendarAlt color="white" />
</button>
<button style={{ backgroundColor: 'white', marginLeft: '10px', borderRadius: '8px', padding: '8px', boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)' }}>
<FaCog color="#C05621" />
</button>
</div>
</div>
<Divider color="#E2E8F0" type="solid" style={{ margin: '1rem 0' }} />
<div className="mb-4 p-2 bg-white text-left rounded-lg shadow-inner" style={{ backgroundColor: 'white', border: '1px solid #FBD38D', borderRadius: '0.5rem' }}>
<Text as="div" variant="h2-course" style={{ color: '#DD6B20', fontSize: '1.2rem' }}>MAIN SCHEDULE:</Text>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'start', color: '#333f48' }}>
<Text as="div" variant="h1" style={{ fontSize: '1.2rem', fontWeight: 'bold', marginRight: '0.5rem' }}>22 HOURS</Text>
<Text as="div" variant="h2-course" style={{ fontSize: '1.2rem' }}>8 Courses</Text>
</div>
</div>
{/* Integrate the List component here */}
<List
draggableElements={draggableElements}
itemHeight={100} // Adjust based on your content size
listHeight={500} // Adjust based on total height you want for the list
listWidth={350} // Adjust based on your layout/design
gap={12} // Spacing between items
/>
<div className="mt-4 p-4 border-t border-gray-200 flex justify-between text-xs">
<div className="flex items-center">
<div style={{ backgroundColor: '#6B7280', padding: '1px', borderRadius: '4px', marginRight: '3px', marginLeft: '8px' }}>
<StatusIcon status="WAITLISTED" className="text-white h-5 w-5" />
</div>
<Text as="span" variant="mini">WAITLISTED</Text>
</div>
<div className="flex items-center">
<div style={{ backgroundColor: '#6B7280', padding: '1px', borderRadius: '4px', marginRight: '3px', marginLeft: '8px' }}>
<StatusIcon status="CLOSED" className="text-white h-5 w-5" />
</div>
<Text as="span" variant="mini">CLOSED</Text>
</div>
<div className="flex items-center">
<div style={{ backgroundColor: '#6B7280', padding: '1px', borderRadius: '4px', marginRight: '3px', marginLeft: '8px' }}>
<StatusIcon status="CANCELLED" className="text-white h-5 w-5" />
</div>
<Text as="span" variant="mini">CANCELLED</Text>
</div>
</div>
<div className="mt-2 text-center text-xs">
<div className="inline-flex items-center justify-center">
<Text as="div" variant="mini">DATA UPDATED ON: 12:00 AM 02/01/2024</Text>
<FaRedo className="text-gray-600 h-4 w-4 ml-2" />
</div>
</div>
</div>
</ExtensionRoot> </ExtensionRoot>
); );
} }

View File

@@ -1,11 +1,11 @@
import { background } from '@shared/messages'; import { background } from '@shared/messages';
import { Course } from '@shared/types/Course'; import { Course } from '@shared/types/Course';
import { UserSchedule } from '@shared/types/UserSchedule'; import { UserSchedule } from '@shared/types/UserSchedule';
import React from 'react';
import { Button } from '@views/components/common/Button/Button'; import { Button } from '@views/components/common/Button/Button';
import Card from '@views/components/common/Card/Card'; import Card from '@views/components/common/Card/Card';
import Icon from '@views/components/common/Icon/Icon'; import Icon from '@views/components/common/Icon/Icon';
import Text from '@views/components/common/Text/Text'; import Text from '@views/components/common/Text/Text';
import React from 'react';
import styles from './CourseButtons.module.scss'; import styles from './CourseButtons.module.scss';
type Props = { type Props = {
@@ -83,48 +83,43 @@ export default function CourseButtons({ course, activeSchedule }: Props) {
<Button <Button
onClick={openRateMyProfessorURL} onClick={openRateMyProfessorURL}
disabled={!course.instructors.length} disabled={!course.instructors.length}
variant='primary' variant='filled'
className={styles.button} className={styles.button}
color='ut-black'
title='Search for this professor on RateMyProfessor' title='Search for this professor on RateMyProfessor'
> >
<Text /* size='medium' weight='regular' */color='white'> <Text /* size='medium' weight='regular' */ color='white'>RateMyProf</Text>
RateMyProf
</Text>
<Icon className={styles.icon} color='white' name='school' size='medium' /> <Icon className={styles.icon} color='white' name='school' size='medium' />
</Button> </Button>
<Button <Button
onClick={openSyllabiURL} onClick={openSyllabiURL}
variant='secondary' variant='filled'
className={styles.button} className={styles.button}
color='ut-black'
title='Search for syllabi for this course' title='Search for syllabi for this course'
> >
<Text /* size='medium' weight='regular' */ color='white'> <Text /* size='medium' weight='regular' */ color='white'>Syllabi</Text>
Syllabi
</Text>
<Icon className={styles.icon} color='white' name='grading' size='medium' /> <Icon className={styles.icon} color='white' name='grading' size='medium' />
</Button> </Button>
<Button <Button
onClick={openTextbookURL} onClick={openTextbookURL}
variant='tertiary' variant='filled'
className={styles.button} className={styles.button}
color='ut-black'
title='Search for textbooks for this course' title='Search for textbooks for this course'
> >
<Text /* size='medium' weight='regular' color='white' */> <Text /* size='medium' weight='regular' color='white' */>Textbook</Text>
Textbook
</Text>
<Icon className={styles.icon} color='white' name='collections_bookmark' size='medium' /> <Icon className={styles.icon} color='white' name='collections_bookmark' size='medium' />
</Button> </Button>
<Button <Button
disabled={!activeSchedule} disabled={!activeSchedule}
onClick={isCourseSaved ? handleRemoveCourse : handleSaveCourse} onClick={isCourseSaved ? handleRemoveCourse : handleSaveCourse}
title={isCourseSaved ? 'Remove this course from your schedule' : 'Add this course to your schedule'} title={isCourseSaved ? 'Remove this course from your schedule' : 'Add this course to your schedule'}
variant={isCourseSaved ? 'danger' : 'success'} variant='filled'
className={styles.button} className={styles.button}
color='ut-black'
> >
<Text /* size='medium' weight='regular' color='white' */>{isCourseSaved ? 'Remove' : 'Add'}</Text>
<Text /* size='medium' weight='regular' color='white' */ >
{isCourseSaved ? 'Remove' : 'Add'}
</Text>
<Icon className={styles.icon} color='white' name={isCourseSaved ? 'remove' : 'add'} size='medium' /> <Icon className={styles.icon} color='white' name={isCourseSaved ? 'remove' : 'add'} size='medium' />
</Button> </Button>
</Card> </Card>

View File

@@ -84,7 +84,7 @@ export default function TableRow({ row, isSelected, activeSchedule, onClick }: P
return ReactDOM.createPortal( return ReactDOM.createPortal(
<> <>
<Button className={styles.rowButton} onClick={onClick} variant='secondary'> <Button className={styles.rowButton} onClick={onClick} variant='filled' color='ut-black'>
<Icon name='bar_chart' color='white' size='medium' /> <Icon name='bar_chart' color='white' size='medium' />
</Button> </Button>
{conflicts.length > 0 && ( {conflicts.length > 0 && (