diff --git a/js/components/ascribe_app.js b/js/components/ascribe_app.js
index bf1ac2ec..369bf744 100644
--- a/js/components/ascribe_app.js
+++ b/js/components/ascribe_app.js
@@ -55,7 +55,10 @@ let AscribeApp = React.createClass({
return (
-
+
diff --git a/js/components/header.js b/js/components/header.js
index ed4a9a3d..fcc19e31 100644
--- a/js/components/header.js
+++ b/js/components/header.js
@@ -14,47 +14,25 @@ import NavItem from 'react-bootstrap/lib/NavItem';
import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
-import AclProxy from './acl_proxy';
-
import EventActions from '../actions/event_actions';
-import UserActions from '../actions/user_actions';
-import UserStore from '../stores/user_store';
-
-import WhitelabelActions from '../actions/whitelabel_actions';
-import WhitelabelStore from '../stores/whitelabel_store';
-
+import AclProxy from './acl_proxy';
import HeaderNotifications from './header_notification';
-
import HeaderNotificationDebug from './header_notification_debug';
-
import NavRoutesLinks from './nav_routes_links';
-import { mergeOptions } from '../utils/general_utils';
import { getLangText } from '../utils/lang_utils';
-
import { constructHead } from '../utils/dom_utils';
let Header = React.createClass({
propTypes: {
- routes: React.PropTypes.arrayOf(React.PropTypes.object)
- },
-
- getInitialState() {
- return mergeOptions(
- WhitelabelStore.getState(),
- UserStore.getState()
- );
+ currentUser: React.PropTypes.object.isRequired,
+ routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
+ whitelabel: React.PropTypes.object.isRequired
},
componentDidMount() {
- UserStore.listen(this.onChange);
- UserActions.fetchCurrentUser.defer();
-
- WhitelabelStore.listen(this.onChange);
- WhitelabelActions.fetchWhitelabel.defer();
-
// react-bootstrap 0.25.1 has a bug in which it doesn't
// close the mobile expanded navigation after a click by itself.
// To get rid of this, we set the state of the component ourselves.
@@ -62,13 +40,11 @@ let Header = React.createClass({
},
componentWillUnmount() {
- UserStore.unlisten(this.onChange);
- WhitelabelStore.unlisten(this.onChange);
//history.unlisten(this.onRouteChange);
},
getLogo() {
- const { whitelabel } = this.state;
+ const { whitelabel } = this.props;
if (whitelabel.head) {
constructHead(whitelabel.head);
@@ -80,19 +56,19 @@ let Header = React.createClass({
);
+ } else {
+ return (
+
+
+
+ );
}
-
- return (
-
-
-
- );
},
getPoweredBy() {
return (
@@ -104,10 +80,6 @@ let Header = React.createClass({
);
},
- onChange(state) {
- this.setState(state);
- },
-
onMenuItemClick() {
/*
This is a hack to make the dropdown close after clicking on an item
@@ -143,59 +115,61 @@ let Header = React.createClass({
},
render() {
+ const { currentUser, routes } = this.props;
let account;
let signup;
let navRoutesLinks;
- if (this.state.currentUser.username){
+
+ if (currentUser.username) {
account = (
+ title={currentUser.username}>
-
-
+
{getLangText('Contract Settings')}
-
-
+
+
{getLangText('Log out')}
);
- navRoutesLinks = ;
- }
- else {
+
+ navRoutesLinks = (
+
+ );
+ } else {
account = (
-
+
{getLangText('LOGIN')}
);
signup = (
-
+
{getLangText('SIGNUP')}
@@ -211,13 +185,12 @@ let Header = React.createClass({
toggleNavKey={0}
fixedTop={true}
className="hidden-print">
-
+
diff --git a/js/components/whitelabel/prize/portfolioreview/pr_app.js b/js/components/whitelabel/prize/portfolioreview/pr_app.js
index f6364bc8..85091a8b 100644
--- a/js/components/whitelabel/prize/portfolioreview/pr_app.js
+++ b/js/components/whitelabel/prize/portfolioreview/pr_app.js
@@ -54,8 +54,7 @@ let PRApp = React.createClass({
},
render() {
- const { children, history, routes } = this.props;
- const { currentUser, whitelabel } = this.state;
+ const { children, currentUser, history, routes, whitelabel } = this.props;
const subdomain = getSubdomain();
// Add the current user and whitelabel settings to all child routes
@@ -69,10 +68,16 @@ let PRApp = React.createClass({
let style = {};
let header;
if (currentUser && currentUser.email && history.isActive(`/pieces/${getCookie(currentUser.email)}`)) {
- header = ;
+ header = ();
style = { paddingTop: '0 !important' };
} else if(currentUser && (currentUser.is_admin || currentUser.is_jury || currentUser.is_judge)) {
- header = ;
+ header = (
+
+ );
} else {
style = { paddingTop: '0 !important' };
}
diff --git a/js/components/whitelabel/prize/simple_prize/prize_app.js b/js/components/whitelabel/prize/simple_prize/prize_app.js
index a5cea483..e9083428 100644
--- a/js/components/whitelabel/prize/simple_prize/prize_app.js
+++ b/js/components/whitelabel/prize/simple_prize/prize_app.js
@@ -53,8 +53,7 @@ let PrizeApp = React.createClass({
},
render() {
- const { history, routes, children } = this.props;
- const { currentUser, whitelabel } = this.state;
+ const { children, currentUser, history, routes, whitelabel } = this.props;
const subdomain = getSubdomain();
// The second element of routes is always the active component object, where we can
@@ -64,9 +63,14 @@ let PrizeApp = React.createClass({
let header = null;
// if the path of the current activeRoute is not defined, then this is the IndexRoute
if (!path || history.isActive('/login') || history.isActive('/signup')) {
- header = ;
+ header = ();
} else {
- header = ;
+ header = (
+
+ );
}
return (
diff --git a/js/components/whitelabel/wallet/wallet_app.js b/js/components/whitelabel/wallet/wallet_app.js
index e35da2da..783bb2ab 100644
--- a/js/components/whitelabel/wallet/wallet_app.js
+++ b/js/components/whitelabel/wallet/wallet_app.js
@@ -52,8 +52,7 @@ let WalletApp = React.createClass({
},
render() {
- const { history, routes, children } = this.props;
- const { currentUser, whitelabel } = this.state;
+ const { children, currentUser, history, routes, whitelabel } = this.props;
const subdomain = getSubdomain();
// The second element of routes is always the active component object, where we can
@@ -66,7 +65,12 @@ let WalletApp = React.createClass({
&& (['cyland', 'ikonotv', 'lumenus', '23vivi']).indexOf(subdomain) > -1) {
header = ();
} else {
- header = ();
+ header = (
+
+ );
}
// In react-router 1.0, Routes have no 'name' property anymore. To keep functionality however,