diff --git a/client/src/App.tsx b/client/src/App.tsx index 41b60acfb..7a10ade95 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -4,7 +4,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers'; import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; import * as Sentry from '@sentry/react'; import React, { useContext, useEffect, useMemo } from 'react'; -import { Outlet } from 'react-router'; +import { Outlet, useLocation } from 'react-router'; import getCourseInfo from './api/getCourseInfo'; import getCoursesList from './api/getCoursesList'; @@ -134,6 +134,7 @@ const App: React.FC = () => { setAssignedColors, } = useContext(CourseContext); + const location = useLocation(); const { preferredTheme, isDarkMode, unscheduleClassesByDefault, convertToLocalTimezone } = useGetUserSettingsQuery(); const decodedAssignedColors = useColorsDecoder(assignedColors, preferredTheme); @@ -569,6 +570,46 @@ const App: React.FC = () => { }, }; + const timetableView = useMemo(() => { + const currentPathname = location.pathname; + const searchParams = location.search; + console.log(currentPathname); + if (currentPathname === '/home') { + return ( + <> + + + { + downloadIcsFile(selectedCourses, createdEvents, selectedClasses, firstDayOfTerm) + .then(() => { + /* do nothing */ + }) + .catch(() => { + /* do nothing */ + }); + }} + > + save to calendar + + +