blob: fb4454cc99b9bcf8f2452044b8769498de1e8462 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import React, {Component} from 'react';
import './App.scss';
import Header from "./Header";
import MainPane from "../components/panels/MainPane";
import Footer from "./Footer";
import {BrowserRouter as Router} from "react-router-dom";
import Filters from "./Filters";
import backend from "../backend";
import ConfigurationPane from "../components/panels/ConfigurationPane";
class App extends Component {
constructor(props) {
super(props);
this.state = {};
}
componentDidMount() {
backend.get("/api/services").then(_ => this.setState({configured: true}));
}
render() {
let modal;
if (this.state.filterWindowOpen && this.state.configured) {
modal = <Filters onHide={() => this.setState({filterWindowOpen: false})}/>;
}
return (
<div className="main">
<Router>
<div className="main-header">
<Header onOpenFilters={() => this.setState({filterWindowOpen: true})} />
</div>
<div className="main-content">
{this.state.configured ? <MainPane /> :
<ConfigurationPane onConfigured={() => this.setState({configured: true})} />}
{modal}
</div>
<div className="main-footer">
{this.state.configured && <Footer/>}
</div>
</Router>
</div>
);
}
}
export default App;
|