aboutsummaryrefslogtreecommitdiff
path: root/modern/src/MainPage.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/MainPage.js')
-rw-r--r--modern/src/MainPage.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js
new file mode 100644
index 00000000..02d98dca
--- /dev/null
+++ b/modern/src/MainPage.js
@@ -0,0 +1,49 @@
+import React, { Component } from 'react';
+import ContainerDimensions from 'react-container-dimensions';
+import MainToobar from './MainToolbar';
+import MainMap from './MainMap';
+
+class MainPage extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ loading: true
+ };
+ }
+
+ componentDidMount() {
+ fetch('/api/session').then(response => {
+ if (response.ok) {
+ this.setState({
+ loading: false
+ });
+ } else {
+ this.props.history.push('/login');
+ }
+ });
+ }
+
+ render() {
+ const { loading } = this.state;
+ if (loading) {
+ return (
+ <div>Loading...</div>
+ );
+ } else {
+ return (
+ <div style={{height: "100vh", display: "flex", flexDirection: "column"}}>
+ <div style={{flex: 0}}>
+ <MainToobar />
+ </div>
+ <div style={{flex: 1}}>
+ <ContainerDimensions>
+ <MainMap/>
+ </ContainerDimensions>
+ </div>
+ </div>
+ );
+ }
+ }
+}
+
+export default MainPage;