diff --git a/src/pages/timetable/MyClassesPage.tsx b/src/pages/timetable/MyClassesPage.tsx index d097ea4..b5f1628 100644 --- a/src/pages/timetable/MyClassesPage.tsx +++ b/src/pages/timetable/MyClassesPage.tsx @@ -3,9 +3,19 @@ import { Link } from 'react-router-dom'; import { AccessTime, KeyboardArrowRight, MenuBook, People, School } from '@mui/icons-material'; import useTimetableStore from '../../stores/timetableStore'; import { useUser } from '../../contexts/UserContext'; +import { useNeoInstitute } from '../../contexts/NeoInstituteContext'; +import { CircularProgress } from '@mui/material'; +import { logger } from '../../debugConfig'; + +const MyClassesSkeleton = () => ( +
+ +
+); const MyClassesPage: React.FC = () => { const { profile } = useUser(); + const { selectedInstituteId } = useNeoInstitute(); const { myClasses, classesLoading: myClassesLoading, @@ -14,8 +24,16 @@ const MyClassesPage: React.FC = () => { } = useTimetableStore(); useEffect(() => { - fetchMyClasses(); - }, [fetchMyClasses]); + fetchMyClasses().catch((error) => + logger.warn('my-classes', 'Fetch my classes failed', { + message: error instanceof Error ? error.message : String(error), + }) + ); + }, [fetchMyClasses, selectedInstituteId]); + + if (myClassesLoading) { + return ; + } const getRoleLabel = (role: string) => { switch (role) { @@ -36,14 +54,6 @@ const MyClassesPage: React.FC = () => { } }; - if (myClassesLoading) { - return ( -
-
-
- ); - } - if (myClassesError) { return (