create (axiosRoles , SettingRoles)

This commit is contained in:
ArtChaos189 2023-04-20 18:42:18 +03:00
parent bb1d35367c
commit 24202ed52c
7 changed files with 9569 additions and 9627 deletions

@ -1,3 +1,4 @@
import makeRequest from "@root/kitUI/makeRequest";
import {
GetMessagesRequest,
GetMessagesResponse,
@ -8,8 +9,9 @@ import {
import { authStore } from "@root/stores/auth";
import ReconnectingEventSource from "reconnecting-eventsource";
// const { makeRequest } = authStore();
const supportApiUrl = "https://admin.pena.digital/heruvym";
const { makeRequest } = authStore();
export function subscribeToAllTickets({
onMessage,

@ -1,12 +1,17 @@
import * as React from "react";
import CssBaseline from "@mui/material/CssBaseline";
import { SnackbarProvider } from "notistack";
import { ThemeProvider } from "@mui/material/styles";
import { createRoot } from "react-dom/client";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import CssBaseline from "@mui/material/CssBaseline";
import { ThemeProvider } from "@mui/material/styles";
import { SnackbarProvider } from "notistack";
import theme from "./theme";
import PublicRoute from "@kitUI/publicRoute";
import PrivateRoute from "@kitUI/privateRoute";
import Signin from "@pages/Authorization/signin";
import Signup from "@pages/Authorization/signup";
import Restore from "@pages/Authorization/restore";
@ -18,7 +23,9 @@ import Entities from "@pages/dashboard/Content/Entities";
import Tariffs from "@pages/dashboard/Content/Tariffs";
import DiscountManagement from "@pages/dashboard/Content/DiscountManagement";
import PromocodeManagement from "@pages/dashboard/Content/PromocodeManagement";
import Support from "@root/pages/dashboard/Content/Support/Support";
import { SettingRoles } from "@pages/Setting/SettingRoles";
import Support from "@pages/dashboard/Content/Support/Support";
import "./index.css";
const componentsArray = [
@ -88,8 +95,16 @@ root.render(
</PrivateRoute>
}
>
<Route
path="/settingRoles"
element={
<PrivateRoute>
<SettingRoles />
</PrivateRoute>
}
/>
{componentsArray.map((e: any, i) => (
<Route key={i} path={e[0]} element={e[1]} />
<Route key={e} path={e[0]} element={e[1]} />
))}
</Route>

@ -0,0 +1,142 @@
import { useState } from "react";
import {
AccordionDetails,
Button,
Checkbox,
FormControl,
InputLabel,
ListItemText,
MenuItem,
OutlinedInput,
Select,
SelectChangeEvent,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
TextField,
Typography,
} from "@mui/material";
import theme from "../../theme";
const ITEM_HEIGHT = 48;
const ITEM_PADDING_TOP = 8;
const MenuProps = {
PaperProps: {
style: {
maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,
},
},
};
const names = ["admin", "user"];
export const SettingRoles = () => {
const [personName, setPersonName] = useState<string[]>([]);
const handleChange = (event: SelectChangeEvent<typeof personName>) => {
const {
target: { value },
} = event;
setPersonName(
// On autofill we get a stringified value.
typeof value === "string" ? value.split(",") : value
);
};
return (
<AccordionDetails>
<Table
sx={{
width: "890px",
border: "2px solid",
borderColor: theme.palette.secondary.main,
}}
aria-label="simple table"
>
<TableHead>
<TableRow
sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
}}
>
<TableCell>
<Typography
variant="h4"
sx={{
color: theme.palette.secondary.main,
}}
>
Насторйки ролей
</Typography>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow
sx={{
p: "5px",
display: "flex",
alignItems: "center",
borderTop: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
cursor: "pointer",
}}
>
<TextField
placeholder="название"
fullWidth
sx={{
alignItems: "center",
width: "400px",
"& .MuiInputBase-root": {
backgroundColor: "#F2F3F7",
height: "48px",
},
}}
inputProps={{
sx: {
borderRadius: "10px",
fontSize: "18px",
lineHeight: "21px",
py: 0,
},
}}
/>
<Button sx={{ ml: "5px", bgcolor: "#fe9903", color: "white" }}>Отправить</Button>
<FormControl sx={{ ml: "25px", width: "80%" }}>
<InputLabel sx={{ color: "black", bg: "black" }} id="demo-multiple-checkbox-label">
Role
</InputLabel>
<Select
sx={{ bgcolor: "white", height: "48px" }}
labelId="demo-multiple-checkbox-label"
id="demo-multiple-checkbox"
multiple
value={personName}
onChange={handleChange}
input={<OutlinedInput label="Role" />}
renderValue={(selected) => selected.join(", ")}
MenuProps={MenuProps}
>
{names.map((name) => (
<MenuItem key={name} value={name}>
<Checkbox checked={personName.indexOf(name) > -1} />
<ListItemText primary={name} />
</MenuItem>
))}
</Select>
</FormControl>
</TableRow>
</TableBody>
</Table>
</AccordionDetails>
);
};

@ -1,5 +1,5 @@
import * as React from "react";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { Box, Typography, TextField, Button } from "@mui/material";
import Table from "@mui/material/Table";
import TableHead from "@mui/material/TableHead";
@ -8,17 +8,17 @@ import TableCell from "@mui/material/TableCell";
import TableRow from "@mui/material/TableRow";
import Radio from "@mui/material/Radio";
import Skeleton from "@mui/material/Skeleton";
import Accordion from '@mui/material/Accordion';
import AccordionSummary from '@mui/material/AccordionSummary';
import AccordionDetails from '@mui/material/AccordionDetails';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import ClearIcon from '@mui/icons-material/Clear';
import Accordion from "@mui/material/Accordion";
import AccordionSummary from "@mui/material/AccordionSummary";
import AccordionDetails from "@mui/material/AccordionDetails";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import ClearIcon from "@mui/icons-material/Clear";
import { getRoles_mock, TMockData } from "../../../api/roles";
import theme from "../../../theme"
import theme from "../../../theme";
import axios from "axios";
const Users: React.FC = () => {
const radioboxes = [ "a", "b", "c" ];
const Users: React.FC = () => {
const radioboxes = ["a", "b", "c"];
const [selectedValue, setSelectedValue] = React.useState("a");
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
@ -28,220 +28,249 @@ const Users: React.FC = () => {
const navigate = useNavigate();
const [data, setData] = React.useState<TMockData>([]);
const handleChangeData = () => {
getRoles_mock().then((mockdata) => {
setData( mockdata );
})
setData(mockdata);
});
};
const [accordionHeader, setAccordionHeader] = React.useState<string>("none");
const [accordionState, setAccordionState] = React.useState<boolean>(true);
const [accordionText, setAccordionText] = React.useState<string>("");
const handleChangeAccordion = (text:string) => {
if( text == "" ) {
setAccordionState( true );
const handleChangeAccordion = (text: string) => {
if (text == "") {
setAccordionState(true);
setAccordionHeader("none");
}
else {
} else {
handleToggleAccordion();
setAccordionHeader("flex")
setAccordionHeader("flex");
}
accordionState
? setAccordionText( text )
: setAccordionText( "" )
}
accordionState ? setAccordionText(text) : setAccordionText("");
};
const handleToggleAccordion = () => {
setAccordionState( !accordionState );
}
setAccordionState(!accordionState);
};
handleChangeData();
const [roles, setRoles] = React.useState<TMockData>([]);
React.useEffect(() => {
const axiosRoles = async () => {
const response = await axios({
method: "get",
url: "https://admin.pena.digital/strator/role/",
});
return response;
};
axiosRoles().then((result) => {
setRoles(result.data);
});
}, []);
return (
<React.Fragment>
<Button
variant="text"
onClick={ () => navigate("/modalAdmin") }
sx={{
width: "84%",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
marginBottom: "35px",
border: "2px solid",
fontWeight: "normal",
borderColor: theme.palette.golden.main,
color: theme.palette.secondary.main,
"&:hover": {
backgroundColor: theme.palette.menu.main
}
}}>
ИНФОРМАЦИЯ О ПРОЕКТЕ
</Button>
<Accordion sx={{
<Button
variant="text"
onClick={() => navigate("/modalAdmin")}
sx={{
width: "84%",
backgroundColor: theme.palette.content.main
}} expanded={ accordionState }>
<AccordionSummary
sx = {{ display: accordionHeader }}
expandIcon={
<ExpandMoreIcon sx={{
color: theme.palette.secondary.main
}}
onClick={ () => handleToggleAccordion() }
/>
}
aria-controls="panel1a-content"
id="panel1a-header"
>
<Typography sx={{
width: "100%",
color: theme.palette.secondary.main
}}>
{ accordionText }
</Typography>
<Box sx={{
display: "flex",
alignItems: "right"
}}>
<ClearIcon
sx={{ color: theme.palette.secondary.main }}
onClick={ () => handleChangeAccordion("") }
/>
</Box>
</AccordionSummary>
<AccordionDetails>
<Table sx={{
width: "100%",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
marginBottom: "35px",
border: "2px solid",
borderColor: theme.palette.secondary.main,
}} aria-label="simple table">
<TableHead>
<TableRow sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px"
}}>
<TableCell>
<Typography
variant="h4"
sx={{
color: theme.palette.secondary.main,
}}>
Имя
</Typography>
</TableCell>
<TableCell>
<Typography
variant="h4"
sx={{
color: theme.palette.secondary.main,
}}>
Описание
</Typography>
</TableCell>
<TableCell>
<Typography
variant="h4"
sx={{
color: theme.palette.secondary.main,
}}>
Отобразить
</Typography>
</TableCell>
</TableRow>
</TableHead>
fontWeight: "normal",
borderColor: theme.palette.golden.main,
color: theme.palette.secondary.main,
"&:hover": {
backgroundColor: theme.palette.menu.main,
},
}}
>
ИНФОРМАЦИЯ О ПРОЕКТЕ
</Button>
<TableBody>
<Accordion
sx={{
width: "84%",
backgroundColor: theme.palette.content.main,
}}
expanded={accordionState}
>
<AccordionSummary
sx={{ display: accordionHeader }}
expandIcon={
<ExpandMoreIcon
sx={{
color: theme.palette.secondary.main,
}}
onClick={() => handleToggleAccordion()}
/>
}
aria-controls="panel1a-content"
id="panel1a-header"
>
<Typography
sx={{
width: "100%",
color: theme.palette.secondary.main,
}}
>
{accordionText}
</Typography>
{
data.length
? (
data.map(function(item, i) {
return(
<TableRow sx={{
borderTop: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
cursor: "pointer"
}}
key={ item.key }
onClick={ () => handleChangeAccordion( item.desc ) }>
<Box
sx={{
display: "flex",
alignItems: "right",
}}
>
<ClearIcon sx={{ color: theme.palette.secondary.main }} onClick={() => handleChangeAccordion("")} />
</Box>
</AccordionSummary>
<AccordionDetails>
<Table
sx={{
width: "100%",
border: "2px solid",
borderColor: theme.palette.secondary.main,
}}
aria-label="simple table"
>
<TableHead>
<TableRow
sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
}}
>
<TableCell>
<Typography
variant="h4"
sx={{
color: theme.palette.secondary.main,
}}
>
Имя
</Typography>
</TableCell>
<TableCell>
<Typography
variant="h4"
sx={{
color: theme.palette.secondary.main,
}}
>
Описание
</Typography>
</TableCell>
<TableCell>
<Typography
variant="h4"
sx={{
color: theme.palette.secondary.main,
}}
>
Отобразить
</Typography>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{data.length ? (
data.map(function (item, index) {
return (
<TableRow
sx={{
borderTop: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
cursor: "pointer",
}}
key={item.key}
onClick={() => handleChangeAccordion(item.desc)}
>
<TableCell>
<Typography sx={{
color: theme.palette.secondary.main
}}>
{ item.name }
</Typography>
</TableCell>
<TableCell>
<Typography sx={{
color: theme.palette.secondary.main
}}>
{ item.desc }
</Typography>
</TableCell>
<TableCell>
<Radio
checked={selectedValue === radioboxes[ i ]}
onChange={handleChange}
value={ radioboxes[ i ] }
<Typography
sx={{
"&, &.Mui-checked": {
color: theme.palette.secondary.main,
},
}} />
}}
>
{item.name}
</Typography>
</TableCell>
<TableCell>
<Typography
sx={{
color: theme.palette.secondary.main,
}}
>
{item.desc}
</Typography>
</TableCell>
<TableCell>
<Radio
checked={selectedValue === radioboxes[index]}
onChange={handleChange}
value={radioboxes[index]}
sx={{
"&, &.Mui-checked": {
color: theme.palette.secondary.main,
},
}}
/>
</TableCell>
</TableRow>
);
})
) : (
<TableRow sx={{
borderTop: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px"
}}>
) : (
<TableRow
sx={{
borderTop: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
}}
>
<TableCell colSpan={3}>
<Skeleton variant="rectangular"
<Skeleton
variant="rectangular"
sx={{
width: "100%",
minWidth: "100%",
minHeight: "200px",
marginTop: "15px",
marginBottom: "15px"
marginBottom: "15px",
}}
/>
</TableCell>
</TableRow>
)
}
</TableBody>
</Table>
)}
</TableBody>
</Table>
</AccordionDetails>
</Accordion>
<Box sx={{
width: "90%",
marginTop: "35px"
}}>
<Box
sx={{
width: "90%",
marginTop: "35px",
}}
>
<Box sx={{ display: "flex" }}>
<TextField
id = "standard-basic"
label = "id"
variant = "filled"
color = "secondary"
sx = {{
width: "80%"
id="standard-basic"
label="id"
variant="filled"
color="secondary"
sx={{
width: "80%",
}}
InputProps={{
style: {
@ -249,43 +278,46 @@ const Users: React.FC = () => {
color: theme.palette.secondary.main,
borderBottom: "1px solid",
borderColor: theme.palette.grayLight.main,
} }}
},
}}
InputLabelProps={{
style: {
color: theme.palette.secondary.main
} }}
color: theme.palette.secondary.main,
},
}}
/>
<Box
sx={{
display: 'flex',
justifyContent: 'center',
maxWidth: '317px',
width: '100%'
display: "flex",
justifyContent: "center",
maxWidth: "317px",
width: "100%",
}}
>
<Button
variant = "text"
variant="text"
sx={{
backgroundColor: theme.palette.content.main,
color: theme.palette.secondary.main,
// width: "20%",
"&:hover": {
backgroundColor: theme.palette.content.main
}
}}>
НАЙТИ
backgroundColor: theme.palette.content.main,
},
}}
>
НАЙТИ
</Button>
</Box>
</Box>
<Box sx={{ display: "flex" }}>
<TextField
id = "standard-basic"
label = "mail"
variant = "filled"
color = "secondary"
sx = {{
width: "80%"
id="standard-basic"
label="mail"
variant="filled"
color="secondary"
sx={{
width: "80%",
}}
InputProps={{
style: {
@ -293,56 +325,63 @@ const Users: React.FC = () => {
color: theme.palette.secondary.main,
borderBottom: "1px solid",
borderColor: theme.palette.grayLight.main,
} }}
},
}}
InputLabelProps={{
style: {
color: theme.palette.secondary.main
} }}
color: theme.palette.secondary.main,
},
}}
/>
<Box
sx={{
display: 'flex',
justifyContent: 'center',
maxWidth: '317px',
width: '100%'
}}
sx={{
display: "flex",
justifyContent: "center",
maxWidth: "317px",
width: "100%",
}}
>
<Button
variant = "text"
variant="text"
sx={{
backgroundColor: theme.palette.content.main,
color: theme.palette.secondary.main,
width: "20%",
"&:hover": {
backgroundColor: theme.palette.content.main
}
}}>
СБРОСИТЬ
backgroundColor: theme.palette.content.main,
},
}}
>
СБРОСИТЬ
</Button>
</Box>
</Box>
</Box>
<Table sx={{
width: "90%",
border: "2px solid",
borderColor: theme.palette.grayLight.main,
marginTop: "35px",
}} aria-label="simple table">
<Table
sx={{
width: "90%",
border: "2px solid",
borderColor: theme.palette.grayLight.main,
marginTop: "35px",
}}
aria-label="simple table"
>
<TableHead>
<TableRow sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px"
}}>
<TableRow
sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
}}
>
<TableCell sx={{ textAlign: "center" }}>
<Typography
variant="h4"
<Typography
variant="h4"
sx={{
color: theme.palette.secondary.main,
}}>
color: theme.palette.secondary.main,
}}
>
ID
</Typography>
</TableCell>
@ -350,46 +389,61 @@ const Users: React.FC = () => {
</TableHead>
<TableBody>
<TableRow sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
cursor: "pointer"
}} onClick={ () => navigate("/modalUser") }>
<TableRow
sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
cursor: "pointer",
}}
onClick={() => navigate("/modalUser")}
>
<TableCell sx={{ textAlign: "center" }}>
<Typography sx={{
color: theme.palette.secondary.main
}}>
<Typography
sx={{
color: theme.palette.secondary.main,
}}
>
1
</Typography>
</TableCell>
</TableRow>
<TableRow sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
cursor: "pointer"
}} onClick={ () => navigate("/modalUser") }>
<TableRow
sx={{
borderBottom: "2px solid",
borderColor: theme.palette.grayLight.main,
height: "100px",
cursor: "pointer",
}}
onClick={() => navigate("/modalUser")}
>
<TableCell sx={{ textAlign: "center" }}>
<Typography sx={{
color: theme.palette.secondary.main
}}>
<Typography
sx={{
color: theme.palette.secondary.main,
}}
>
2
</Typography>
</TableCell>
</TableRow>
<TableRow sx={{
borderBottom: "1px solid",
border: theme.palette.secondary.main,
height: "100px",
cursor: "pointer"
}} onClick={ () => navigate("/modalUser") }>
<TableRow
sx={{
borderBottom: "1px solid",
border: theme.palette.secondary.main,
height: "100px",
cursor: "pointer",
}}
onClick={() => navigate("/modalUser")}
>
<TableCell sx={{ textAlign: "center" }}>
<Typography sx={{
color: theme.palette.secondary.main
}}>
<Typography
sx={{
color: theme.palette.secondary.main,
}}
>
3
</Typography>
</TableCell>
@ -398,7 +452,6 @@ const Users: React.FC = () => {
</Table>
</React.Fragment>
);
}
};
export default Users;
export default Users;

