this repo has no description
1import AppBar from '@mui/material/AppBar';
2import Toolbar from '@mui/material/Toolbar';
3import Typography from '@mui/material/Typography';
4import Box from '@mui/material/Box';
5import IconButton from '@mui/material/IconButton';
6import LogoutIcon from '@mui/icons-material/Logout';
7import { Outlet } from 'react-router-dom';
8import { useAuth } from '../../hooks/useAuth';
9import { useProgress } from '../../hooks/useProgress';
10import { XPDisplay } from '../common/XPDisplay';
11import { HeartsDisplay } from '../common/HeartsDisplay';
12import LocalFireDepartmentIcon from '@mui/icons-material/LocalFireDepartment';
13
14export function AppShell() {
15 const { logout } = useAuth();
16 const { progress } = useProgress();
17
18 const stats = progress?.stats;
19
20 return (
21 <Box sx={{ display: 'flex', flexDirection: 'column', minHeight: '100vh' }}>
22 <AppBar
23 position="sticky"
24 sx={{
25 bgcolor: 'background.paper',
26 backgroundImage: 'none',
27 borderBottom: '1px solid rgba(255,255,255,0.08)',
28 }}
29 elevation={0}
30 >
31 <Toolbar sx={{ justifyContent: 'space-between' }}>
32 <Typography
33 variant="h6"
34 sx={{
35 fontWeight: 700,
36 color: '#E8453C',
37 letterSpacing: '0.05em',
38 }}
39 >
40 AYOS
41 </Typography>
42
43 <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
44 {stats && (
45 <>
46 <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
47 <LocalFireDepartmentIcon
48 sx={{ color: '#FF9600', fontSize: 20 }}
49 />
50 <Typography
51 variant="body2"
52 sx={{ color: '#FF9600', fontWeight: 700 }}
53 >
54 {stats.streak_days}
55 </Typography>
56 </Box>
57 <XPDisplay xp={stats.xp} />
58 <HeartsDisplay hearts={stats.hearts} />
59 </>
60 )}
61 <IconButton
62 onClick={logout}
63 size="small"
64 sx={{ color: 'text.secondary' }}
65 >
66 <LogoutIcon fontSize="small" />
67 </IconButton>
68 </Box>
69 </Toolbar>
70 </AppBar>
71
72 <Box
73 component="main"
74 sx={{
75 flex: 1,
76 display: 'flex',
77 flexDirection: 'column',
78 }}
79 >
80 <Outlet />
81 </Box>
82 </Box>
83 );
84}