From d7a8fdbfa445906f3a88388319fcca5c4622f6a2 Mon Sep 17 00:00:00 2001 From: Aponia Date: Wed, 1 Nov 2023 17:19:40 -0700 Subject: [PATCH 1/2] chore: move header's files around --- apps/antalmanac/src/actions/AppStoreActions.ts | 2 +- .../src/components/{AppBar => Header}/AboutPage.tsx | 0 .../{AppBar/Exports => Header}/Export.tsx | 4 ++-- .../src/components/{AppBar => Header}/Feedback.tsx | 0 .../{AppBar/CustomAppBar.tsx => Header/Header.tsx} | 6 +++--- .../{AppBar => Header}/ImportStudyList.tsx | 6 +----- .../{AppBar => Header}/LoadSaveFunctionality.tsx | 0 .../src/components/{AppBar => Header}/News.tsx | 0 .../{AppBar => Header}/NotificationHub.tsx | 0 .../components/{AppBar => Header}/SettingsMenu.tsx | 0 .../{AppBar => Header}/halloween-logo.png | Bin .../{AppBar => Header}/halloween-mobile-logo.png | Bin apps/antalmanac/src/components/Header/index.tsx | 1 + .../src/components/{AppBar => Header}/logo.svg | 0 .../components/{AppBar => Header}/mobile-logo.svg | 0 .../{AppBar => }/NotificationSnackbar.tsx | 0 .../{AppBar/Exports => buttons}/ExportCalendar.tsx | 0 .../ScreenshotButton.tsx => buttons/Screenshot.tsx} | 0 apps/antalmanac/src/routes/Home.tsx | 6 +++--- 19 files changed, 11 insertions(+), 14 deletions(-) rename apps/antalmanac/src/components/{AppBar => Header}/AboutPage.tsx (100%) rename apps/antalmanac/src/components/{AppBar/Exports => Header}/Export.tsx (91%) rename apps/antalmanac/src/components/{AppBar => Header}/Feedback.tsx (100%) rename apps/antalmanac/src/components/{AppBar/CustomAppBar.tsx => Header/Header.tsx} (95%) rename apps/antalmanac/src/components/{AppBar => Header}/ImportStudyList.tsx (98%) rename apps/antalmanac/src/components/{AppBar => Header}/LoadSaveFunctionality.tsx (100%) rename apps/antalmanac/src/components/{AppBar => Header}/News.tsx (100%) rename apps/antalmanac/src/components/{AppBar => Header}/NotificationHub.tsx (100%) rename apps/antalmanac/src/components/{AppBar => Header}/SettingsMenu.tsx (100%) rename apps/antalmanac/src/components/{AppBar => Header}/halloween-logo.png (100%) rename apps/antalmanac/src/components/{AppBar => Header}/halloween-mobile-logo.png (100%) create mode 100644 apps/antalmanac/src/components/Header/index.tsx rename apps/antalmanac/src/components/{AppBar => Header}/logo.svg (100%) rename apps/antalmanac/src/components/{AppBar => Header}/mobile-logo.svg (100%) rename apps/antalmanac/src/components/{AppBar => }/NotificationSnackbar.tsx (100%) rename apps/antalmanac/src/components/{AppBar/Exports => buttons}/ExportCalendar.tsx (100%) rename apps/antalmanac/src/components/{AppBar/Exports/ScreenshotButton.tsx => buttons/Screenshot.tsx} (100%) diff --git a/apps/antalmanac/src/actions/AppStoreActions.ts b/apps/antalmanac/src/actions/AppStoreActions.ts index eb7749bb7..8caab3f47 100644 --- a/apps/antalmanac/src/actions/AppStoreActions.ts +++ b/apps/antalmanac/src/actions/AppStoreActions.ts @@ -3,7 +3,7 @@ import { VariantType } from 'notistack'; import { TRPCError } from '@trpc/server'; import { WebsocSection } from 'peterportal-api-next-types'; import { ScheduleCourse } from '@packages/antalmanac-types'; -import { SnackbarPosition } from '$components/AppBar/NotificationSnackbar'; +import { SnackbarPosition } from '$components/NotificationSnackbar'; import { RepeatingCustomEvent } from '$components/Calendar/Toolbar/CustomEventDialog/CustomEventDialog'; import analyticsEnum, { logAnalytics } from '$lib/analytics'; import { warnMultipleTerms } from '$lib/helpers'; diff --git a/apps/antalmanac/src/components/AppBar/AboutPage.tsx b/apps/antalmanac/src/components/Header/AboutPage.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/AboutPage.tsx rename to apps/antalmanac/src/components/Header/AboutPage.tsx diff --git a/apps/antalmanac/src/components/AppBar/Exports/Export.tsx b/apps/antalmanac/src/components/Header/Export.tsx similarity index 91% rename from apps/antalmanac/src/components/AppBar/Exports/Export.tsx rename to apps/antalmanac/src/components/Header/Export.tsx index d72f327ed..6d36ad617 100644 --- a/apps/antalmanac/src/components/AppBar/Exports/Export.tsx +++ b/apps/antalmanac/src/components/Header/Export.tsx @@ -2,8 +2,8 @@ import { Button, Paper, Popover, Tooltip } from '@mui/material'; import { IosShare } from '@mui/icons-material'; import { useCallback, useMemo, useState } from 'react'; -import ExportCalendar from '$components/AppBar/Exports/ExportCalendar'; -import ScreenshotButton from '$components/AppBar/Exports/ScreenshotButton'; +import ExportCalendar from '$components/buttons/ExportCalendar'; +import ScreenshotButton from '$components/buttons/Screenshot'; function Export() { const [anchorEl, setAnchorEl] = useState(); diff --git a/apps/antalmanac/src/components/AppBar/Feedback.tsx b/apps/antalmanac/src/components/Header/Feedback.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/Feedback.tsx rename to apps/antalmanac/src/components/Header/Feedback.tsx diff --git a/apps/antalmanac/src/components/AppBar/CustomAppBar.tsx b/apps/antalmanac/src/components/Header/Header.tsx similarity index 95% rename from apps/antalmanac/src/components/AppBar/CustomAppBar.tsx rename to apps/antalmanac/src/components/Header/Header.tsx index 6f8c93218..61838c2b8 100644 --- a/apps/antalmanac/src/components/AppBar/CustomAppBar.tsx +++ b/apps/antalmanac/src/components/Header/Header.tsx @@ -11,7 +11,7 @@ import ImportStudyList from './ImportStudyList'; import LoadSaveScheduleFunctionality from './LoadSaveFunctionality'; import News from './News'; import SettingsMenu from './SettingsMenu'; -import Export from './Exports/Export'; +import Export from './Export'; import Logo from './halloween-logo.png'; import MobileLogo from './halloween-mobile-logo.png'; @@ -51,7 +51,7 @@ const components = [ , ]; -const CustomAppBar = ({ classes }: CustomAppBarProps) => { +const Header = ({ classes }: CustomAppBarProps) => { const isMobileScreen = useMediaQuery('(max-width:750px)'); const [anchorEl, setAnchorEl] = useState(null); @@ -95,4 +95,4 @@ const CustomAppBar = ({ classes }: CustomAppBarProps) => { ); }; -export default withStyles(styles)(CustomAppBar); +export default withStyles(styles)(Header); diff --git a/apps/antalmanac/src/components/AppBar/ImportStudyList.tsx b/apps/antalmanac/src/components/Header/ImportStudyList.tsx similarity index 98% rename from apps/antalmanac/src/components/AppBar/ImportStudyList.tsx rename to apps/antalmanac/src/components/Header/ImportStudyList.tsx index 665f5fee5..7a611cfda 100644 --- a/apps/antalmanac/src/components/AppBar/ImportStudyList.tsx +++ b/apps/antalmanac/src/components/Header/ImportStudyList.tsx @@ -69,11 +69,7 @@ class ImportStudyList extends PureComponent { + addCoursesMultiple = (courseInfo: { [sectionCode: string]: CourseInfo }, term: string, scheduleIndex: number) => { for (const section of Object.values(courseInfo)) { addCourse(section.section, section.courseDetails, term, scheduleIndex, true); } diff --git a/apps/antalmanac/src/components/AppBar/LoadSaveFunctionality.tsx b/apps/antalmanac/src/components/Header/LoadSaveFunctionality.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/LoadSaveFunctionality.tsx rename to apps/antalmanac/src/components/Header/LoadSaveFunctionality.tsx diff --git a/apps/antalmanac/src/components/AppBar/News.tsx b/apps/antalmanac/src/components/Header/News.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/News.tsx rename to apps/antalmanac/src/components/Header/News.tsx diff --git a/apps/antalmanac/src/components/AppBar/NotificationHub.tsx b/apps/antalmanac/src/components/Header/NotificationHub.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/NotificationHub.tsx rename to apps/antalmanac/src/components/Header/NotificationHub.tsx diff --git a/apps/antalmanac/src/components/AppBar/SettingsMenu.tsx b/apps/antalmanac/src/components/Header/SettingsMenu.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/SettingsMenu.tsx rename to apps/antalmanac/src/components/Header/SettingsMenu.tsx diff --git a/apps/antalmanac/src/components/AppBar/halloween-logo.png b/apps/antalmanac/src/components/Header/halloween-logo.png similarity index 100% rename from apps/antalmanac/src/components/AppBar/halloween-logo.png rename to apps/antalmanac/src/components/Header/halloween-logo.png diff --git a/apps/antalmanac/src/components/AppBar/halloween-mobile-logo.png b/apps/antalmanac/src/components/Header/halloween-mobile-logo.png similarity index 100% rename from apps/antalmanac/src/components/AppBar/halloween-mobile-logo.png rename to apps/antalmanac/src/components/Header/halloween-mobile-logo.png diff --git a/apps/antalmanac/src/components/Header/index.tsx b/apps/antalmanac/src/components/Header/index.tsx new file mode 100644 index 000000000..579f1ac23 --- /dev/null +++ b/apps/antalmanac/src/components/Header/index.tsx @@ -0,0 +1 @@ +export { default } from './Header'; diff --git a/apps/antalmanac/src/components/AppBar/logo.svg b/apps/antalmanac/src/components/Header/logo.svg similarity index 100% rename from apps/antalmanac/src/components/AppBar/logo.svg rename to apps/antalmanac/src/components/Header/logo.svg diff --git a/apps/antalmanac/src/components/AppBar/mobile-logo.svg b/apps/antalmanac/src/components/Header/mobile-logo.svg similarity index 100% rename from apps/antalmanac/src/components/AppBar/mobile-logo.svg rename to apps/antalmanac/src/components/Header/mobile-logo.svg diff --git a/apps/antalmanac/src/components/AppBar/NotificationSnackbar.tsx b/apps/antalmanac/src/components/NotificationSnackbar.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/NotificationSnackbar.tsx rename to apps/antalmanac/src/components/NotificationSnackbar.tsx diff --git a/apps/antalmanac/src/components/AppBar/Exports/ExportCalendar.tsx b/apps/antalmanac/src/components/buttons/ExportCalendar.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/Exports/ExportCalendar.tsx rename to apps/antalmanac/src/components/buttons/ExportCalendar.tsx diff --git a/apps/antalmanac/src/components/AppBar/Exports/ScreenshotButton.tsx b/apps/antalmanac/src/components/buttons/Screenshot.tsx similarity index 100% rename from apps/antalmanac/src/components/AppBar/Exports/ScreenshotButton.tsx rename to apps/antalmanac/src/components/buttons/Screenshot.tsx diff --git a/apps/antalmanac/src/routes/Home.tsx b/apps/antalmanac/src/routes/Home.tsx index bcee4feda..ccf64d5b1 100644 --- a/apps/antalmanac/src/routes/Home.tsx +++ b/apps/antalmanac/src/routes/Home.tsx @@ -3,12 +3,12 @@ import DateFnsUtils from '@date-io/date-fns'; import { MuiPickersUtilsProvider } from '@material-ui/pickers'; import { Box, CssBaseline, useMediaQuery, useTheme } from '@material-ui/core'; -import Bar from '$components/AppBar/CustomAppBar'; +import Header from '$components/Header'; import MobileHome from '$components/MobileHome'; import PatchNotes from '$components/PatchNotes'; import Calendar from '$components/Calendar/CalendarRoot'; import DesktopTabs from '$components/RightPane/RightPaneRoot'; -import NotificationSnackbar from '$components/AppBar/NotificationSnackbar'; +import NotificationSnackbar from '$components/NotificationSnackbar'; export default function Home() { const isMobileScreen = useMediaQuery('(max-width: 750px)'); @@ -18,7 +18,7 @@ export default function Home() { - +
{isMobileScreen ? ( ) : ( From c946c9169ce3e6edfa3592e88d85522a1b9aff7c Mon Sep 17 00:00:00 2001 From: Aponia Date: Wed, 1 Nov 2023 17:25:34 -0700 Subject: [PATCH 2/2] chore: try to reduce diff --- apps/antalmanac/src/components/Header/ImportStudyList.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/antalmanac/src/components/Header/ImportStudyList.tsx b/apps/antalmanac/src/components/Header/ImportStudyList.tsx index 7a611cfda..665f5fee5 100644 --- a/apps/antalmanac/src/components/Header/ImportStudyList.tsx +++ b/apps/antalmanac/src/components/Header/ImportStudyList.tsx @@ -69,7 +69,11 @@ class ImportStudyList extends PureComponent { + addCoursesMultiple = ( + courseInfo: { [sectionCode: string]: CourseInfo }, + term: string, + scheduleIndex: number + ) => { for (const section of Object.values(courseInfo)) { addCourse(section.section, section.courseDetails, term, scheduleIndex, true); }