asb_cloud_front/src/pages/Main.jsx

93 lines
2.9 KiB
React
Raw Normal View History

import { Layout, Menu, } from 'antd' // Button,
import { FundViewOutlined, FolderOutlined } from '@ant-design/icons' // UserOutlined, MenuOutlined,
2021-04-02 17:22:34 +05:00
import { useState } from 'react'
import { Switch, Route, Redirect, Link} from "react-router-dom"
import Wells from './Wells'
2021-04-16 15:50:01 +05:00
import TelemetryView from './TelemetryView'
2021-04-02 17:22:34 +05:00
import Files from './Files'
import Archive from './Archive'
import Messages from './Messages'
import Report from './Report'
import Analise from './Analise'
import PageHeader from './Header'
2021-04-02 17:22:34 +05:00
const { Content, Sider } = Layout // Header
2021-04-02 17:22:34 +05:00
export default function Main(){
const [sidebarVisible] = useState(true) // setSidebarVisible
// const login = localStorage['login']
2021-04-02 17:22:34 +05:00
// let handleLogout = () => {
// localStorage.removeItem('login')
// localStorage.removeItem('token')
// }
2021-04-02 17:22:34 +05:00
return(
<Layout>
<PageHeader />
2021-04-02 17:22:34 +05:00
<Layout>
{sidebarVisible &&
<Sider width={200} className="site-layout-background">
<Menu
mode="inline"
defaultSelectedKeys={['1']}
defaultOpenKeys={['sub1']}
style={{ height: '100%', borderRight: 0 }}
>
<Menu.Item key="1" icon= {<FundViewOutlined />}>
<Link to="/well">Мониторинг</Link>
</Menu.Item>
<Menu.Item key="2" icon= {<FolderOutlined />}>
<Link to="/archive">Архив</Link>
2021-04-16 15:50:01 +05:00
</Menu.Item>
<Menu.Item key="3" icon= {<FolderOutlined />}>
<Link to="/messages">Сообщения</Link>
2021-04-16 15:50:01 +05:00
</Menu.Item>
<Menu.Item key="4" icon= {<FolderOutlined />}>
<Link to="/report">Рапорт</Link>
2021-04-16 15:50:01 +05:00
</Menu.Item>
<Menu.Item key="5" icon= {<FolderOutlined />}>
<Link to="/analise">Анализ</Link>
2021-04-16 15:50:01 +05:00
</Menu.Item>
<Menu.Item key="6" icon= {<FolderOutlined />}>
<Link to="/file">Файлы</Link>
2021-04-02 17:22:34 +05:00
</Menu.Item>
</Menu>
</Sider>
}
<Layout>
<Content className="site-layout-background sheet">
<Switch>
<Route path="/file">
<Files />
</Route>
<Route path="/archive">
<Archive />
</Route>
<Route path="/messages">
<Messages />
</Route>
<Route path="/report">
<Report />
</Route>
<Route path="/analise">
<Analise />
</Route>
2021-04-02 17:22:34 +05:00
<Route path="/well/:id">
2021-04-16 15:50:01 +05:00
<TelemetryView/>
2021-04-02 17:22:34 +05:00
</Route>
<Route path="/well">
<Wells />
</Route>
<Route path="/">
<Redirect to={{pathname: "/well"}}/>
</Route>
</Switch>
</Content>
</Layout>
</Layout>
</Layout>
);
}