1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-30 21:50:59 +00:00
seahub/frontend/src/app.js
shanshuirenjia 3a67d78016 clean package.json and repair code style (#2411)
* clean package.json and repair code style

* update css style

* repair bug
2018-09-29 18:32:53 +08:00

63 lines
1.6 KiB
JavaScript

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Router } from '@reach/router';
import { siteRoot } from './components/constants';
import SidePanel from './components/side-panel';
import MainPanel from './components/main-panel';
import DraftsView from './pages/drafts/drafts-view';
import FilesActivities from './pages/dashboard/files-activities';
import 'seafile-ui';
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';
import './css/search.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
isOpen: false,
isSidePanelClosed: false,
};
}
onCloseSidePanel = () => {
this.setState({
isSidePanelClosed: !this.state.isSidePanelClosed
});
}
onShowSidePanel = () => {
this.setState({
isSidePanelClosed: !this.state.isSidePanelClosed
});
}
render() {
let href = window.location.href.split('/');
let currentTab = href[href.length - 2];
return (
<div id="main">
<SidePanel isSidePanelClosed={this.state.isSidePanelClosed} onCloseSidePanel={this.onCloseSidePanel} currentTab={currentTab} />
<MainPanel onShowSidePanel={this.onShowSidePanel}>
<Router>
<FilesActivities path={siteRoot + 'dashboard'} />
<DraftsView path={siteRoot + 'drafts'} />
</Router>
</MainPanel>
</div>
);
}
}
ReactDOM.render(
<App />,
document.getElementById('wrapper')
);