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

54 lines
1.7 KiB
JavaScript
Raw Normal View History

'use strict';
import React from 'react';
import Header from '../../header';
import Footer from '../../footer';
import GlobalNotification from '../../global_notification';
2015-09-18 13:46:15 +02:00
import classNames from 'classnames';
import { getSubdomain } from '../../../utils/general_utils';
let WalletApp = React.createClass({
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
render() {
let subdomain = getSubdomain();
// 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.
let activeRoutes = this.props.routes.map(elem => 'route--' + elem.path.split('/')[0]);
let header = null;
2015-10-01 14:34:46 +02:00
if ((this.props.history.isActive('/login') || this.props.history.isActive('/signup') || this.props.history.isActive('/contract_notifications'))
&& (['ikonotv', 'cyland']).indexOf(subdomain) > -1) {
header = (<div className="hero"/>);
2015-08-19 14:48:22 +02:00
} else {
header = <Header showAddWork={true} routes={this.props.routes} />;
2015-08-19 14:48:22 +02:00
}
return (
2015-09-21 16:23:18 +02:00
<div className={classNames('ascribe-wallet-app', activeRoutes)}>
2015-09-18 15:36:01 +02:00
<div className='container'>
{header}
{this.props.children}
2015-09-18 15:36:01 +02:00
<GlobalNotification />
<div id="modal" className="container"></div>
<Footer />
</div>
</div>
);
}
});
export default WalletApp;