2022-09-08 17:21:17 +00:00
|
|
|
|
import * as React from "react";
|
|
|
|
|
import { Box } from "@mui/material";
|
|
|
|
|
import PersonOutlineOutlinedIcon from '@mui/icons-material/PersonOutlineOutlined';
|
|
|
|
|
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
|
|
|
|
|
import BathtubOutlinedIcon from '@mui/icons-material/BathtubOutlined';
|
|
|
|
|
import AddPhotoAlternateOutlinedIcon from '@mui/icons-material/AddPhotoAlternateOutlined';
|
|
|
|
|
import NaturePeopleOutlinedIcon from '@mui/icons-material/NaturePeopleOutlined';
|
|
|
|
|
import SettingsIcon from '@mui/icons-material/Settings';
|
|
|
|
|
import CameraIcon from '@mui/icons-material/Camera';
|
|
|
|
|
import HeadsetMicOutlinedIcon from '@mui/icons-material/HeadsetMicOutlined';
|
2022-09-20 14:35:49 +00:00
|
|
|
|
import theme from "../../../theme";
|
2023-01-07 22:58:14 +00:00
|
|
|
|
import CssBaseline from "@mui/material/CssBaseline";
|
|
|
|
|
import Toolbar from "@mui/material/Toolbar";
|
|
|
|
|
import IconButton from "@mui/material/IconButton";
|
|
|
|
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
|
|
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
|
|
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
|
|
|
import Divider from "@mui/material/Divider";
|
|
|
|
|
import List from "@mui/material/List";
|
|
|
|
|
import ListItem from "@mui/material/ListItem";
|
|
|
|
|
import ListItemButton from "@mui/material/ListItemButton";
|
|
|
|
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
|
|
|
import ListItemText from "@mui/material/ListItemText";
|
|
|
|
|
import {CSSObject, styled, Theme, useTheme} from "@mui/material/styles";
|
|
|
|
|
import MuiDrawer from '@mui/material/Drawer';
|
|
|
|
|
import MuiAppBar, { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar';
|
|
|
|
|
import Header from "../Header/index";
|
|
|
|
|
import {Link} from 'react-router-dom';
|
|
|
|
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
2023-01-10 02:27:03 +00:00
|
|
|
|
import Paper from "@mui/material/Paper";
|
2023-01-07 22:58:14 +00:00
|
|
|
|
|
|
|
|
|
const drawerWidth = 240;
|
|
|
|
|
|
|
|
|
|
const openedMixin = (theme: Theme): CSSObject => ({
|
|
|
|
|
width: drawerWidth,
|
|
|
|
|
background: '#2f3339',
|
|
|
|
|
transition: theme.transitions.create('width', {
|
|
|
|
|
easing: theme.transitions.easing.sharp,
|
|
|
|
|
duration: theme.transitions.duration.enteringScreen,
|
|
|
|
|
}),
|
|
|
|
|
overflowX: 'hidden',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const closedMixin = (theme: Theme): CSSObject => ({
|
|
|
|
|
transition: theme.transitions.create('width', {
|
|
|
|
|
easing: theme.transitions.easing.sharp,
|
|
|
|
|
duration: theme.transitions.duration.leavingScreen,
|
|
|
|
|
}),
|
|
|
|
|
overflowX: 'hidden',
|
|
|
|
|
width: `calc(${theme.spacing(7)} + 1px)`,
|
|
|
|
|
background: '#2f3339',
|
|
|
|
|
// marginTop: '20px',
|
|
|
|
|
[theme.breakpoints.up('sm')]: {
|
|
|
|
|
width: `calc(${theme.spacing(8)} + 1px)`,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const DrawerHeader = styled('div')(({ theme }) => ({
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'flex-end',
|
|
|
|
|
padding: theme.spacing(0, 1),
|
|
|
|
|
...theme.mixins.toolbar,
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
interface AppBarProps extends MuiAppBarProps {
|
|
|
|
|
open?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const AppBar = styled(MuiAppBar, {
|
|
|
|
|
shouldForwardProp: (prop) => prop !== 'open',
|
|
|
|
|
})<AppBarProps>(({ theme, open }) => ({
|
|
|
|
|
zIndex: theme.zIndex.drawer + 1,
|
|
|
|
|
transition: theme.transitions.create(['width', 'margin'], {
|
|
|
|
|
easing: theme.transitions.easing.sharp,
|
|
|
|
|
duration: theme.transitions.duration.leavingScreen,
|
|
|
|
|
}),
|
|
|
|
|
...(open && {
|
|
|
|
|
marginLeft: drawerWidth,
|
|
|
|
|
width: `calc(100% - ${drawerWidth}px)`,
|
|
|
|
|
transition: theme.transitions.create(['width', 'margin'], {
|
|
|
|
|
easing: theme.transitions.easing.sharp,
|
|
|
|
|
duration: theme.transitions.duration.enteringScreen,
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
|
|
|
|
|
({ theme, open }) => ({
|
|
|
|
|
width: drawerWidth,
|
|
|
|
|
flexShrink: 0,
|
|
|
|
|
boxSizing: 'border-box',
|
|
|
|
|
...(open && {
|
|
|
|
|
...openedMixin(theme),
|
|
|
|
|
'& .MuiDrawer-paper': openedMixin(theme),
|
|
|
|
|
}),
|
|
|
|
|
...(!open && {
|
|
|
|
|
...closedMixin(theme),
|
|
|
|
|
'& .MuiDrawer-paper': closedMixin(theme),
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
2023-02-28 18:54:19 +00:00
|
|
|
|
const links: {path: string; element: JSX.Element; title: string, className: string} [] =[
|
2023-03-06 15:32:00 +00:00
|
|
|
|
{path: '/users', element: <PersonOutlineOutlinedIcon/>, title: 'Информация о проекте', className:'menu'},
|
|
|
|
|
{path: '/entities', element: <SettingsOutlinedIcon/>, title: 'Юридические лица', className:'menu'},
|
|
|
|
|
{path: '/tariffs', element: <BathtubOutlinedIcon/>, title: 'Шаблонизатор документов', className:'menu'},
|
|
|
|
|
{path: '/discounts', element: <AddPhotoAlternateOutlinedIcon/>, title: 'Скидки', className:'menu'},
|
|
|
|
|
{path: '/promocode', element: <NaturePeopleOutlinedIcon/>, title: 'Промокод', className:'menu'},
|
|
|
|
|
{path: '/kkk', element: <SettingsIcon/>, title: 'Настройки', className:'menu'},
|
|
|
|
|
{path: '/jjj', element: <CameraIcon/>, title: 'Камера', className:'menu'},
|
|
|
|
|
{path: '/support', element: <HeadsetMicOutlinedIcon/>, title: 'Служба поддержки', className:'menu'},
|
2023-01-07 22:58:14 +00:00
|
|
|
|
]
|
2022-09-08 17:21:17 +00:00
|
|
|
|
|
|
|
|
|
|
2023-01-10 02:27:03 +00:00
|
|
|
|
const Navigation = (props:any) => {
|
|
|
|
|
return (
|
|
|
|
|
<List
|
|
|
|
|
sx={{
|
|
|
|
|
background: '#2f3339'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{links.map((e, i) => (
|
2023-02-18 14:03:45 +00:00
|
|
|
|
<ListItem key={i} disablePadding sx={{ display: 'block' }}>
|
2023-02-28 18:54:19 +00:00
|
|
|
|
<Link to={e.path} style={{textDecoration: 'none'}} className={e.className}>
|
2023-01-10 02:27:03 +00:00
|
|
|
|
<ListItemButton onClick={props.SladeMobileHC}
|
|
|
|
|
sx={{
|
|
|
|
|
minHeight: 48,
|
|
|
|
|
height: '50px',
|
|
|
|
|
justifyContent: props.visible ? 'initial' : 'center',
|
|
|
|
|
px: 2.5,
|
|
|
|
|
margin: '20px 0'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<ListItemIcon
|
|
|
|
|
sx={{
|
|
|
|
|
minWidth: 0,
|
|
|
|
|
mr: props.visible ? 3 : 'auto',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
color: '#eaba5b',
|
|
|
|
|
transform: 'scale(1.2)'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{e.element}
|
|
|
|
|
</ListItemIcon>
|
|
|
|
|
<ListItemText primary={e.title}
|
|
|
|
|
sx={{
|
|
|
|
|
opacity: props.visible ? 1 : 0,
|
|
|
|
|
color: '#eaba5b',
|
|
|
|
|
}} />
|
|
|
|
|
</ListItemButton>
|
|
|
|
|
</Link>
|
|
|
|
|
</ListItem>
|
|
|
|
|
))}
|
|
|
|
|
</List>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-09-08 17:21:17 +00:00
|
|
|
|
const Menu: React.FC = () => {
|
2023-01-10 02:27:03 +00:00
|
|
|
|
const tablet = useMediaQuery('(max-width:600px)');
|
2023-01-07 22:58:14 +00:00
|
|
|
|
|
2023-01-10 02:27:03 +00:00
|
|
|
|
const mobile = useMediaQuery('(max-width:340px)');
|
2023-01-07 22:58:14 +00:00
|
|
|
|
|
|
|
|
|
const theme = useTheme();
|
2023-01-10 02:27:03 +00:00
|
|
|
|
const [open, setOpen] = React.useState(tablet? false : true);
|
2023-01-07 22:58:14 +00:00
|
|
|
|
|
|
|
|
|
const handleDrawerOpen = () => {
|
2023-01-10 02:27:03 +00:00
|
|
|
|
if (!mobile) {setOpen(true)}
|
|
|
|
|
else {SladeMobileHC()}
|
2023-01-07 22:58:14 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleDrawerClose = () => {
|
|
|
|
|
setOpen(false);
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-10 02:27:03 +00:00
|
|
|
|
const [sladeMobile, setSladeMobile] = React.useState(false)
|
|
|
|
|
const SladeMobileHC = () => {
|
|
|
|
|
if (mobile) {setSladeMobile(old=>!old)}
|
|
|
|
|
};
|
2022-10-01 14:06:54 +00:00
|
|
|
|
|
2022-09-08 17:21:17 +00:00
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
2023-01-07 22:58:14 +00:00
|
|
|
|
<Box sx={{ display: 'flex' }}>
|
|
|
|
|
<CssBaseline />
|
2023-01-10 02:27:03 +00:00
|
|
|
|
<AppBar open={open}>
|
2023-01-07 22:58:14 +00:00
|
|
|
|
<Toolbar
|
|
|
|
|
sx={{
|
|
|
|
|
background: '#2f3339',
|
|
|
|
|
borderBottom: '1px solid',
|
|
|
|
|
borderColor: '#45494c',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<IconButton
|
|
|
|
|
aria-label="open drawer"
|
|
|
|
|
onClick={handleDrawerOpen}
|
|
|
|
|
edge="start"
|
|
|
|
|
sx={{
|
|
|
|
|
marginRight: 5,
|
|
|
|
|
...(open && { display: 'none' }),
|
|
|
|
|
color: "#eaba5b",
|
|
|
|
|
background: '#2f3339'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<MenuIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
<Header />
|
|
|
|
|
</Toolbar>
|
|
|
|
|
</AppBar>
|
2023-01-10 02:27:03 +00:00
|
|
|
|
{!mobile ? <Drawer variant="permanent" open={open}>
|
|
|
|
|
<DrawerHeader style={{minHeight: '86px',}}>
|
|
|
|
|
<IconButton onClick={handleDrawerClose} sx={{color: "#eaba5b"}}>
|
|
|
|
|
<ChevronLeftIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
</DrawerHeader>
|
|
|
|
|
<Divider />
|
|
|
|
|
<Navigation visible={open}/>
|
|
|
|
|
</Drawer> : null}
|
2022-09-08 17:21:17 +00:00
|
|
|
|
</Box>
|
2023-01-10 02:27:03 +00:00
|
|
|
|
{sladeMobile ? <Paper
|
|
|
|
|
sx={{
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
width: '100%',
|
|
|
|
|
background: '#2f3339',
|
|
|
|
|
zIndex: theme.zIndex.drawer + 3
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{display: 'flex',
|
|
|
|
|
justifyContent: 'end',
|
|
|
|
|
padding: '10px'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<IconButton onClick={SladeMobileHC} sx={{color: "#eaba5b"}}>
|
|
|
|
|
<ChevronLeftIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
</Box>
|
|
|
|
|
<Divider />
|
|
|
|
|
<Navigation visible={true} SladeMobileHC={SladeMobileHC}/></Paper> : null}
|
2022-09-08 17:21:17 +00:00
|
|
|
|
</React.Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default Menu;
|