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