onion/js/components/whitelabel/wallet/wallet_app.js

63 lines
2.3 KiB
JavaScript
Raw Normal View History

'use strict';
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-01-11 16:26:36 +01:00
import AppRouteWrapper from '../../app_route_wrapper';
2016-02-05 10:38:59 +01:00
import Header from '../../header';
import { getSubdomain } from '../../../utils/general_utils';
let WalletApp = React.createClass({
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
history: React.PropTypes.object.isRequired,
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
2016-02-05 10:38:59 +01:00
// Provided from AppBase
currentUser: React.PropTypes.object,
whitelabel: React.PropTypes.object
},
2015-08-19 14:48:22 +02:00
render() {
2016-02-05 10:38:59 +01:00
const { activeRoute, children, currentUser, history, routes, whitelabel } = 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-03-04 15:53:55 +01:00
const Footer = 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
if ((!path || history.isActive('/login') || history.isActive('/signup') || history.isActive('/contract_notifications'))
2016-04-06 16:22:03 +02:00
&& (['cyland', 'ikonotv', 'lumenus', '23vivi', 'polline', 'artcity', 'demo', 'liquidgallery']).includes(subdomain)) {
header = (<div className="hero"/>);
2015-08-19 14:48:22 +02:00
} else {
header = (
<Header
currentUser={currentUser}
routes={routes}
whitelabel={whitelabel} />
);
2015-08-19 14:48:22 +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.
return (
<div className={classNames('ascribe-app', 'ascribe-wallet-app', `route--${(path ? path.split('/')[0] : 'landing')}`)}>
2016-02-05 10:38:59 +01:00
{header}
<AppRouteWrapper
currentUser={currentUser}
whitelabel={whitelabel}>
{/* Routes are injected here */}
{children}
2016-02-05 10:38:59 +01:00
</AppRouteWrapper>
2016-03-04 15:53:55 +01:00
{Footer ? <Footer /> : null}
</div>
);
}
});
2016-02-05 10:38:59 +01:00
export default AppBase(WalletApp);