маршрутизация
This commit is contained in:
parent
0cf9066868
commit
ca6030ba6f
@ -1,9 +1,18 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
|
import Users from "./Users";
|
||||||
|
import Promocode from "./Promocode";
|
||||||
|
import Support from "./Support";
|
||||||
import Tariffs from "./Tariffs";
|
import Tariffs from "./Tariffs";
|
||||||
|
|
||||||
|
|
||||||
const Content: React.FC = () => {
|
export interface MWProps {
|
||||||
|
section: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const Content: React.FC<MWProps> = ({ section }) => {
|
||||||
|
const componentsArray = [ <Users />, <Promocode />, <Support />, <Tariffs /> ];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Box sx={{
|
<Box sx={{
|
||||||
@ -16,7 +25,8 @@ const Content: React.FC = () => {
|
|||||||
overflowY: "auto",
|
overflowY: "auto",
|
||||||
padding: "60px"
|
padding: "60px"
|
||||||
}}>
|
}}>
|
||||||
<Tariffs />
|
|
||||||
|
{ componentsArray[ section ] }
|
||||||
</Box>
|
</Box>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
@ -11,8 +11,11 @@ import theme from "../../theme";
|
|||||||
import { useMatch } from "react-router-dom";
|
import { useMatch } from "react-router-dom";
|
||||||
|
|
||||||
|
|
||||||
const LoggedIn: React.FC = () => {
|
export interface MWProps {
|
||||||
|
section: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const LoggedIn: React.FC<MWProps> = ({ section }) => {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
@ -38,7 +41,7 @@ const LoggedIn: React.FC = () => {
|
|||||||
alignItems: "center"
|
alignItems: "center"
|
||||||
}}>
|
}}>
|
||||||
<Header />
|
<Header />
|
||||||
<Content />
|
<Content section={ section } />
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -15,10 +15,14 @@ root.render(
|
|||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={ <Authorization /> } />
|
<Route path="/" element={ <Authorization /> } />
|
||||||
<Route path="/dispatch" element={ <Sections /> } />
|
<Route path="/dispatch" element={ <Sections /> } />
|
||||||
<Route path="/users" element={ <LoggedIn /> } />
|
|
||||||
|
|
||||||
<Route path="/modalAdmin" element={ <LoggedIn /> } />
|
<Route path="/users" element={ <LoggedIn section={0} /> } />
|
||||||
<Route path="/modalUser" element={ <LoggedIn /> } />
|
<Route path="/promocode" element={ <LoggedIn section={1} /> } />
|
||||||
|
<Route path="/support" element={ <LoggedIn section={2} /> } />
|
||||||
|
<Route path="/tariffs" element={ <LoggedIn section={3} /> } />
|
||||||
|
|
||||||
|
<Route path="/modalAdmin" element={ <LoggedIn section={-1} /> } />
|
||||||
|
<Route path="/modalUser" element={ <LoggedIn section={-1} /> } />
|
||||||
<Route
|
<Route
|
||||||
path="*"
|
path="*"
|
||||||
element={ <Error404 /> }
|
element={ <Error404 /> }
|
||||||
|
Loading…
Reference in New Issue
Block a user