summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-12 16:50:45 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:06:00 +0200
commitf3dbecbf55832df686d6969756640f6f5853f996 (patch)
treedc70c5a04e77f6138f86fcd04b2ca9c808bf5037 /src/components
parentcbf8eb9cbf2f4082cb1a83955d435ebcb73be3ab (diff)
Add experiments route
Diffstat (limited to 'src/components')
-rw-r--r--src/components/map/MapStageComponent.js15
-rw-r--r--src/components/navigation/AppNavbar.js39
2 files changed, 46 insertions, 8 deletions
diff --git a/src/components/map/MapStageComponent.js b/src/components/map/MapStageComponent.js
index 10d84948..62d8687c 100644
--- a/src/components/map/MapStageComponent.js
+++ b/src/components/map/MapStageComponent.js
@@ -20,18 +20,25 @@ class MapStageComponent extends React.Component {
mouseY: 0
};
+ constructor() {
+ super();
+
+ this.updateDimensions = this.updateDimensions.bind(this);
+ this.updateScale = this.updateScale.bind(this);
+ }
+
componentWillMount() {
this.updateDimensions();
}
componentDidMount() {
- window.addEventListener("resize", this.updateDimensions.bind(this));
- window.addEventListener("wheel", this.updateScale.bind(this));
+ window.addEventListener("resize", this.updateDimensions);
+ window.addEventListener("wheel", this.updateScale);
}
componentWillUnmount() {
- window.removeEventListener("resize", this.updateDimensions.bind(this));
- window.removeEventListener("wheel", this.updateScale.bind(this));
+ window.removeEventListener("resize", this.updateDimensions);
+ window.removeEventListener("wheel", this.updateScale);
}
updateDimensions() {
diff --git a/src/components/navigation/AppNavbar.js b/src/components/navigation/AppNavbar.js
index 83959f08..94eaa7fa 100644
--- a/src/components/navigation/AppNavbar.js
+++ b/src/components/navigation/AppNavbar.js
@@ -1,21 +1,52 @@
import React from 'react';
+import FontAwesome from "react-fontawesome";
import Mailto from "react-mailto";
import {Link} from "react-router-dom";
import Navbar, {NavItem} from "./Navbar";
import "./Navbar.css";
-const AppNavbar = () => (
+const AppNavbar = ({simulationId, inSimulation}) => (
<Navbar>
+ {inSimulation ?
+ <NavItem route={"/simulations/" + simulationId}>
+ <Link
+ className="nav-link"
+ title="Build"
+ to={"/simulations/" + simulationId}>
+ <FontAwesome name="industry" className="mr-1"/>
+ Build
+ </Link>
+ </NavItem> :
+ undefined
+ }
+ {inSimulation ?
+ <NavItem route={"/simulations/" + simulationId + "/experiments"}>
+ <Link
+ className="nav-link"
+ title="Simulate"
+ to={"/simulations/" + simulationId + "/experiments"}>
+ <FontAwesome name="play" className="mr-1"/>
+ Simulate
+ </Link>
+ </NavItem> :
+ undefined
+ }
<NavItem route="/simulations">
- <Link className="nav-link simulations" title="Simulations" to="/simulations">Simulations</Link>
+ <Link
+ className="nav-link"
+ title="My Simulations"
+ to="/simulations">
+ <FontAwesome name="list" className="mr-1"/>
+ My Simulations
+ </Link>
</NavItem>
<NavItem route="email">
- <Mailto className="nav-link support" title="Support" email="opendc@atlarge-research.com"
+ <Mailto className="nav-link" title="Support" email="opendc@atlarge-research.com"
headers={{subject: "OpenDC Support"}}>
+ <FontAwesome name="envelope" className="mr-1"/>
Support
</Mailto>
</NavItem>
-
</Navbar>
);