Skip to content

Commit

Permalink
Move routes to the dedicated file
Browse files Browse the repository at this point in the history
closes #70
  • Loading branch information
synowa committed Mar 4, 2021
1 parent 4beac70 commit 81856f7
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 43 deletions.
47 changes: 4 additions & 43 deletions client/src/components/App/index.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,9 @@
import './style.scss';
import React, { Fragment } from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Landing from '../../domain/Landing';
import SignUp from '../../domain/Auth/SignUp';
import Login from '../../domain/Auth/Login';
import MovieList from '../../domain/MovieList';
import Navbar from '../Navbar/index';
import React from 'react';

function App() {
return (
<Router>
<Fragment>
<Navbar />
<div className="App">
<Route exact path="/" component={Landing} />
<Switch>
{/* http://localhost:3000/movies */}
<Route exact path="/movies" component={MovieList} />
{/* http://localhost:3000/signup */}
<Route exact path="/signup" component={SignUp} />
{/* http://localhost:3000/login */}
<Route exact path="/login" component={Login} />
{/* http://localhost:3000/logout */}
{/* <Route exact path='/login' component={ Logout }/> */}
{/* http://localhost:3000/users/me */}
{/* <Route exact path='/users/me' component={ UserProfile }/> */}
{/* http://localhost:3000/reservation/pre/:screeningId */}
{/* <Route path='/reservation/pre/:screeningId' component={ ReservationPreview }/> */}
{/* http://localhost:3000/reservation/chooseSeats/:screeningId */}
{/* <Route path='/reservation/chooseSeats/:screeningId' component={ ReservationDetails }/> */}
{/* http://localhost:3000/reservation/details/:reservationId */}
{/* <Route path='/reservation/details/:reservationId' component={ ReservationConfirmation }/> */}
{/* http://localhost:3000/reservation/payment/:reservationId */}
{/* <Route path='/reservation/payment/:reservationId' component={ ReservationPayment }/> */}
{/* http://localhost:3000/reservation/confirm/:reservationId */}
{/* <Route path='/reservation/confirm/:reservationId' component={ ReservationConfirmation }/> */}
import Routes from '../Routes/Routes.js';

{/* <PrivateRoute exact path='/admin' component={ Admin }/> */}
{/* http://localhost:3000/admin */}
</Switch>
</div>
</Fragment>
</Router>
);
function App() {
return <Routes />;
}

export default App;
7 changes: 7 additions & 0 deletions client/src/components/Loader/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import './style.scss';

function Loader() {
return <div className="loader">To be continued...</div>;
}

export default Loader;
5 changes: 5 additions & 0 deletions client/src/components/Loader/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import '../../styles/variables';
.loader {
background-color: $color-primary;
color: $text-color-secondary;
}
56 changes: 56 additions & 0 deletions client/src/components/Routes/Routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import '../App/style.scss';
import React, { Fragment, lazy, Suspense } from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Loader from '../Loader';

const Landing = lazy(() => import('../../domain/Landing'));

const SignUp = lazy(() => import('../../domain/Auth/SignUp'));

const Login = lazy(() => import('../../domain/Auth/Login'));

const MovieList = lazy(() => import('../../domain/MovieList'));

const Navbar = lazy(() => import('../Navbar/index'));

function Routes() {
return (
<Suspense fallback={<Loader />}>
<Router>
<Fragment>
<Navbar />
<div className="App">
<Route exact path="/" component={Landing} />
<Switch>
{/* http://localhost:3000/movies */}
<Route exact path="/movies" component={MovieList} />
{/* http://localhost:3000/signup */}
<Route exact path="/signup" component={SignUp} />
{/* http://localhost:3000/login */}
<Route exact path="/login" component={Login} />
{/* http://localhost:3000/logout */}
{/* <Route exact path='/login' component={ Logout }/> */}
{/* http://localhost:3000/users/me */}
{/* <Route exact path='/users/me' component={ UserProfile }/> */}
{/* http://localhost:3000/reservation/pre/:screeningId */}
{/* <Route path='/reservation/pre/:screeningId' component={ ReservationPreview }/> */}
{/* http://localhost:3000/reservation/chooseSeats/:screeningId */}
{/* <Route path='/reservation/chooseSeats/:screeningId' component={ ReservationDetails }/> */}
{/* http://localhost:3000/reservation/details/:reservationId */}
{/* <Route path='/reservation/details/:reservationId' component={ ReservationConfirmation }/> */}
{/* http://localhost:3000/reservation/payment/:reservationId */}
{/* <Route path='/reservation/payment/:reservationId' component={ ReservationPayment }/> */}
{/* http://localhost:3000/reservation/confirm/:reservationId */}
{/* <Route path='/reservation/confirm/:reservationId' component={ ReservationConfirmation }/> */}

{/* <PrivateRoute exact path='/admin' component={ Admin }/> */}
{/* http://localhost:3000/admin */}
</Switch>
</div>
</Fragment>
</Router>
</Suspense>
);
}

export default Routes;

0 comments on commit 81856f7

Please sign in to comment.