2015-08-11 13:10:15 +02:00
|
|
|
import React from 'react';
|
2015-09-18 13:46:15 +02:00
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2016-02-05 10:38:59 +01:00
|
|
|
import AppBase from '../../app_base';
|
2016-06-08 13:52:24 +02:00
|
|
|
import withContext from '../../context/with_context';
|
2016-02-05 10:38:59 +01:00
|
|
|
import Header from '../../header';
|
2016-06-08 13:52:24 +02:00
|
|
|
import { routerShape } from '../../prop_types';
|
2015-08-11 13:10:15 +02:00
|
|
|
|
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-05 10:38:59 +01:00
|
|
|
activeRoute: React.PropTypes.object.isRequired,
|
|
|
|
children: React.PropTypes.element.isRequired,
|
2016-01-12 15:05:00 +01:00
|
|
|
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
|
2016-06-08 13:52:24 +02:00
|
|
|
|
|
|
|
// Injected through HOCs
|
2016-06-10 10:23:45 +02:00
|
|
|
router: routerShape.isRequired // eslint-disable-line react/sort-prop-types
|
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-06-07 14:53:48 +02:00
|
|
|
const { activeRoute, children, router, routes } = this.props;
|
2016-01-11 16:26:36 +01:00
|
|
|
const subdomain = getSubdomain();
|
2016-02-05 10:38:59 +01:00
|
|
|
const path = activeRoute && activeRoute.path;
|
2016-06-10 10:23:45 +02:00
|
|
|
const RouteFooterType = activeRoute && activeRoute.footer;
|
2015-10-01 16:11:29 +02:00
|
|
|
|
2016-01-11 16:26:36 +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-06-06 15:40:26 +02:00
|
|
|
if ((!path || router.isActive('/login') || router.isActive('/signup') || router.isActive('/contract_notifications'))
|
2016-04-06 16:22:03 +02:00
|
|
|
&& (['cyland', 'ikonotv', 'lumenus', '23vivi', 'polline', 'artcity', 'demo', 'liquidgallery']).includes(subdomain)) {
|
2015-10-01 11:16:38 +02:00
|
|
|
header = (<div className="hero"/>);
|
2015-08-19 14:48:22 +02:00
|
|
|
} else {
|
2016-01-11 18:41:07 +01:00
|
|
|
header = (
|
2016-06-07 14:53:48 +02:00
|
|
|
<Header routes={routes} />
|
2016-01-11 18:41:07 +01:00
|
|
|
);
|
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-02-05 14:22:42 +01:00
|
|
|
<div className={classNames('ascribe-app', 'ascribe-wallet-app', `route--${(path ? path.split('/')[0] : 'landing')}`)}>
|
2016-02-05 10:38:59 +01:00
|
|
|
{header}
|
2016-06-07 17:46:12 +02:00
|
|
|
<div className="container ascribe-body">
|
2016-02-05 10:38:59 +01:00
|
|
|
{/* Routes are injected here */}
|
2015-10-09 15:19:24 +02:00
|
|
|
{children}
|
2016-06-07 17:46:12 +02:00
|
|
|
</div>
|
2016-06-10 10:23:45 +02:00
|
|
|
{RouteFooterType ? <RouteFooterType /> : null}
|
2015-08-11 13:10:15 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-06-08 13:52:24 +02:00
|
|
|
export default AppBase(withContext(WalletApp, 'router'));
|