From a23643b24dedfc47abb922ff14d069f4216d71f4 Mon Sep 17 00:00:00 2001 From: SamR1 Date: Sun, 28 Jan 2018 22:36:13 +0100 Subject: [PATCH] Client: admin menu init --- .../src/components/Admin/AdminMenu.jsx | 43 +++++++++++++++++++ .../src/components/Admin/AdminSports.jsx | 23 ++++++++++ mpwo_client/src/components/Admin/index.jsx | 19 ++++++-- mpwo_client/src/components/App.jsx | 13 +----- 4 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 mpwo_client/src/components/Admin/AdminMenu.jsx create mode 100644 mpwo_client/src/components/Admin/AdminSports.jsx diff --git a/mpwo_client/src/components/Admin/AdminMenu.jsx b/mpwo_client/src/components/Admin/AdminMenu.jsx new file mode 100644 index 00000000..e6357855 --- /dev/null +++ b/mpwo_client/src/components/Admin/AdminMenu.jsx @@ -0,0 +1,43 @@ +import React from 'react' +import { Helmet } from 'react-helmet' +import { connect } from 'react-redux' +import { Link } from 'react-router-dom' + +class AdminMenu extends React.Component { + componentDidMount() {} + render() { + return ( +
+ + mpwo - Admin + +

Administration

+
+
+
+
+
    +
  • + + Sports + +
  • +
+
+
+
+
+
+ ) + } +} + +export default connect( + state => ({ + user: state.user, + }) +)(AdminMenu) diff --git a/mpwo_client/src/components/Admin/AdminSports.jsx b/mpwo_client/src/components/Admin/AdminSports.jsx new file mode 100644 index 00000000..84415195 --- /dev/null +++ b/mpwo_client/src/components/Admin/AdminSports.jsx @@ -0,0 +1,23 @@ +import React from 'react' +import { Helmet } from 'react-helmet' +import { connect } from 'react-redux' + +class AdminSports extends React.Component { + componentDidMount() {} + render() { + return ( +
+ + mpwo - Admin + +

Administration - Sports

+
+ ) + } +} + +export default connect( + state => ({ + user: state.user, + }) +)(AdminSports) diff --git a/mpwo_client/src/components/Admin/index.jsx b/mpwo_client/src/components/Admin/index.jsx index ec171e37..73285662 100644 --- a/mpwo_client/src/components/Admin/index.jsx +++ b/mpwo_client/src/components/Admin/index.jsx @@ -1,8 +1,13 @@ import React from 'react' import { Helmet } from 'react-helmet' import { connect } from 'react-redux' +import { Redirect, Route, Switch } from 'react-router-dom' +import AdminMenu from './AdminMenu' +import AdminSports from './AdminSports' import AccessDenied from './../Others/AccessDenied' +import NotFound from './../Others/NotFound' +import { isLoggedIn } from '../../utils' class Admin extends React.Component { componentDidMount() {} @@ -13,11 +18,17 @@ class Admin extends React.Component { mpwo - Admin - {!user.isAdmin ? ( + {isLoggedIn() ? ( + user.isAdmin ? ( + + + + + + ) : ( - ) : ( -

Admin

- )} + ) + ) : ()}
) } diff --git a/mpwo_client/src/components/App.jsx b/mpwo_client/src/components/App.jsx index 666df375..8d61d530 100644 --- a/mpwo_client/src/components/App.jsx +++ b/mpwo_client/src/components/App.jsx @@ -83,18 +83,7 @@ export default class App extends React.Component { ) )} /> - ( - isLoggedIn() ? ( - - ) : ( - - ) - )} - /> +