diff --git a/client/src/components/Dashboard.js b/client/src/components/Dashboard.js index d5dd13e..66b9d8d 100644 --- a/client/src/components/Dashboard.js +++ b/client/src/components/Dashboard.js @@ -1,10 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -//import Layout from '../containers/Layout'; import SocialProfileList from './SocialProfileList'; -//import { auth } from '../firebase'; import axios from 'axios'; -import HeaderLoggedIn from '../containers/HeaderLoggedIn'; import NewHabit from './NewHabit'; import CheckIn from './check-in'; import CurrentHabit from './CurrentHabit'; diff --git a/client/src/components/header.js b/client/src/components/header.js index 32e1180..6bc46d7 100644 --- a/client/src/components/header.js +++ b/client/src/components/header.js @@ -2,30 +2,31 @@ import React from 'react'; const Header = (props) => ( +
+ {/* Logged in*/} + {props.providerData && +
+ +

Habit Tracker

+ {props.providerData[0].providerName} -
- - {props.providerData && } +
+ } + {/* Not Logged in*/} + {!props.providerData && +
+

Habit Tracker

+
+ } -

Habit Tracker

- - - {props.providerData && - - {props.providerData[0].providerName} - - } - -
- -); +
+); export default Header; \ No newline at end of file diff --git a/client/src/containers/HeaderLoggedIn.js b/client/src/containers/HeaderLoggedIn.js deleted file mode 100644 index 22107bc..0000000 --- a/client/src/containers/HeaderLoggedIn.js +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { Link } from 'react-router-dom'; - - -const propTypes = { - children: PropTypes.node.isRequired, -}; - -const HeaderLoggedIn = ({ children, hamburgerToggle, hamburgerOpen }) => { - return ( -
-
- - - - -

Habit Tracker

- - {children} -
-
- ); -}; - -HeaderLoggedIn.propTypes = propTypes; - -export default HeaderLoggedIn; \ No newline at end of file diff --git a/client/src/containers/Layout.js b/client/src/containers/Layout.js deleted file mode 100644 index 7476651..0000000 --- a/client/src/containers/Layout.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -import Footer from '../components/footer' -import HeaderLoggedIn from './HeaderLoggedIn'; - -const propTypes = { - children: PropTypes.node.isRequired, - contentCenter: PropTypes.bool -}; - -const Layout = ({ children}) => { - return ( -
- {/*
or Need to swap headers based of if user logged in */} - -
-
- {children} -
-
- -
- ); -}; - -Layout.propTypes = propTypes; - -export default Layout; \ No newline at end of file diff --git a/client/src/containers/withAuthentication.js b/client/src/containers/withAuthentication.js deleted file mode 100644 index bef32fe..0000000 --- a/client/src/containers/withAuthentication.js +++ /dev/null @@ -1,40 +0,0 @@ -import React, { Component } from 'react'; -import Delay from 'react-delay'; - -import { auth } from '../firebase'; - -export default WrappedComponent => { - class WithAuthentication extends Component { - state = { - providerData: [] - }; - - componentDidMount() { - auth.getAuth().onAuthStateChanged(user => { - if (user) { - //User is signed in. - console.info('User is signed in.'); - this.setState({ providerData: user.providerData }); - } else { - console.info('Must be authenticated'); - this.props.history.push('/'); - } - }); - } - - render() { - return this.state.providerData.length > 0 ? ( - - ) : ( - -

Loading...

-
- ); - } - } - - return WithAuthentication; -};