Files
app/src/pages/user/NotFound.tsx
T
kcarandClaude Sonnet 4.6 63d6d1bbca fix(nav): trim burger menu, fix MyClasses for teachers, fix NotFound crash
- Header: trim menu to My Work section (My Lessons, My Classes, Lesson Plans), School Admin (gated), Platform Admin (gated)
- MyClassesPage: fix loading/error state destructure (classesLoading not myClassesLoading)
- NotFound: fix ErrorOutline -> ErrorOutlineIcon to prevent 404 page crash
- timetableService: getMyClasses now calls both /me/teacher and /me/student, merges with role annotation
- timetableStore: myClasses type updated to ClassWithRole[]
- timetable.types: add ClassWithRole interface and code/institute_id optional fields to Class

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-05-27 12:58:33 +01:00

62 lines
2.1 KiB
TypeScript

import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { Box, Typography, Button, Container, useTheme } from "@mui/material";
import { useAuth } from "../../contexts/AuthContext";
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
import { logger } from '../../debugConfig';
function NotFound() {
const theme = useTheme();
const navigate = useNavigate();
const { user } = useAuth();
useEffect(() => {
logger.debug('not-found', '🔄 Not Found page rendered', {
hasUser: !!user,
userId: user?.id
});
}, [user]);
const handleReturn = () => {
const returnPath = user ? '/single-player' : '/';
logger.debug('not-found', '🔄 Navigating to return path', { returnPath });
navigate(returnPath);
};
return (
<Container maxWidth="sm">
<Box
sx={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
minHeight: '100vh',
textAlign: 'center',
gap: 3
}}
>
<ErrorOutlineIcon sx={{ fontSize: 60, color: theme.palette.error.main }} />
<Typography variant="h2" component="h1" gutterBottom>
404
</Typography>
<Typography variant="h5" gutterBottom>
Page Not Found
</Typography>
<Typography variant="body1" color="text.secondary" paragraph>
The page you're looking for doesn't exist or has been moved.
</Typography>
<Button
variant="contained"
color="primary"
size="large"
onClick={handleReturn}
>
Return to {user ? 'Canvas' : 'Home'}
</Button>
</Box>
</Container>
);
}
export default NotFound;