2022-04-19 15:38:53 +05:00
|
|
|
import { createContext, memo } from 'react'
|
2022-02-07 14:58:38 +05:00
|
|
|
import { Route, Switch } from 'react-router-dom'
|
|
|
|
|
|
|
|
import { AdminLayoutPortal, LayoutPortal } from '@components/Layout'
|
|
|
|
import { PrivateDefaultRoute, PrivateRoute } from '@components/Private'
|
|
|
|
|
2021-12-02 15:21:10 +05:00
|
|
|
import Well from './Well'
|
2022-02-07 14:58:38 +05:00
|
|
|
import Cluster from './Cluster'
|
|
|
|
import Deposit from './Deposit'
|
2021-12-02 15:21:10 +05:00
|
|
|
import AdminPanel from './AdminPanel'
|
2022-02-07 14:58:38 +05:00
|
|
|
import AccessDenied from './AccessDenied'
|
2021-04-02 17:22:34 +05:00
|
|
|
|
2022-04-19 15:38:53 +05:00
|
|
|
export const RootPathContext = createContext('')
|
|
|
|
|
2022-02-07 14:58:38 +05:00
|
|
|
export const Main = memo(() => (
|
2022-04-19 15:38:53 +05:00
|
|
|
<RootPathContext.Provider value={''}>
|
|
|
|
<Switch>
|
|
|
|
<PrivateRoute path={'/admin/:tab?'}>
|
|
|
|
<AdminLayoutPortal title={'Администраторская панель'}>
|
|
|
|
<AdminPanel />
|
|
|
|
</AdminLayoutPortal>
|
|
|
|
</PrivateRoute>
|
|
|
|
<PrivateRoute path={'/deposit'}>
|
|
|
|
<LayoutPortal noSheet title='Месторождение'>
|
|
|
|
<Deposit />
|
|
|
|
</LayoutPortal>
|
|
|
|
</PrivateRoute>
|
|
|
|
<PrivateRoute path={'/cluster/:idCluster'}>
|
|
|
|
<LayoutPortal title={'Анализ скважин куста'}>
|
|
|
|
<Cluster />
|
|
|
|
</LayoutPortal>
|
|
|
|
</PrivateRoute>
|
|
|
|
<PrivateRoute path={'/well/:idWell/:tab?'}>
|
|
|
|
<LayoutPortal>
|
|
|
|
<Well />
|
|
|
|
</LayoutPortal>
|
|
|
|
</PrivateRoute>
|
|
|
|
<Route path={'/access_denied'}>
|
|
|
|
<AccessDenied />
|
|
|
|
</Route>
|
|
|
|
<PrivateDefaultRoute urls={['/deposit']} />
|
|
|
|
</Switch>
|
|
|
|
</RootPathContext.Provider>
|
2022-02-07 14:58:38 +05:00
|
|
|
))
|
2021-12-02 15:21:10 +05:00
|
|
|
|
|
|
|
export default Main
|