Compare commits

..

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
6cf599486e refactor(storybook): improve type safety without type assertions
Co-authored-by: Razboy20 <29903962+Razboy20@users.noreply.github.com>
2026-02-12 04:29:34 +00:00
copilot-swe-agent[bot]
02350188b5 fix(storybook): fix typecheck errors in SortableList.stories.tsx
Co-authored-by: Razboy20 <29903962+Razboy20@users.noreply.github.com>
2026-02-12 04:28:22 +00:00
copilot-swe-agent[bot]
3e1eb4ee6b Initial plan 2026-02-12 04:24:30 +00:00
3 changed files with 7 additions and 57 deletions

View File

@@ -77,7 +77,7 @@ type CourseWithId = { course: Course } & BaseItem;
const meta = {
title: 'Components/Common/SortableList',
component: SortableList,
component: SortableList<CourseWithId>,
parameters: {
layout: 'centered',
},
@@ -85,7 +85,7 @@ const meta = {
} satisfies Meta<typeof SortableList<CourseWithId>>;
export default meta;
type Story = StoryObj<Meta<typeof SortableList<CourseWithId>>>;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
@@ -94,7 +94,9 @@ export const Default: Story = {
course,
})),
onChange: () => {},
renderItem: ({ id, course }) => <PopupCourseBlock key={id} course={course} colors={course.colors} />,
renderItem: (item: CourseWithId) => (
<PopupCourseBlock key={item.id} course={item.course} colors={item.course.colors} />
),
},
render: args => (
<div className='h-3xl w-3xl transform-none'>

View File

@@ -1,5 +1,5 @@
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react';
import { CalendarDots, Export, FileCode, FilePng, FileText, Sidebar } from '@phosphor-icons/react';
import { CalendarDots, Export, FileCode, FilePng, Sidebar } from '@phosphor-icons/react';
import styles from '@views/components/calendar/CalendarHeader/CalendarHeader.module.scss';
import { Button } from '@views/components/common/Button';
import DialogProvider from '@views/components/common/DialogProvider/DialogProvider';
@@ -11,7 +11,7 @@ import useSchedules from '@views/hooks/useSchedules';
import clsx from 'clsx';
import React from 'react';
import { handleExportJson, saveAsCal, saveAsText, saveCalAsPng } from '../utils';
import { handleExportJson, saveAsCal, saveCalAsPng } from '../utils';
interface CalendarHeaderProps {
sidebarOpen?: boolean;
@@ -111,18 +111,6 @@ export default function CalendarHeader({ sidebarOpen, onSidebarToggle }: Calenda
Save as .json
</Button>
</MenuItem>
<MenuItem>
<Button
className='w-full flex justify-start'
onClick={saveAsText}
color='ut-black'
size='small'
variant='minimal'
icon={FileText}
>
Save as .txt
</Button>
</MenuItem>
{/* <MenuItem>
<Button color='ut-black' size='small' variant='minimal' icon={FileTxt}>
Export Unique IDs

View File

@@ -245,27 +245,6 @@ export const scheduleToIcsString = (schedule: Serialized<UserSchedule>) => {
return icsString;
};
/**
* Returns the provided schedule in a human readable/copyable text format
* @param schedule - The schedule object
* @returns
*/
export const scheduleToText = (schedule: Serialized<UserSchedule>) => {
const lines: string[] = [];
lines.push(`Schedule: ${schedule.name}`);
lines.push('');
for (const c of schedule.courses) {
lines.push(c.fullName);
lines.push(`${c.creditHours} Credit Hours`);
lines.push(`${c.uniqueId}`);
lines.push('');
}
return lines.join('\n');
};
/**
* Saves the current schedule as a calendar file in the iCalendar format (ICS).
* Fetches the current active schedule and converts it into an ICS string.
@@ -283,25 +262,6 @@ export const saveAsCal = async () => {
downloadBlob(icsString, 'CALENDAR', 'schedule.ics');
};
/**
* Save current schedule as a plain text file consisting of
* Course Name - Course ID
* Course Time
* Unique Number
* Line Break
* Repeat
*/
export const saveAsText = async () => {
const schedule = await getSchedule();
if (!schedule) {
throw new Error('No schedule found');
}
const scheduleText = scheduleToText(schedule);
downloadBlob(scheduleText, 'TEXT', 'schedule.txt');
};
/**
* Saves current schedule to JSON that can be imported on other devices.
* @param id - Provided schedule ID to download