Skip to content

Commit

Permalink
Renamed profile to dashboard, and added some skeleton sections (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatmo authored Mar 2, 2019
1 parent 11375a4 commit f8299e1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 26 deletions.
7 changes: 4 additions & 3 deletions client/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Woohoo from '../imports/ui/components/woohoo.jsx';
import Apply from '../imports/ui/components/apply.jsx';
import ForgotPassword from '../imports/ui/components/forgot_password.jsx';
import SetPassword from '../imports/ui/components/set_password.jsx';
import Dashboard from '../imports/ui/components/dashboard.jsx';
import Home from '../imports/ui/components/home.jsx';
import Moderator from '../imports/ui/components/home.jsx';
import withUser from '../imports/ui/components/hoc/with-user.jsx';
Expand All @@ -17,7 +18,7 @@ export const renderRoutes = () => (
<Switch>
<Navbar>
<Route exact path="/" component={Landing} />
<RouteWithUser exact path="/home" component={Home} />
<RouteWithUser exact path="/dashboard" component={Dashboard} />
<RouteWithOutUser exact path="/login" component={Login} />
<RouteWithOutUser exact path="/forgot-password" component={ForgotPassword} />
<RouteWithOutUser exact path="/enroll-account/:token" component={SetPassword} />
Expand Down Expand Up @@ -48,8 +49,8 @@ const RouteWithOutUser = withUser(({ user, component: Component, ...rest }) => {
const { pathname } = window.location;
if (!user) {
return <Route {...rest} render={props => <Component {...props} user={user} />} />;
} else if (pathname !== '/home' && pathname === rest.path) {
return <Redirect push to="/home" />;
} else if (pathname !== '/dashboard' && pathname === rest.path) {
return <Redirect push to="/dashboard" />;
}
return null;
});
31 changes: 31 additions & 0 deletions imports/ui/components/dashboard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import { Container, Row, Col } from 'react-bootstrap';
import BoardContainer from '/imports/ui/containers/board.jsx';
import '/imports/ui/styles/_dashboard.scss';

const Dashboard = props => {
console.log(props)
const { user } = props;
const { name } = user && user.profile || {}
return (
<Container id="dashboard">
<Row>
<Col className="h-100" style={{marginTop:40}}>
<hgroup className="mx-auto p-4 text-center">
<h3>Hello {name}! You are logged in!</h3>
<h2>Your unmatched submissions</h2>
<p>You are looking for: { user.profile.categories[0].title }</p>
<p>{ user.profile.categories[0].note }</p>
<h2>Your current match</h2>
<h2>Favorite unmatched entries by clicking on the hearts below...</h2>
<BoardContainer />
<h2>Previous matches</h2>
</hgroup>
</Col>
</Row>
</Container>

)
}

export default Dashboard
23 changes: 0 additions & 23 deletions imports/ui/components/home.jsx

This file was deleted.

7 changes: 7 additions & 0 deletions imports/ui/components/navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ class NavbarWrapper extends React.Component {
<Link to="/faq" className="nav-link mr-sm-2">
FAQ
</Link>
{user ? (
<Link to="/dashboard" className="nav-link mr-sm-2">
Dashboard
</Link>
) : (
""
)}
{user ? (
<Button variant="outline-success" size="sm" onClick={this.handleLogout}>
Logout
Expand Down
5 changes: 5 additions & 0 deletions imports/ui/styles/_dashboard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#dashboard {
h2 {
text-align: left;
}
}

0 comments on commit f8299e1

Please sign in to comment.