2015-08-11 13:10:15 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
2015-09-18 13:46:15 +02:00
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2016-01-19 15:00:50 +01:00
|
|
|
import AppBase from '../../app_base';
|
2016-02-01 14:49:48 +01:00
|
|
|
import Footer from '../../footer';
|
2016-01-19 15:00:50 +01:00
|
|
|
import Header from '../../header';
|
|
|
|
|
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: {
|
2016-02-01 14:48:44 +01:00
|
|
|
activeRoute: React.PropTypes.object.isRequired,
|
|
|
|
children: React.PropTypes.element.isRequired,
|
2016-01-19 15:00:50 +01:00
|
|
|
history: React.PropTypes.object.isRequired,
|
2016-02-01 14:48:44 +01:00
|
|
|
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
|
2015-10-01 11:16:38 +02:00
|
|
|
},
|
2015-08-19 14:48:22 +02:00
|
|
|
|
2015-08-11 13:10:15 +02:00
|
|
|
render() {
|
2016-02-01 14:48:44 +01:00
|
|
|
const { activeRoute, children, history, routes } = this.props;
|
2016-01-19 15:00:50 +01:00
|
|
|
const subdomain = getSubdomain();
|
2016-02-03 12:38:34 +01:00
|
|
|
const path = activeRoute && activeRoute.path;
|
2015-10-01 16:11:29 +02:00
|
|
|
|
2016-01-19 15:00:50 +01:00
|
|
|
let header = null;
|
2015-10-01 16:11:29 +02:00
|
|
|
// if the path of the current activeRoute is not defined, then this is the IndexRoute
|
2016-02-01 15:28:35 +01:00
|
|
|
if ((!path || history.isActive('/login') || history.isActive('/signup') ||
|
|
|
|
history.isActive('/contract_notifications')) &&
|
|
|
|
(['cyland', 'ikonotv', 'lumenus', '23vivi']).includes(subdomain)) {
|
2016-01-19 15:00:50 +01:00
|
|
|
header = (<div className="hero" />);
|
2015-08-19 14:48:22 +02:00
|
|
|
} else {
|
2016-01-19 15:00:50 +01:00
|
|
|
header = (<Header 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 (
|
2016-01-19 15:04:46 +01:00
|
|
|
<div className={classNames('ascribe-wallet-app', `route--${(path ? path.split('/')[0] : 'landing')}`)}>
|
|
|
|
{header}
|
|
|
|
<div className="container ascribe-body">
|
|
|
|
{/* Routes are injected here */}
|
2015-10-09 15:19:24 +02:00
|
|
|
{children}
|
2015-09-18 15:36:01 +02:00
|
|
|
</div>
|
2016-02-01 14:49:48 +01:00
|
|
|
<Footer activeRoute={activeRoute} />
|
2015-08-11 13:10:15 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-01-19 15:00:50 +01:00
|
|
|
export default AppBase(WalletApp);
|