2015-08-11 13:10:15 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import Header from '../../header';
|
2015-08-18 09:42:28 +02:00
|
|
|
import Footer from '../../footer';
|
|
|
|
|
2015-08-11 13:10:15 +02:00
|
|
|
import GlobalNotification from '../../global_notification';
|
|
|
|
|
2015-09-18 13:46:15 +02:00
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2015-09-29 14:58:56 +02:00
|
|
|
import { getSubdomain } from '../../../utils/general_utils';
|
|
|
|
|
2015-08-25 16:33:26 +02:00
|
|
|
|
2015-08-11 13:10:15 +02:00
|
|
|
let WalletApp = React.createClass({
|
2015-10-01 11:16:38 +02:00
|
|
|
propTypes: {
|
|
|
|
children: React.PropTypes.oneOfType([
|
|
|
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
|
|
|
React.PropTypes.element
|
|
|
|
]),
|
|
|
|
history: React.PropTypes.object,
|
|
|
|
routes: React.PropTypes.arrayOf(React.PropTypes.object)
|
|
|
|
},
|
2015-08-19 14:48:22 +02:00
|
|
|
|
2015-08-11 13:10:15 +02:00
|
|
|
render() {
|
2015-10-09 15:19:24 +02:00
|
|
|
let header = null;
|
2015-09-29 14:58:56 +02:00
|
|
|
let subdomain = getSubdomain();
|
2015-10-09 15:19:24 +02:00
|
|
|
const { history, routes, children } = this.props;
|
2015-10-01 11:16:38 +02:00
|
|
|
|
2015-10-01 15:57:46 +02:00
|
|
|
// The second element of routes is always the active component object, where we can
|
|
|
|
// extract the path.
|
2015-10-09 15:19:24 +02:00
|
|
|
let path = routes[1] ? routes[1].path : null;
|
2015-10-01 16:11:29 +02:00
|
|
|
|
|
|
|
// if the path of the current activeRoute is not defined, then this is the IndexRoute
|
2015-10-09 15:19:24 +02:00
|
|
|
if ((!path || history.isActive('/login') || history.isActive('/signup') || history.isActive('/contract_notifications'))
|
2015-08-19 17:18:32 +02:00
|
|
|
&& (['ikonotv', 'cyland']).indexOf(subdomain) > -1) {
|
2015-10-01 11:16:38 +02:00
|
|
|
header = (<div className="hero"/>);
|
2015-08-19 14:48:22 +02:00
|
|
|
} else {
|
2015-10-09 15:19:24 +02:00
|
|
|
header = <Header showAddWork={true} routes={routes} />;
|
2015-08-19 14:48:22 +02:00
|
|
|
}
|
2015-08-25 16:33:26 +02:00
|
|
|
|
2015-10-01 15:57:46 +02:00
|
|
|
// In react-router 1.0, Routes have no 'name' property anymore. To keep functionality however,
|
|
|
|
// we split the path by the first occurring slash and take the first splitter.
|
2015-08-11 13:10:15 +02:00
|
|
|
return (
|
2015-10-01 15:57:46 +02:00
|
|
|
<div className={classNames('ascribe-wallet-app', 'route--' + (path ? path.split('/')[0] : 'landing'))}>
|
2015-09-18 15:36:01 +02:00
|
|
|
<div className='container'>
|
|
|
|
{header}
|
2015-10-09 15:19:24 +02:00
|
|
|
{children}
|
2015-09-18 15:36:01 +02:00
|
|
|
<GlobalNotification />
|
|
|
|
<div id="modal" className="container"></div>
|
|
|
|
<Footer />
|
|
|
|
</div>
|
2015-08-11 13:10:15 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default WalletApp;
|