1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-07 04:04:20 +01:00
onion/js/components/whitelabel/wallet/wallet_app.js

55 lines
2.1 KiB
JavaScript
Raw Permalink Normal View History

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';
import withContext from '../../context/with_context';
2016-02-05 10:38:59 +01:00
import Header from '../../header';
import { routerShape } from '../../prop_types';
2016-06-13 17:33:47 +02:00
import { getCurrentSubdomain } from '../../../utils/url';
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
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
// Injected through HOCs
router: routerShape.isRequired // eslint-disable-line react/sort-prop-types
},
2015-08-19 14:48:22 +02:00
render() {
const { activeRoute, children, router, routes } = this.props;
2016-06-13 17:33:47 +02:00
const subdomain = getCurrentSubdomain();
2016-02-05 10:38:59 +01:00
const path = activeRoute && activeRoute.path;
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
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)) {
header = (<div className="hero"/>);
2015-08-19 14:48:22 +02:00
} else {
header = (
<Header routes={routes} />
);
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}
<div className="container ascribe-body">
2016-02-05 10:38:59 +01:00
{/* Routes are injected here */}
{children}
</div>
{RouteFooterType ? <RouteFooterType /> : null}
</div>
);
}
});
export default AppBase(withContext(WalletApp, 'router'));