1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00
Files
seahub/frontend/src/pages/sys-admin/index.js
2019-06-06 13:33:22 +08:00

69 lines
1.9 KiB
JavaScript

import React from 'react';
import ReactDOM from 'react-dom';
import { Router } from '@reach/router';
import { siteRoot } from '../../utils/constants';
import SidePanel from './side-panel';
import MainPanel from './main-panel';
import FileScanRecords from './file-scan-records';
import WorkWeixinDepartments from './work-weixin-departments';
import '../../assets/css/fa-solid.css';
import '../../assets/css/fa-regular.css';
import '../../assets/css/fontawesome.css';
import '../../css/layout.css';
import '../../css/toolbar.css';
class SysAdmin extends React.Component {
constructor(props) {
super(props);
this.state = {
isSidePanelClosed: false,
currentTab: 'file-scan',
};
}
componentDidMount() {
let href = window.location.href.split('/');
this.setState({currentTab: href[href.length - 2]});
}
onCloseSidePanel = () => {
this.setState({isSidePanelClosed: !this.state.isSidePanelClosed});
}
tabItemClick = (param) => {
this.setState({currentTab: param});
}
render() {
let { currentTab, isSidePanelClosed, } = this.state;
return (
<div id="main">
<SidePanel isSidePanelClosed={isSidePanelClosed} onCloseSidePanel={this.onCloseSidePanel} currentTab={currentTab}/>
<MainPanel>
<Router className="reach-router">
<FileScanRecords
path={siteRoot + 'sys/file-scan-records'}
currentTab={currentTab}
tabItemClick={this.tabItemClick}
/>
</Router>
<Router className="reach-router">
<WorkWeixinDepartments
path={siteRoot + 'sys/work-weixin/departments'}
currentTab={currentTab}
tabItemClick={this.tabItemClick}
/>
</Router>
</MainPanel>
</div>
);
}
}
ReactDOM.render(
<SysAdmin />,
document.getElementById('wrapper')
);