Skip to content

Commit

Permalink
Merge pull request Referendum#18 from oshaikh13/master
Browse files Browse the repository at this point in the history
Add user info component
  • Loading branch information
oshaikh13 committed May 9, 2016
2 parents 9147c9a + c1335f2 commit b3ea6cf
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 59 deletions.
5 changes: 2 additions & 3 deletions src/components/TopImage/insideStyles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
:local(.styles) {
position: relative;

background: url(files/general-assembly.jpg);
background-size: 100% auto;

background: url(files/general-assembly.jpg) no-repeat fixed center;
background-size: 100% auto cover;

height: 100%;

Expand Down
5 changes: 2 additions & 3 deletions src/components/TopImage/outsideStyles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
:local(.styles) {
position: relative;

background: url(files/mun-background.jpg);
background-size: 100% auto;

background: url(files/mun-background.jpg) no-repeat fixed center;
background-size: 100% auto cover;

height: 100%;

Expand Down
86 changes: 86 additions & 0 deletions src/components/UserInfo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import React, { Component } from 'react';

/* component styles */
import { styles } from '../Tools/styles.scss';

export class UserInfo extends Component {
render() {
return (
<section className={`${styles}`}>
<div className="container">
<hr />
<div className="row">
<div className="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
<h2>
General Information
</h2>
</div>
</div>

<div className="row">

<div className="col-xs-6 col-sm-4">
<h3 className="centerAlign">
Personal
</h3>

<p>
<b>First Name</b>: {this.props.personal.firstName}
</p>
<p>
<b>Last Name</b>: {this.props.personal.lastName}
</p>
<p>
<b>Email</b>: {this.props.personal.email}
</p>
<p>
<b>Country</b>: {this.props.personal.country}
</p>
<p>
<b>Committee</b>: {this.props.personal.committee}
</p>
<p>
<b>Position</b>: {this.props.personal.userLevel}
</p>
</div>
<div className="col-xs-6 col-sm-4"></div>

<div className="col-xs-6 col-sm-4">
<h3 className="centerAlign">
Partner
</h3>
{ this.props.partner ? <span><p>
<b>First Name</b>: {this.props.partner.firstName}
</p>
<p>
<b>Last Name</b>: {this.props.partner.lastName}
</p>
<p>
<b>Email</b>: {this.props.partner.email}
</p>
<p>
<b>Country</b>: {this.props.partner.country}
</p>
<p>
<b>Committee</b>: {this.props.partner.committee}
</p>
<p>
<b>Position</b>: {this.props.partner.userLevel}
</p>
</span> : <span><p>You don't have a partner!</p></span>
}
</div>
</div>
<div className="row">
<div className="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
<h5>
Talk to staff or send an email to [email protected] if you think any information is wrong
</h5>
</div>
</div>
<hr />
</div>
</section>
);
}
}
6 changes: 1 addition & 5 deletions src/components/VoteTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ export class VoteTable extends Component {
<tr key={index}>
<td>{item}</td>
<td>{votes[item].creator}</td>
<td><button type="button" className="btn btn-primary" disabled={votes[item].closed}>
<Link to={'/dashboard/delegate/vote/' + encodeURIComponent(item)} style={{color: "white"}}>
Vote
</Link>
</button></td>
<td><a type="button" className="btn btn-primary" href={'/#/dashboard/delegate/vote/' + encodeURIComponent(item)} disabled={votes[item].closed}>Vote</a></td>
</tr>
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/containers/DelegateDashboardApp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export class DelegateDashboardApp extends Component {
<Header
titleData={["Dashboard", "/dashboard/delegate"]}
leftLinks={[
["Home", "/dashboard/delegate/"],
["Resolutions", "/dashboard/delegate/resolutions"],
["Vote", "/dashboard/delegate/vote"],
["Profile", "/dashboard/delegate/profile"]
["Vote", "/dashboard/delegate/vote"]
]}
rightLink={["Log out", "/dashboard/logout", true]}
/>
Expand Down
11 changes: 9 additions & 2 deletions src/containers/DelegateDashboardHome/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React, { Component } from 'react';
import DocumentMeta from 'react-document-meta';

/* components */
import { connect } from 'react-redux';
import { TopImage } from 'components/TopImage';
import { Tools } from 'components/Tools';
import { UserInfo } from 'components/UserInfo';

const metaData = {
title: 'Dashboard',
Expand All @@ -17,13 +18,19 @@ const metaData = {
},
};

@connect(
(state) => ({
partner: state.auth.partner,
personal: state.auth
})
)
export class DelegateDashboardHome extends Component {
render() {
return (
<section>
<DocumentMeta {...metaData} />
<TopImage imgType="generalassembly" header={"Hi " + this.props.firstName + " " + this.props.lastName} subtitle="Welcome to your Dashboard"/>
<Tools />
<UserInfo {...this.props}/>
</section>
);
}
Expand Down
42 changes: 0 additions & 42 deletions src/containers/Profile/index.js

This file was deleted.

1 change: 1 addition & 0 deletions src/reducers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function auth(state = initialState, action) {

case 'LOGIN_USER_SUCCESS':
const usrObject = jwtDecode(action.token);
console.log(usrObject);
return Object.assign({}, state, {
'isAuthenticating': false,
'isAuthenticated': true,
Expand Down
2 changes: 0 additions & 2 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Login } from 'containers/Login';
import { Logout } from 'containers/Logout';

import { SignUp } from 'containers/SignUp';
import { Profile } from 'containers/Profile';
import { Vote } from 'containers/Vote';
import { VoteAction } from 'containers/VoteAction';

Expand All @@ -38,7 +37,6 @@ export default (
<IndexRedirect to="/home"/>
<Route path="/dashboard/delegate" component={requireAuthentication(DelegateDashboardApp, "Delegate")}>
<IndexRoute component={DelegateDashboardHome}/>
<Route path="/dashboard/delegate/profile" component={Profile}/>
<Route path="/dashboard/delegate/vote" component={Vote}/>
<Route path="/dashboard/delegate/vote/:name" component={VoteAction}/>

Expand Down

0 comments on commit b3ea6cf

Please sign in to comment.