@ -1,13 +1,13 @@
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';
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";
import theme from "../../../theme";
import CssBaseline from "@mui/material/CssBaseline";
import Toolbar from "@mui/material/Toolbar";
@ -21,44 +21,44 @@ 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 { 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';
import { Link } from "react-router-dom";
import useMediaQuery from "@mui/material/useMediaQuery";
import Paper from "@mui/material/Paper";
const drawerWidth = 240;
const openedMixin = (theme: Theme): CSSObject => ({
width: drawerWidth,
background: '#2f3339',
transition: theme.transitions.create('width', {
background: "#2f3339",
transition: theme.transitions.create("width", {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
overflowX: 'hidden',
overflowX: "hidden",
});
const closedMixin = (theme: Theme): CSSObject => ({
transition: theme.transitions.create('width', {
transition: theme.transitions.create("width", {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
overflowX: 'hidden',
overflowX: "hidden",
width: `calc(${theme.spacing(7)} + 1px)`,
background: '#2f3339',
// marginTop: '20px',
[theme.breakpoints.up('sm')]: {
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',
const DrawerHeader = styled("div")(({ theme }) => ({
display: "flex",
alignItems: "center",
justifyContent: "flex-end",
padding: theme.spacing(0, 1),
...theme.mixins.toolbar,
}));
@ -68,178 +68,181 @@ interface AppBarProps extends MuiAppBarProps {
}
const AppBar = styled(MuiAppBar, {
shouldForwardProp: (prop) => prop !== 'open',
shouldForwardProp: (prop) => prop !== "open",
})<AppBarProps>(({ theme, open }) => ({
zIndex: theme.zIndex.drawer + 1,
transition: theme.transitions.create(['width', 'margin'], {
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'], {
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),
}),
}),
);
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),
}),
}));
const links: {path: string; element: JSX.Element; title: string, className: string} [] =[
{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'},
]
const links: { path: string; element: JSX.Element; title: string; className: string }[] = [
{ 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: "/settingRoles", element: <SettingsIcon />, title: "Настройки", className: "menu" },
{ path: "/jjj", element: <CameraIcon />, title: "Камера", className: "menu" },
{ path: "/support", element: <HeadsetMicOutlinedIcon />, title: "Служба поддержки", className: "menu" },
];
const Navigation = (props: any) => {
return (
<List
sx={{
background: "#2f3339",
}}
>
{links.map((e, i) => (
<ListItem key={i} disablePadding sx={{ display: "block" }}>
<Link to={e.path} style={{ textDecoration: "none" }} className={e.className}>
<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>
);
};
const Navigation = (props:any) => {
return (
<List
sx={{
background: '#2f3339'
}}
>
{links.map((e, i) => (
<ListItem key={i} disablePadding sx={{ display: 'block' }}>
<Link to={e.path} style={{textDecoration: 'none'}} className={e.className}>
<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>
)
}
const Menu: React.FC = () => {
const tablet = useMediaQuery("(max-width:600px)");
const mobile = useMediaQuery("(max-width:340px)");
const Menu: React.FC = () => {
const tablet = useMediaQuery('(max-width:600px)');
const theme = useTheme();
const [open, setOpen] = React.useState(tablet ? false : true);
const mobile = useMediaQuery('(max-width:340px)');
const handleDrawerOpen = () => {
if (!mobile) {
setOpen(true);
} else {
SladeMobileHC();
}
};
const theme = useTheme();
const [open, setOpen] = React.useState(tablet? false : true);
const handleDrawerClose = () => {
setOpen(false);
};
const handleDrawerOpen = () => {
if (!mobile) {setOpen(true)}
else {SladeMobileHC()}
};
const handleDrawerClose = () => {
setOpen(false);
};
const [sladeMobile, setSladeMobile] = React.useState(false)
const SladeMobileHC = () => {
if (mobile) {setSladeMobile(old=>!old)}
};
const [sladeMobile, setSladeMobile] = React.useState(false);
const SladeMobileHC = () => {
if (mobile) {
setSladeMobile((old) => !old);
}
};
return (
<React.Fragment>
<Box sx={{ display: 'flex' }}>
<Box sx={{ display: "flex" }}>
<CssBaseline />
<AppBar open={open}>
<AppBar open={open}>
<Toolbar
sx={{
background: '#2f3339',
borderBottom: '1px solid',
borderColor: '#45494c',
}}
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'
}}
aria-label="open drawer"
onClick={handleDrawerOpen}
edge="start"
sx={{
marginRight: 5,
...(open && { display: "none" }),
color: "#eaba5b",
background: "#2f3339",
}}
>
<MenuIcon />
</IconButton>
<Header />
</Toolbar>
</AppBar>
{!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}
</Box>
{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>
{!mobile ? (
<Drawer variant="permanent" open={open}>
<DrawerHeader style={{ minHeight: "86px" }}>
<IconButton onClick={handleDrawerClose} sx={{ color: "#eaba5b" }}>
<ChevronLeftIcon />
</IconButton>
</DrawerHeader>
<Divider />
<Navigation visible={true} SladeMobileHC={SladeMobileHC}/></Paper> : null}
<Navigation visible={open} />
</Drawer>
) : null}
</Box>
{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}
</React.Fragment>
);
}
};
export default Menu;
export default Menu;

@ -48,10 +48,10 @@ async function makeRequest<TRequest, TResponse>({
url,
body,
useToken = true,
signal,
contentType = false,
HC,
token,
signal,
}: MakeRequest<TRequest>) {
//В случае 401 рефреш должен попробовать вызваться 1 раз
let counterRefresh = true;

18127
yarn.lock

File diff suppressed because it is too large Load Diff