|
@@ -1,19 +1,70 @@
|
|
|
import React from 'react'
|
|
|
import { Switch, Route } from "react-router-dom";
|
|
|
+import { connect } from "react-redux";
|
|
|
+
|
|
|
import AdminMainPage from './conteiners/adminMainPage/adminMainPage';
|
|
|
-import AdminAddEventPage from './conteiners/adminAddEventPage/adminAddEventPage'
|
|
|
+import AdminAddEventPage from './conteiners/adminAddEventPage/adminAddEventPage';
|
|
|
+import Home from './conteiners/home/Home';
|
|
|
+import Login from './conteiners/login/Login';
|
|
|
+
|
|
|
import EventReduxForm from "./components/eventForm/eventReduxForm"
|
|
|
import AdminAddPhotogalarytPage from "./conteiners/adminPhotogalaryPage/adminPhotogalaryPage"
|
|
|
+import Sidebar from './components/sidebar/Sidebar';
|
|
|
+
|
|
|
+export class Router extends React.Component {
|
|
|
+ render() {
|
|
|
+ const { showSidebarBool } = this.props
|
|
|
+ return(
|
|
|
+ <>
|
|
|
+ {showSidebarBool && <Sidebar /> }
|
|
|
+ <div className="container">
|
|
|
+ <Switch>
|
|
|
+ <Route exact path="/" component={Home} />
|
|
|
+
|
|
|
+ <Route exact path="/races" render={() => (
|
|
|
+ <div className="text-center">
|
|
|
+ Races
|
|
|
+ </div>
|
|
|
+ )} />
|
|
|
+
|
|
|
+ <Route exact path="/result" render={() => (
|
|
|
+ <div className="text-center">
|
|
|
+ Result
|
|
|
+ </div>
|
|
|
+ )} />
|
|
|
+
|
|
|
+ <Route exact path="/gallery" render={() => (
|
|
|
+ <div className= "text-center">
|
|
|
+ Gallery
|
|
|
+ </div>
|
|
|
+ )} />
|
|
|
+
|
|
|
+ <Route exact path="/reviews" render={() => (
|
|
|
+ <div className="text-center">
|
|
|
+ Reviews
|
|
|
+ </div>
|
|
|
+ )} />
|
|
|
+
|
|
|
+ <Route exact path="/login" component={Login} />
|
|
|
+
|
|
|
+ <Route exact path = '/admin' component = {AdminMainPage} />
|
|
|
+ <Route exact path = '/admin/add_new_event' component = {AdminAddEventPage} />
|
|
|
+ <Route exact path = '/admin/my_events' component = {EventReduxForm} />
|
|
|
+ <Route exact path = '/admin/photogalary' component = {AdminAddPhotogalarytPage} />
|
|
|
+
|
|
|
+ </Switch>
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const mapStateToProps = state => {
|
|
|
+ return {
|
|
|
+ showSidebarBool: state.Sidebar.showSidebar
|
|
|
+ };
|
|
|
+};
|
|
|
|
|
|
-export default () => (
|
|
|
- <div className="container">
|
|
|
- <Switch>
|
|
|
-
|
|
|
- <Route exact path = '/admin' component = {AdminMainPage} />
|
|
|
- <Route exact path = '/admin/add_new_event' component = {AdminAddEventPage} />
|
|
|
- <Route exact path = '/admin/my_events' component = {EventReduxForm} />
|
|
|
- <Route exact path = '/admin/photogalary' component = {AdminAddPhotogalarytPage} />
|
|
|
-
|
|
|
- </Switch>
|
|
|
- </div>
|
|
|
-);
|
|
|
+export default connect(
|
|
|
+ mapStateToProps
|
|
|
+)(Router);
|