From c66f3fd9d7a42ef0cc5f8d4d2e2d05240cf983c8 Mon Sep 17 00:00:00 2001 From: SamR1 Date: Mon, 25 Dec 2017 18:19:28 +0100 Subject: [PATCH] Client: file organization --- mpwo_client/src/components/App.jsx | 54 ++++++++----------- .../src/components/Dashboard/index.jsx | 19 +++++++ .../{Logout.jsx => Logout/index.jsx} | 2 +- .../{NavBar.jsx => NavBar/index.jsx} | 2 +- 4 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 mpwo_client/src/components/Dashboard/index.jsx rename mpwo_client/src/components/{Logout.jsx => Logout/index.jsx} (93%) rename mpwo_client/src/components/{NavBar.jsx => NavBar/index.jsx} (98%) diff --git a/mpwo_client/src/components/App.jsx b/mpwo_client/src/components/App.jsx index 4b9ff909..0d522f45 100644 --- a/mpwo_client/src/components/App.jsx +++ b/mpwo_client/src/components/App.jsx @@ -2,6 +2,7 @@ import React from 'react' import { Route, Switch } from 'react-router-dom' import './App.css' +import Dashboard from './Dashboard' import Logout from './Logout' import NavBar from './NavBar' import UserForm from './User/UserForm' @@ -16,38 +17,27 @@ export default class App extends React.Component { return (
-
-
-
-
- - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - -
-
-
-
+ + + ( + + )} + /> + ( + + )} + /> + + + ) } } diff --git a/mpwo_client/src/components/Dashboard/index.jsx b/mpwo_client/src/components/Dashboard/index.jsx new file mode 100644 index 00000000..c707883d --- /dev/null +++ b/mpwo_client/src/components/Dashboard/index.jsx @@ -0,0 +1,19 @@ +import React from 'react' +import { connect } from 'react-redux' + +class Logout extends React.Component { + componentDidMount() {} + render() { + return ( +
+

Dashboard

+
+ ) + } +} + +export default connect( + state => ({ + user: state.user, + }) +)(Logout) diff --git a/mpwo_client/src/components/Logout.jsx b/mpwo_client/src/components/Logout/index.jsx similarity index 93% rename from mpwo_client/src/components/Logout.jsx rename to mpwo_client/src/components/Logout/index.jsx index 070af4ac..1e3ea7e7 100644 --- a/mpwo_client/src/components/Logout.jsx +++ b/mpwo_client/src/components/Logout/index.jsx @@ -2,7 +2,7 @@ import React from 'react' import { connect } from 'react-redux' import { Link } from 'react-router-dom' -import { logout } from '../actions' +import { logout } from '../../actions' class Logout extends React.Component { componentDidMount() { diff --git a/mpwo_client/src/components/NavBar.jsx b/mpwo_client/src/components/NavBar/index.jsx similarity index 98% rename from mpwo_client/src/components/NavBar.jsx rename to mpwo_client/src/components/NavBar/index.jsx index 21a43904..b4cdc389 100644 --- a/mpwo_client/src/components/NavBar.jsx +++ b/mpwo_client/src/components/NavBar/index.jsx @@ -28,7 +28,7 @@ function NavBar (props) { pathname: '/', }} > - Home + Dashboard {!props.user.isAuthenticated && (