diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-18 16:52:11 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:06:04 +0200 |
| commit | f8f617c97fcb2df3dbefc9527d974151e367cb60 (patch) | |
| tree | f6405aa54f73b66220f36e3a388725f71d023cfb /src/routes | |
| parent | 9f86ae6de969baa625e3341c796c64f63b5153ce (diff) | |
Implement basic experiment mode with timeline
The timeline doesn't trigger anything yet, but the visual element is in place and connected.
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/index.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/routes/index.js b/src/routes/index.js index 8a155cb0..96ac885c 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -10,17 +10,29 @@ import Simulations from "../pages/Simulations"; const ProtectedComponent = (component) => () => userIsLoggedIn() ? component : <Redirect to="/"/>; const AppComponent = ({match}) => userIsLoggedIn() ? - <App simulationId={parseInt(match.params.id, 10)}/> : <Redirect to="/"/>; + <App simulationId={parseInt(match.params.simulationId, 10)}/> : + <Redirect to="/"/>; + const ExperimentsComponent = ({match}) => userIsLoggedIn() ? - <Experiments simulationId={parseInt(match.params.id, 10)}/> : <Redirect to="/"/>; + <Experiments simulationId={parseInt(match.params.simulationId, 10)}/> : + <Redirect to="/"/>; + +const SimulationComponent = ({match}) => userIsLoggedIn() ? + <App + simulationId={parseInt(match.params.simulationId, 10)} + inSimulation={true} + experimentId={parseInt(match.params.experimentId, 10)} + /> : + <Redirect to="/"/>; const Routes = () => ( <BrowserRouter> <Switch> <Route exact path="/" component={Home}/> <Route exact path="/simulations" render={ProtectedComponent(<Simulations/>)}/> - <Route exact path="/simulations/:id" component={AppComponent}/> - <Route exact path="/simulations/:id/experiments" component={ExperimentsComponent}/> + <Route exact path="/simulations/:simulationId" component={AppComponent}/> + <Route exact path="/simulations/:simulationId/experiments" component={ExperimentsComponent}/> + <Route exact path="/simulations/:simulationId/experiments/:experimentId" component={SimulationComponent}/> <Route exact path="/profile" render={ProtectedComponent(<Profile/>)}/> <Route path="/*" component={NotFound}/> </Switch> |
