asb_cloud_front/src/pages/Well.jsx

66 lines
2.7 KiB
React
Raw Normal View History

import { memo, useContext, useMemo } from 'react'
2021-08-27 14:21:48 +05:00
import {
FolderOutlined,
FundViewOutlined,
FilePdfOutlined,
2021-09-01 15:55:23 +05:00
ExperimentOutlined,
DeploymentUnitOutlined,
} from '@ant-design/icons'
import { Layout } from 'antd'
import { useParams } from 'react-router-dom'
2022-01-25 02:00:07 +05:00
import { IdWellContext, RootPathContext } from '@asb/context'
import { PrivateMenu, PrivateSwitch } from '@components/Private'
2022-01-25 02:00:07 +05:00
import Measure from './Measure'
import Reports from './Reports'
import Analytics from './Analytics'
2022-01-25 02:00:07 +05:00
import Documents from './Documents'
import Telemetry from './Telemetry'
import WellOperations from './WellOperations'
2022-01-25 02:00:07 +05:00
import DrillingProgram from './DrillingProgram'
2021-04-16 15:50:01 +05:00
import '@styles/index.css'
const { Content } = Layout
2021-04-16 15:50:01 +05:00
export const Well = memo(() => {
const { idWell, tab } = useParams()
const root = useContext(RootPathContext)
const rootPath = useMemo(() => `${root}/well/${idWell}`, [root, idWell])
return (
<RootPathContext.Provider value={rootPath}>
<Layout>
<PrivateMenu mode={'horizontal'} selectable={true} selectedKeys={[tab]} className={'well_menu'}>
<PrivateMenu.Link key={'telemetry'} icon={<FundViewOutlined />} title={'Телеметрия'}/>
<PrivateMenu.Link key={'reports'} icon={<FilePdfOutlined />} title={'Рапорта'} />
<PrivateMenu.Link key={'analytics'} icon={<DeploymentUnitOutlined />} title={'Аналитика'} />
<PrivateMenu.Link key={'operations'} icon={<FolderOutlined />} title={'Операции по скважине'} />
<PrivateMenu.Link key={'document'} icon={<FolderOutlined />} title={'Документы'} />
<PrivateMenu.Link key={'measure'} icon={<ExperimentOutlined />} title={'Измерения'} />
<PrivateMenu.Link key={'drillingProgram'} icon={<FolderOutlined />} title={'Программа бурения'} />
</PrivateMenu>
<IdWellContext.Provider value={idWell}>
<Layout>
<Content className={'site-layout-background'}>
<PrivateSwitch elseRedirect={['telemetry', 'reports', 'analytics', 'operations', 'telemetryAnalysis', 'document', 'measure', 'drillingProgram']}>
<Telemetry key={'telemetry/:tab?'} />
<Reports key={'reports/:tab?'} />
<Analytics key={'analytics/:tab?'} />
<WellOperations key={'operations/:tab?'} />
<Documents key={'document/:category?'} />
<Measure key={'measure'} />
<DrillingProgram key={'drillingProgram'} />
</PrivateSwitch>
</Content>
</Layout>
</IdWellContext.Provider>
</Layout>
</RootPathContext.Provider>
)
})
2022-01-25 02:00:07 +05:00
export default Well