diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-06-29 15:47:09 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 16:08:41 +0200 |
| commit | 90fae26aa4bd0e0eb3272ff6e6524060e9004fbb (patch) | |
| tree | bf6943882f5fa5f3114c01fc571503c79ee1056d /src/routes/index.js | |
| parent | 7032a007d4431f5a0c4c5e2d3f3bd20462d49950 (diff) | |
Prepare frontend repository for monorepo
This change prepares the frontend Git repository for the monorepo
residing at https://github.com/atlarge-research.com/opendc. To
accomodate for this, we move all files into a frontend subdirectory.
Diffstat (limited to 'src/routes/index.js')
| -rw-r--r-- | src/routes/index.js | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/routes/index.js b/src/routes/index.js deleted file mode 100644 index f7523458..00000000 --- a/src/routes/index.js +++ /dev/null @@ -1,64 +0,0 @@ -import React from "react"; -import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom"; -import { userIsLoggedIn } from "../auth/index"; -import App from "../pages/App"; -import Experiments from "../pages/Experiments"; -import Home from "../pages/Home"; -import NotFound from "../pages/NotFound"; -import Profile from "../pages/Profile"; -import Simulations from "../pages/Simulations"; - -const ProtectedComponent = component => () => - userIsLoggedIn() ? component : <Redirect to="/" />; -const AppComponent = ({ match }) => - userIsLoggedIn() ? ( - <App simulationId={parseInt(match.params.simulationId, 10)} /> - ) : ( - <Redirect to="/" /> - ); - -const ExperimentsComponent = ({ match }) => - userIsLoggedIn() ? ( - <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/: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> - </BrowserRouter> -); - -export default Routes; |
