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