From 3abb11734ab4b6d0eeda2e749930d570199269b8 Mon Sep 17 00:00:00 2001 From: Derek Chen Date: Sat, 23 Nov 2024 00:14:49 -0600 Subject: [PATCH] refactor: change a file name (#447) * refactor: file upload component * refactor: changed name of a function and added a new line --- src/pages/background/lib/addCourse.ts | 1 + src/pages/background/lib/importSchedule.ts | 1 - ...ton.stories.tsx => FileUpload.stories.tsx} | 37 ++++++++----------- .../{InputButton.tsx => FileUpload.tsx} | 2 +- src/views/components/settings/Settings.tsx | 6 +-- 5 files changed, 21 insertions(+), 26 deletions(-) rename src/stories/components/{InputButton.stories.tsx => FileUpload.stories.tsx} (63%) rename src/views/components/common/{InputButton.tsx => FileUpload.tsx} (98%) diff --git a/src/pages/background/lib/addCourse.ts b/src/pages/background/lib/addCourse.ts index 9a14087d..c7a1217e 100644 --- a/src/pages/background/lib/addCourse.ts +++ b/src/pages/background/lib/addCourse.ts @@ -21,6 +21,7 @@ export default async function addCourse(scheduleId: string, course: Course, hasC if (!hasColor) { course.colors = getUnusedColor(activeSchedule, course); } + activeSchedule.courses.push(course); activeSchedule.updatedAt = Date.now(); await UserScheduleStore.set('schedules', schedules); diff --git a/src/pages/background/lib/importSchedule.ts b/src/pages/background/lib/importSchedule.ts index e85adca6..a17526dd 100644 --- a/src/pages/background/lib/importSchedule.ts +++ b/src/pages/background/lib/importSchedule.ts @@ -26,7 +26,6 @@ export default async function importSchedule(scheduleData: unknown): Promise; +} satisfies Meta; export default meta; type Story = StoryObj; @@ -64,17 +59,17 @@ export const Grid: Story = { render: props => (
- - - + + +

- - - + + +
), @@ -92,15 +87,15 @@ export const PrettyColors: Story = {
{colorsNames.map(color => (
- + Button - - + + Button - - + + Button - +
))}
diff --git a/src/views/components/common/InputButton.tsx b/src/views/components/common/FileUpload.tsx similarity index 98% rename from src/views/components/common/InputButton.tsx rename to src/views/components/common/FileUpload.tsx index 63fcdf97..2499714d 100644 --- a/src/views/components/common/InputButton.tsx +++ b/src/views/components/common/FileUpload.tsx @@ -22,7 +22,7 @@ interface Props { * * @returns */ -export default function InputButton({ +export default function FileUpload({ className, style, variant, diff --git a/src/views/components/settings/Settings.tsx b/src/views/components/settings/Settings.tsx index fb5229d4..975e273b 100644 --- a/src/views/components/settings/Settings.tsx +++ b/src/views/components/settings/Settings.tsx @@ -29,7 +29,7 @@ import IconoirGitFork from '~icons/iconoir/git-fork'; // import { ExampleCourse } from 'src/stories/components/ConflictsWithWarning.stories'; import DeleteForeverIcon from '~icons/material-symbols/delete-forever'; -import InputButton from '../common/InputButton'; +import FileUpload from '../common/FileUpload'; import { useMigrationDialog } from '../common/MigrationDialog'; // import RefreshIcon from '~icons/material-symbols/refresh'; import DevMode from './DevMode'; @@ -383,9 +383,9 @@ export default function Settings(): JSX.Element {

Import from a schedule file

- + Import Schedule - +