adminFront/src/pages/dashboard/Menu/index.tsx

187 lines
5.8 KiB
TypeScript
Raw Normal View History

2022-09-08 17:21:17 +00:00
import * as React from "react";
import { Box } from "@mui/material";
2022-10-17 08:55:00 +00:00
import { useNavigate, useLocation } from "react-router-dom";
2022-09-08 17:21:17 +00:00
import MenuOutlinedIcon from '@mui/icons-material/MenuOutlined';
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";
2022-09-08 17:21:17 +00:00
const Menu: React.FC = () => {
2022-10-01 14:06:54 +00:00
const navigate = useNavigate();
2022-10-17 08:55:00 +00:00
const pages = [ "null", "users", "entities", "tariffs", "discounts", "promocode", "null", "null", "support" ];
const colors = [
"null",
theme.palette.golden.main,
theme.palette.golden.main,
theme.palette.golden.main,
theme.palette.golden.main,
theme.palette.golden.main,
theme.palette.golden.main,
theme.palette.golden.main,
theme.palette.golden.main ];
const location = useLocation();
pages.forEach( (item, i) => {
if( location.pathname == `/${pages[i]}` ) colors[ i ] = theme.palette.secondary.main
} );
2022-10-01 14:06:54 +00:00
const changePage = (page:number) => { navigate(`/${pages[ page ]}`); }
2022-09-08 17:21:17 +00:00
return (
<React.Fragment>
<Box sx={{
2022-09-09 13:54:49 +00:00
backgroundColor: theme.palette.menu.main,
2022-09-08 17:21:17 +00:00
width: "96px",
height: "100vh",
2022-09-13 16:16:57 +00:00
borderRight: "1px solid #45494c",
2022-10-01 14:06:54 +00:00
overflow: "auto"
2022-09-08 17:21:17 +00:00
}}>
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
}}>
2022-09-13 16:16:57 +00:00
<MenuOutlinedIcon sx={{
transform: "scale(1.4)"
}} />
2022-09-08 17:21:17 +00:00
</Box>
<Box sx={{
2022-09-19 11:45:58 +00:00
height: "calc( 100vh - 85px )",
overflowY: "auto",
2022-09-13 16:16:57 +00:00
'&::-webkit-scrollbar': {
display: "none"
}
2022-09-08 17:21:17 +00:00
}}>
2022-09-13 16:16:57 +00:00
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
2022-10-17 08:55:00 +00:00
}} onClick={ () => changePage( 1 ) }>
2022-09-13 16:16:57 +00:00
<PersonOutlineOutlinedIcon sx={{
2022-10-17 08:55:00 +00:00
color: colors[ 1 ],
2022-09-13 16:16:57 +00:00
transform: "scale(1.2)"
2022-10-17 08:55:00 +00:00
}} />
2022-09-13 16:16:57 +00:00
</Box>
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
2022-10-17 08:55:00 +00:00
}} onClick={ () => changePage( 2 ) }>
2022-09-13 16:16:57 +00:00
<SettingsOutlinedIcon sx={{
2022-10-17 08:55:00 +00:00
color: colors[ 2 ],
2022-09-13 16:16:57 +00:00
transform: "scale(1.2)"
2022-10-17 08:55:00 +00:00
}} />
2022-09-13 16:16:57 +00:00
</Box>
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
2022-10-17 08:55:00 +00:00
}} onClick={ () => changePage( 3 ) }>
2022-09-13 16:16:57 +00:00
<BathtubOutlinedIcon sx={{
2022-10-17 08:55:00 +00:00
color: colors[ 3 ],
2022-09-13 16:16:57 +00:00
transform: "scale(1.2)"
2022-10-17 08:55:00 +00:00
}} />
2022-09-13 16:16:57 +00:00
</Box>
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
2022-10-17 08:55:00 +00:00
}} onClick={ () => changePage( 4 ) }>
2022-09-13 16:16:57 +00:00
<AddPhotoAlternateOutlinedIcon sx={{
2022-10-17 08:55:00 +00:00
color: colors[ 4 ],
2022-09-13 16:16:57 +00:00
transform: "scale(1.2)"
2022-10-17 08:55:00 +00:00
}} />
2022-09-13 16:16:57 +00:00
</Box>
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
2022-10-17 08:55:00 +00:00
}} onClick={ () => changePage( 5 ) }>
2022-09-13 16:16:57 +00:00
<NaturePeopleOutlinedIcon sx={{
2022-10-17 08:55:00 +00:00
color: colors[ 5 ],
2022-09-13 16:16:57 +00:00
transform: "scale(1.2)"
2022-10-17 08:55:00 +00:00
}} />
2022-09-13 16:16:57 +00:00
</Box>
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
2022-10-17 08:55:00 +00:00
}} onClick={ () => changePage( 6 ) }>
2022-09-13 16:16:57 +00:00
<SettingsIcon sx={{
2022-10-17 08:55:00 +00:00
color: colors[ 6 ],
2022-09-13 16:16:57 +00:00
transform: "scale(1.2)"
2022-10-17 08:55:00 +00:00
}} />
2022-09-13 16:16:57 +00:00
</Box>
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
2022-10-17 08:55:00 +00:00
}} onClick={ () => changePage( 7 ) }>
2022-09-13 16:16:57 +00:00
<CameraIcon sx={{
2022-10-17 08:55:00 +00:00
color: colors[ 7 ],
2022-09-13 16:16:57 +00:00
transform: "scale(1.2)"
2022-10-17 08:55:00 +00:00
}} />
2022-09-13 16:16:57 +00:00
</Box>
<Box sx={{
width: "100%",
height: "85px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer"
2022-10-17 08:55:00 +00:00
}} onClick={ () => changePage( 8 ) }>
2022-09-13 16:16:57 +00:00
<HeadsetMicOutlinedIcon sx={{
2022-10-17 08:55:00 +00:00
color: colors[ 8 ],
2022-09-13 16:16:57 +00:00
transform: "scale(1.2)"
2022-10-17 08:55:00 +00:00
}} />
2022-09-13 16:16:57 +00:00
</Box>
2022-09-08 17:21:17 +00:00
</Box>
2022-09-13 16:16:57 +00:00
2022-09-08 17:21:17 +00:00
</Box>
</React.Fragment>
);
}
export default Menu;