38 lines
980 B
TypeScript
38 lines
980 B
TypeScript
import { Box, Flex } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
import { Navigate, Route, Routes } from 'react-router-dom';
|
|
|
|
import Sidebar from '../Sidebar';
|
|
import Orders from '../Orders';
|
|
import Masters from '../Masters';
|
|
import { URLs } from '../../__data__/urls';
|
|
|
|
const LayoutArm = () => {
|
|
let defaultRedirect = null;
|
|
|
|
if (URLs.armOrder.isOn) {
|
|
defaultRedirect = URLs.armOrder.url;
|
|
} else if (URLs.armMaster.isOn) {
|
|
defaultRedirect = URLs.armMaster.url;
|
|
}
|
|
|
|
return (
|
|
<Flex h='100vh'>
|
|
<Sidebar />
|
|
<Box flex='1' bg='gray.50'>
|
|
<Routes>
|
|
<Route index element={<Navigate to={defaultRedirect} replace />} />
|
|
{URLs.armOrder.isOn && (
|
|
<Route path={URLs.armOrder.url} element={<Orders />} />
|
|
)}
|
|
{URLs.armMaster.isOn && (
|
|
<Route path={URLs.armMaster.url} element={<Masters />} />
|
|
)}
|
|
</Routes>
|
|
</Box>
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default LayoutArm;
|