blob: 229eaed4fed1a3c0ed93377862558bbfc0cca971 (
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
53
54
55
56
57
58
59
|
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";
import Config from "./Config";
class App extends Component {
constructor(props) {
super(props);
this.state = {
servicesWindowOpen: false,
filterWindowOpen: false,
rulesWindowOpen: false,
configWindowOpen: 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})}/>;
}
if (this.state.configWindowOpen) {
modal = <Config onHide={() => this.setState({configWindowOpen: false})}/>;
}
return (
<div className="app">
<Router>
<Header onOpenServices={() => this.setState({servicesWindowOpen: true})}
onOpenFilters={() => this.setState({filterWindowOpen: true})}
onOpenRules={() => this.setState({rulesWindowOpen: true})}
onOpenConfig={() => this.setState({configWindowOpen: true})}
/>
<Switch>
<Route path="/connections/:id" children={<MainPane/>}/>
<Route path="/" children={<MainPane/>}/>
</Switch>
{modal}
<Footer/>
</Router>
</div>
);
}
}
export default App;
|