base commit

This commit is contained in:
@kirill.komarov
2026-05-03 20:30:21 +05:00
parent fe10f25b8c
commit 6885e39017
13 changed files with 253 additions and 72 deletions
+45 -7
View File
@@ -2,9 +2,9 @@ import type { ReactNode } from 'react'
import { useMemo, useState } from 'react'
import ChatOutlinedIcon from '@mui/icons-material/ChatOutlined'
import LocalShippingOutlinedIcon from '@mui/icons-material/LocalShippingOutlined'
import MenuOutlinedIcon from '@mui/icons-material/MenuOutlined'
import PlaceOutlinedIcon from '@mui/icons-material/PlaceOutlined'
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined'
import TuneOutlinedIcon from '@mui/icons-material/TuneOutlined'
import Alert from '@mui/material/Alert'
import Badge from '@mui/material/Badge'
import Box from '@mui/material/Box'
@@ -67,6 +67,9 @@ export function MeLayoutPage() {
if (!user) {
return <Alert severity="info">Нужно войти. Перейдите на страницу «Вход».</Alert>
}
if (user.isAdmin) {
return <Navigate to="/admin" replace />
}
const activeTo =
navItems.find((x) => location.pathname === x.to)?.to ??
@@ -74,8 +77,8 @@ export function MeLayoutPage() {
null
const nav = (
<Box sx={{ width: 280, maxWidth: '85vw' }}>
<Box sx={{ p: 2 }}>
<Box sx={{ width: 300, maxWidth: '88vw', py: 1 }}>
<Box sx={{ px: 2, py: 2, mx: 1, borderRadius: 2, bgcolor: 'action.hover' }}>
<Typography variant="subtitle1" sx={{ fontWeight: 700 }}>
Кабинет
</Typography>
@@ -83,12 +86,23 @@ export function MeLayoutPage() {
{user.name?.trim() || user.email}
</Typography>
</Box>
<Divider />
<Divider sx={{ my: 1 }} />
<List disablePadding>
{navItems.map((i) => (
<ListItemButton
key={i.to}
selected={activeTo === i.to}
sx={{
mx: 1,
mb: 0.5,
borderRadius: 2,
'&.Mui-selected': {
bgcolor: 'primary.50',
},
'&.Mui-selected:hover': {
bgcolor: 'primary.100',
},
}}
onClick={() => {
navigate(i.to)
setMobileOpen(false)
@@ -119,14 +133,38 @@ export function MeLayoutPage() {
{isMobile ? (
<>
<Stack direction="row" spacing={1} sx={{ width: '100%', alignItems: 'center' }}>
<IconButton onClick={() => setMobileOpen(true)} aria-label="Открыть меню профиля">
<MenuOutlinedIcon />
<IconButton
onClick={() => setMobileOpen(true)}
aria-label="Открыть меню кабинета"
sx={{
borderRadius: 2,
border: 1,
borderColor: 'divider',
bgcolor: 'background.paper',
}}
>
<TuneOutlinedIcon />
</IconButton>
<Typography variant="h5" sx={{ fontWeight: 700 }}>
Профиль
</Typography>
</Stack>
<Drawer open={mobileOpen} onClose={() => setMobileOpen(false)} ModalProps={{ keepMounted: true }}>
<Drawer
open={mobileOpen}
onClose={() => setMobileOpen(false)}
anchor="right"
ModalProps={{ keepMounted: true }}
slotProps={{
paper: {
sx: {
borderTopLeftRadius: 16,
borderBottomLeftRadius: 16,
borderLeft: 1,
borderColor: 'divider',
},
},
}}
>
{nav}
</Drawer>
</>