fix: build errors and merge in Casey's branch (driodiwb)
This commit is contained in:
@@ -14,6 +14,7 @@ export default async function createSchedule(scheduleName: string): Promise<stri
|
||||
schedules.push({
|
||||
name: scheduleName,
|
||||
courses: [],
|
||||
hours: 0
|
||||
});
|
||||
|
||||
await UserScheduleStore.set('schedules', schedules);
|
||||
|
||||
@@ -14,6 +14,7 @@ export const UserScheduleStore = createLocalStore<IUserScheduleStore>({
|
||||
new UserSchedule({
|
||||
courses: [],
|
||||
name: 'Schedule 1',
|
||||
hours: 0,
|
||||
}),
|
||||
],
|
||||
activeIndex: 0,
|
||||
|
||||
@@ -7,13 +7,18 @@ import { Course } from './Course';
|
||||
export class UserSchedule {
|
||||
courses: Course[];
|
||||
name: string;
|
||||
hours: number;
|
||||
|
||||
constructor(schedule: Serialized<UserSchedule>) {
|
||||
this.courses = schedule.courses.map(c => new Course(c));
|
||||
this.name = schedule.name;
|
||||
this.hours = 0;
|
||||
for (const course of this.courses) {
|
||||
this.hours += course.creditHours;
|
||||
}
|
||||
}
|
||||
|
||||
containsCourse(course: Course): boolean {
|
||||
return this.courses.some(c => c.uniqueId === course.uniqueId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,10 @@ const meta = {
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
department: { control: { type: 'text' } },
|
||||
courseNumber: { control: { type: 'text' } },
|
||||
instructorLastName: { control: { type: 'text' } },
|
||||
courseDeptAndInstr: { control: { type: 'text' } },
|
||||
className: { control: { type: 'text' } },
|
||||
status: { control: { type: 'select', options: Object.values(Status) } },
|
||||
meetingTime: { control: { type: 'text' } },
|
||||
timeAndLocation: { control: { type: 'text' } },
|
||||
colors: { control: { type: 'object' } },
|
||||
},
|
||||
render: (args: any) => (
|
||||
@@ -26,11 +25,10 @@ const meta = {
|
||||
</div>
|
||||
),
|
||||
args: {
|
||||
department: exampleCourse.department,
|
||||
courseNumber: exampleCourse.number,
|
||||
instructorLastName: exampleCourse.instructors[0].lastName,
|
||||
courseDeptAndInstr: exampleCourse.department,
|
||||
className: exampleCourse.number,
|
||||
status: exampleCourse.status,
|
||||
meetingTime: exampleCourse.schedule.meetings[0].getTimeString({ separator: '-' }),
|
||||
timeAndLocation: exampleCourse.schedule.meetings[0].getTimeString({ separator: '-' }),
|
||||
|
||||
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'>
|
||||
<CalendarCourseCell
|
||||
{...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)}
|
||||
/>
|
||||
<CalendarCourseCell
|
||||
{...props}
|
||||
course={new Course({ ...exampleCourse, status: Status.CLOSED })}
|
||||
// course={new Course({ ...exampleCourse, status: Status.CLOSED })}
|
||||
colors={getCourseColors('teal', 400)}
|
||||
/>
|
||||
<CalendarCourseCell
|
||||
{...props}
|
||||
course={new Course({ ...exampleCourse, status: Status.WAITLISTED })}
|
||||
// course={new Course({ ...exampleCourse, status: Status.WAITLISTED })}
|
||||
colors={getCourseColors('indigo', 400)}
|
||||
/>
|
||||
<CalendarCourseCell
|
||||
{...props}
|
||||
course={new Course({ ...exampleCourse, status: Status.CANCELLED })}
|
||||
// course={new Course({ ...exampleCourse, status: Status.CANCELLED })}
|
||||
colors={getCourseColors('red', 500)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,7 @@ const meta = {
|
||||
argTypes: {
|
||||
dummySchedules: { control: 'object' },
|
||||
dummyActiveIndex: { control: 'number' },
|
||||
|
||||
},
|
||||
render: (args: any) => (
|
||||
<div>
|
||||
@@ -64,6 +65,7 @@ const schedules = [
|
||||
}),
|
||||
],
|
||||
name: 'Main Schedule',
|
||||
hours: 0, // Add the missing 'hours' property
|
||||
}),
|
||||
new UserSchedule({
|
||||
courses: [
|
||||
@@ -131,6 +133,7 @@ const schedules = [
|
||||
}),
|
||||
],
|
||||
name: 'Backup #3',
|
||||
hours: 0, // Add the missing 'hours' property
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -138,5 +141,6 @@ export const Default: Story = {
|
||||
args: {
|
||||
dummySchedules: schedules,
|
||||
dummyActiveIndex: 0,
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
157
src/stories/components/Dropdown.stories.tsx
Normal file
157
src/stories/components/Dropdown.stories.tsx
Normal file
@@ -0,0 +1,157 @@
|
||||
import { Course, Status } from '@shared/types/Course';
|
||||
import { UserSchedule } from '@shared/types/UserSchedule';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Serialized } from 'chrome-extension-toolkit';
|
||||
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 Dropdown from 'src/views/components/common/Dropdown/Dropdown';
|
||||
import ScheduleListItem from 'src/views/components/common/ScheduleListItem/ScheduleListItem';
|
||||
|
||||
const meta: Meta<typeof Dropdown> = {
|
||||
title: 'Components/Common/Dropdown',
|
||||
component: Dropdown,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
dummySchedules: { control: 'object' },
|
||||
dummyActiveIndex: { control: 'number' },
|
||||
scheduleComponents: { control: 'object' },
|
||||
},
|
||||
render: (args: any) => (
|
||||
<div className='w-80'>
|
||||
<Dropdown {...args} />
|
||||
</div>
|
||||
),
|
||||
} satisfies Meta<typeof Dropdown>;
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
const schedules = [
|
||||
new UserSchedule({
|
||||
courses: [
|
||||
new Course({
|
||||
uniqueId: 123,
|
||||
number: '311C',
|
||||
fullName: "311C - Bevo's Default Course",
|
||||
courseName: "Bevo's Default Course",
|
||||
department: 'BVO',
|
||||
creditHours: 3,
|
||||
status: Status.WAITLISTED,
|
||||
instructors: [new Instructor({ firstName: '', lastName: 'Bevo', fullName: 'Bevo' })],
|
||||
isReserved: false,
|
||||
url: '',
|
||||
flags: [],
|
||||
schedule: new CourseSchedule({
|
||||
meetings: [
|
||||
new CourseMeeting({
|
||||
days: [DAY_MAP.M, DAY_MAP.W, DAY_MAP.F],
|
||||
startTime: 480,
|
||||
endTime: 570,
|
||||
location: {
|
||||
building: 'UTC',
|
||||
room: '123',
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
instructionMode: 'In Person',
|
||||
semester: {
|
||||
year: 2024,
|
||||
season: 'Fall',
|
||||
},
|
||||
}),
|
||||
],
|
||||
name: 'Main Schedule',
|
||||
hours: 0,
|
||||
} as Serialized<UserSchedule>),
|
||||
new UserSchedule({
|
||||
courses: [
|
||||
new Course({
|
||||
uniqueId: 123,
|
||||
number: '311C',
|
||||
fullName: "311C - Bevo's Default Course",
|
||||
courseName: "Bevo's Default Course",
|
||||
department: 'BVO',
|
||||
creditHours: 3,
|
||||
status: Status.WAITLISTED,
|
||||
instructors: [new Instructor({ firstName: '', lastName: 'Bevo', fullName: 'Bevo' })],
|
||||
isReserved: false,
|
||||
url: '',
|
||||
flags: [],
|
||||
schedule: new CourseSchedule({
|
||||
meetings: [
|
||||
new CourseMeeting({
|
||||
days: [DAY_MAP.M, DAY_MAP.W, DAY_MAP.F],
|
||||
startTime: 480,
|
||||
endTime: 570,
|
||||
location: {
|
||||
building: 'UTC',
|
||||
room: '123',
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
instructionMode: 'In Person',
|
||||
semester: {
|
||||
year: 2024,
|
||||
season: 'Fall',
|
||||
},
|
||||
}),
|
||||
new Course({
|
||||
uniqueId: 123,
|
||||
number: '311C',
|
||||
fullName: "311C - Bevo's Default Course",
|
||||
courseName: "Bevo's Default Course",
|
||||
department: 'BVO',
|
||||
creditHours: 3,
|
||||
status: Status.WAITLISTED,
|
||||
instructors: [new Instructor({ firstName: '', lastName: 'Bevo', fullName: 'Bevo' })],
|
||||
isReserved: false,
|
||||
url: '',
|
||||
flags: [],
|
||||
schedule: new CourseSchedule({
|
||||
meetings: [
|
||||
new CourseMeeting({
|
||||
days: [DAY_MAP.M, DAY_MAP.W, DAY_MAP.F],
|
||||
startTime: 480,
|
||||
endTime: 570,
|
||||
location: {
|
||||
building: 'UTC',
|
||||
room: '123',
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
instructionMode: 'In Person',
|
||||
semester: {
|
||||
year: 2024,
|
||||
season: 'Fall',
|
||||
},
|
||||
}),
|
||||
],
|
||||
name: 'Backup #3',
|
||||
hours: 0,
|
||||
} as Serialized<UserSchedule>),
|
||||
];
|
||||
|
||||
export const Hidden: Story = {
|
||||
parameters: {
|
||||
design: {
|
||||
type: 'figma',
|
||||
url: 'https://www.figma.com/file/8tsCay2FRqctrdcZ3r9Ahw/UTRP?type=design&node-id=1579-5083&mode=dev',
|
||||
},
|
||||
},
|
||||
|
||||
args: {
|
||||
dummySchedules: schedules,
|
||||
dummyActiveIndex: 0,
|
||||
scheduleComponents: schedules.map((schedule, index) => (
|
||||
<ScheduleListItem active={index === 0} name={schedule.name} />
|
||||
)),
|
||||
},
|
||||
};
|
||||
@@ -9,7 +9,7 @@ import { test_colors } from './PopupCourseBlock.stories';
|
||||
|
||||
const numberOfCourses = 5;
|
||||
|
||||
const generateCourses = count => {
|
||||
export const generateCourses = count => {
|
||||
const courses = [];
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
@@ -64,7 +64,7 @@ const generateCourses = count => {
|
||||
const exampleCourses = generateCourses(numberOfCourses);
|
||||
const generateCourseBlocks = (exampleCourses, colors) =>
|
||||
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 = {
|
||||
title: 'Components/Common/List',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import PopupMain from 'src/views/components/PopupMain';
|
||||
import PopupMain from '@views/components/PopupMain';
|
||||
|
||||
const meta = {
|
||||
title: 'Components/Common/PopupMain',
|
||||
|
||||
@@ -57,6 +57,7 @@ const exampleCourse: Course = new Course({
|
||||
const exampleSchedule: UserSchedule = new UserSchedule({
|
||||
courses: [exampleCourse],
|
||||
name: 'Example Schedule',
|
||||
hours: 0,
|
||||
});
|
||||
|
||||
const meta = {
|
||||
@@ -96,6 +97,7 @@ export const Open: Story = {
|
||||
activeSchedule: new UserSchedule({
|
||||
courses: [],
|
||||
name: 'Example Schedule',
|
||||
hours: 0,
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -7,47 +7,10 @@ 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 = [
|
||||
{
|
||||
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',
|
||||
},
|
||||
];
|
||||
const courses = generateCourses(5);
|
||||
|
||||
|
||||
// Manually applying colors for the demonstration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UserSchedule } from '@shared/types/UserSchedule';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import AddSchedule from '~icons/material-symbols/add';
|
||||
import List from '../List/List';
|
||||
import ScheduleListItem from '../ScheduleListItem/ScheduleListItem';
|
||||
@@ -15,13 +15,8 @@ export function CalendarSchedules(props: Props) {
|
||||
const [activeScheduleIndex, setActiveScheduleIndex] = useState(props.dummyActiveIndex || 0);
|
||||
const [schedules, setSchedules] = useState(props.dummySchedules || []);
|
||||
|
||||
let scheduleComponents = schedules.map((schedule, index) => (
|
||||
<div onClick={() => setActiveScheduleIndex(index)}>
|
||||
<ScheduleListItem
|
||||
active={index === activeScheduleIndex}
|
||||
name={schedule.name}
|
||||
/>
|
||||
</div>
|
||||
const scheduleComponents = schedules.map((schedule, index) => (
|
||||
<ScheduleListItem active={index === activeScheduleIndex} name={schedule.name} />
|
||||
));
|
||||
|
||||
return (
|
||||
@@ -35,7 +30,7 @@ export function CalendarSchedules(props: Props) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<List gap={10} draggableElements={scheduleComponents} itemHeight={30} listHeight={0} listWidth={240} />
|
||||
<List gap={10} draggableElements={scheduleComponents} itemHeight={30} listHeight={30} listWidth={240} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
110
src/views/components/common/Dropdown/Dropdown.tsx
Normal file
110
src/views/components/common/Dropdown/Dropdown.tsx
Normal file
@@ -0,0 +1,110 @@
|
||||
import { Disclosure, Transition } from '@headlessui/react';
|
||||
import { UserSchedule } from '@shared/types/UserSchedule';
|
||||
import React from 'react';
|
||||
import userScheduleHandler from 'src/pages/background/handler/userScheduleHandler';
|
||||
import DropdownArrowDown from '~icons/material-symbols/arrow-drop-down';
|
||||
import DropdownArrowUp from '~icons/material-symbols/arrow-drop-up';
|
||||
import List from '../List/List';
|
||||
import Text from '../Text/Text';
|
||||
|
||||
export type Props = {
|
||||
style?: React.CSSProperties;
|
||||
// Dummy value solely for storybook
|
||||
dummySchedules?: UserSchedule[];
|
||||
dummyActiveIndex?: number;
|
||||
dummyActiveSchedule?: UserSchedule;
|
||||
scheduleComponents?: any[];
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a reusable dropdown component that can be used to toggle the visiblity of information
|
||||
*/
|
||||
export default function Dropdown(props: Props) {
|
||||
// Expand/Hide state for dropdown
|
||||
let [expanded, toggle] = React.useState(false);
|
||||
let [activeScheduleIndex, select] = React.useState(props.dummyActiveIndex);
|
||||
let [activeSchedule, selectFrom] = React.useState(props.dummyActiveSchedule);
|
||||
let [scheduleComponents, setScheduleComponents] = React.useState(props.scheduleComponents);
|
||||
|
||||
const schedules = props.dummySchedules;
|
||||
if (schedules == null) {
|
||||
// if no dummy values passed in
|
||||
// useSchedules hook here
|
||||
}
|
||||
|
||||
const toggleSwitch = () => {
|
||||
toggle(!expanded);
|
||||
};
|
||||
|
||||
// WIP function to swap schedules. Prefer to use the hook when in production
|
||||
const switchSchedule = (index: number) => {
|
||||
const scheduleToSwitchTo = schedules[index];
|
||||
|
||||
select(index);
|
||||
selectFrom(scheduleToSwitchTo);
|
||||
if (scheduleToSwitchTo != null && scheduleToSwitchTo.name != null) {
|
||||
userScheduleHandler.switchSchedule({
|
||||
data: {
|
||||
scheduleName: scheduleToSwitchTo.name,
|
||||
},
|
||||
sender: null,
|
||||
sendResponse: null,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{ ...props.style, height: expanded && schedules ? `${40 * schedules.length + 54}px` : '72px' }}
|
||||
className='items-left absolute w-72 flex flex-col border'
|
||||
>
|
||||
<Disclosure>
|
||||
<Disclosure.Button>
|
||||
<div className='flex items-center border-none bg-white p-3 text-left'>
|
||||
<div className='flex-1'>
|
||||
<Text as='div' variant='h4' className='text-ut-burntorange mb-1 w-100%'>
|
||||
MAIN SCHEDULE:
|
||||
</Text>
|
||||
<div>
|
||||
<Text variant='h3' className='text-theme-black leading-[75%]!'>
|
||||
{activeSchedule ? activeSchedule.hours : 0} HOURS
|
||||
</Text>
|
||||
<Text variant='h4' className='ml-2.5 text-ut-black leading-[75%]!'>
|
||||
{activeSchedule ? activeSchedule.courses.length : 0} Courses
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
<Text className='text-ut-burntorange text-2xl font-normal'>
|
||||
{expanded ? <DropdownArrowDown /> : <DropdownArrowUp />}
|
||||
</Text>
|
||||
</div>
|
||||
</Disclosure.Button>
|
||||
|
||||
<Transition
|
||||
enter='transition duration-100 ease-out'
|
||||
enterFrom='transform scale-95 opacity-0'
|
||||
enterTo='transform scale-100 opacity-100'
|
||||
leave='transition duration-75 ease-out'
|
||||
leaveFrom='transform scale-100 opacity-100'
|
||||
leaveTo='transform scale-95 opacity-0'
|
||||
beforeEnter={() => {
|
||||
toggleSwitch();
|
||||
}}
|
||||
afterLeave={() => {
|
||||
toggleSwitch();
|
||||
}}
|
||||
>
|
||||
<Disclosure.Panel>
|
||||
<List
|
||||
draggableElements={scheduleComponents}
|
||||
itemHeight={30}
|
||||
listHeight={30}
|
||||
listWidth={240}
|
||||
gap={10}
|
||||
/>
|
||||
</Disclosure.Panel>
|
||||
</Transition>
|
||||
</Disclosure>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,36 +1,38 @@
|
||||
import clsx from 'clsx';
|
||||
import React from 'react';
|
||||
import DropdownDrag from '~icons/material-symbols/drag-indicator';
|
||||
import DragIndicatorIcon from '~icons/material-symbols/drag-indicator';
|
||||
import Text from '../Text/Text';
|
||||
|
||||
|
||||
export type Props = {
|
||||
style?: React.CSSProperties;
|
||||
active?: boolean;
|
||||
name: string;
|
||||
dragHandleProps?: any;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is a reusable dropdown component that can be used to toggle the visiblity of information
|
||||
*/
|
||||
export default function ScheduleListItem(props: Props) {
|
||||
|
||||
const { dragHandleProps } = props;
|
||||
console.log(props);
|
||||
return (
|
||||
<div style={{ ...props.style }} className='items-center'>
|
||||
<li
|
||||
className='text-ut-burntorange w-100% flex cursor-pointer items-center self-stretch justify-left'
|
||||
>
|
||||
<li className='text-ut-burntorange w-100% flex cursor-pointer items-center self-stretch justify-left'>
|
||||
<div className='group flex justify-center'>
|
||||
<DropdownDrag className='h-6 w-6 cursor-move text-zinc-300 btn-transition -ml-1.5 hover:text-zinc-400' />
|
||||
<div
|
||||
className='flex cursor-move items-center self-stretch rounded rounded-r-0'
|
||||
{...dragHandleProps}
|
||||
>
|
||||
<DragIndicatorIcon className='h-6 w-6 cursor-move text-zinc-300 btn-transition -ml-1.5 hover:text-zinc-400' />
|
||||
</div>
|
||||
<div className='inline-flex items-center justify-center gap-1.5'>
|
||||
<div className='h-5.5 w-5.5 flex items-center justify-center border-2px border-current rounded-full btn-transition group-active:scale-95'>
|
||||
<div
|
||||
className={clsx(
|
||||
'bg-current h-3 w-3 rounded-full transition tansform scale-100 ease-out-expo duration-250',
|
||||
{
|
||||
'scale-0! opacity-0 ease-in-out! duration-200!': !props.active
|
||||
'scale-0! opacity-0 ease-in-out! duration-200!': !props.active,
|
||||
}
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { background } from '@shared/messages';
|
||||
import { Course } from '@shared/types/Course';
|
||||
import { UserSchedule } from '@shared/types/UserSchedule';
|
||||
import React from 'react';
|
||||
import { Button } from '@views/components/common/Button/Button';
|
||||
import Card from '@views/components/common/Card/Card';
|
||||
import Icon from '@views/components/common/Icon/Icon';
|
||||
import Text from '@views/components/common/Text/Text';
|
||||
import React from 'react';
|
||||
import styles from './CourseButtons.module.scss';
|
||||
|
||||
type Props = {
|
||||
@@ -83,48 +83,43 @@ export default function CourseButtons({ course, activeSchedule }: Props) {
|
||||
<Button
|
||||
onClick={openRateMyProfessorURL}
|
||||
disabled={!course.instructors.length}
|
||||
variant='primary'
|
||||
variant='filled'
|
||||
className={styles.button}
|
||||
color='ut-black'
|
||||
title='Search for this professor on RateMyProfessor'
|
||||
>
|
||||
<Text /* size='medium' weight='regular' */color='white'>
|
||||
RateMyProf
|
||||
</Text>
|
||||
<Text /* size='medium' weight='regular' */ color='white'>RateMyProf</Text>
|
||||
<Icon className={styles.icon} color='white' name='school' size='medium' />
|
||||
</Button>
|
||||
<Button
|
||||
onClick={openSyllabiURL}
|
||||
variant='secondary'
|
||||
variant='filled'
|
||||
className={styles.button}
|
||||
color='ut-black'
|
||||
title='Search for syllabi for this course'
|
||||
>
|
||||
<Text /* size='medium' weight='regular' */ color='white'>
|
||||
Syllabi
|
||||
</Text>
|
||||
<Text /* size='medium' weight='regular' */ color='white'>Syllabi</Text>
|
||||
<Icon className={styles.icon} color='white' name='grading' size='medium' />
|
||||
</Button>
|
||||
<Button
|
||||
onClick={openTextbookURL}
|
||||
variant='tertiary'
|
||||
variant='filled'
|
||||
className={styles.button}
|
||||
color='ut-black'
|
||||
title='Search for textbooks for this course'
|
||||
>
|
||||
<Text /* size='medium' weight='regular' color='white' */>
|
||||
Textbook
|
||||
</Text>
|
||||
<Text /* size='medium' weight='regular' color='white' */>Textbook</Text>
|
||||
<Icon className={styles.icon} color='white' name='collections_bookmark' size='medium' />
|
||||
</Button>
|
||||
<Button
|
||||
disabled={!activeSchedule}
|
||||
onClick={isCourseSaved ? handleRemoveCourse : handleSaveCourse}
|
||||
title={isCourseSaved ? 'Remove this course from your schedule' : 'Add this course to your schedule'}
|
||||
variant={isCourseSaved ? 'danger' : 'success'}
|
||||
variant='filled'
|
||||
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' />
|
||||
</Button>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user