blob: 6c101facbb0f4f6430245f632901d8c4c9c315df (
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
50
51
52
|
import React, {Component} from 'react';
import Header from "./Header";
import MainPane from "./MainPane";
import Footer from "./Footer";
import {BrowserRouter as Router, Route, Switch} from "react-router-dom";
import Services from "./Services";
import Filters from "./Filters";
import Rules from "./Rules";
class App extends Component {
constructor(props) {
super(props);
this.state = {
servicesWindowOpen: false,
filterWindowOpen: false,
rulesWindowOpen: false
};
}
render() {
let modal;
if (this.state.servicesWindowOpen) {
modal = <Services onHide={() => this.setState({servicesWindowOpen: false})}/>;
}
if (this.state.filterWindowOpen) {
modal = <Filters onHide={() => this.setState({filterWindowOpen: false})}/>;
}
if (this.state.rulesWindowOpen) {
modal = <Rules onHide={() => this.setState({rulesWindowOpen: false})}/>;
}
return (
<div className="app">
<Router>
<Header onOpenServices={() => this.setState({servicesWindowOpen: true})}
onOpenFilters={() => this.setState({filterWindowOpen: true})}
onOpenRules={() => this.setState({rulesWindowOpen: true})} />
<Switch>
<Route path="/connections/:id" children={<MainPane/>}/>
<Route path="/" children={<MainPane/>}/>
</Switch>
{modal}
<Footer/>
</Router>
</div>
);
}
}
export default App;
|