1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-09 13:21:44 +01:00
onion/js/components/whitelabel/prize/simple_prize/prize_app.js

62 lines
1.9 KiB
JavaScript
Raw Normal View History

'use strict';
import React from 'react';
2016-02-05 10:38:59 +01:00
import classNames from 'classnames';
import Hero from './components/prize_hero';
2016-02-05 10:38:59 +01:00
import AppBase from '../../../app_base';
import AppRouteWrapper from '../../../app_route_wrapper';
import Footer from '../../../footer';
2016-02-05 10:38:59 +01:00
import Header from '../../../header';
2016-02-05 10:38:59 +01:00
import { getSubdomain } from '../../../../utils/general_utils';
let PrizeApp = 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
},
render() {
2016-02-05 10:38:59 +01:00
const { activeRoute, children, currentUser, history, routes, whitelabel } = this.props;
const subdomain = getSubdomain();
2016-02-05 10:38:59 +01:00
const path = activeRoute && activeRoute.path;
let header = null;
// if the path of the current activeRoute is not defined, then this is the IndexRoute
if (!path || history.isActive('/login') || history.isActive('/signup')) {
header = (<Hero />);
2015-07-14 18:55:34 +02:00
} else {
header = (
<Header
currentUser={currentUser}
routes={routes}
whitelabel={whitelabel} />
);
2015-07-13 16:34:26 +02:00
}
return (
<div className={classNames('ascribe-app', 'ascribe-prize-app', `route--${(path ? path.split('/')[0] : 'landing')}`)}>
2015-07-13 16:34:26 +02:00
{header}
<AppRouteWrapper
currentUser={currentUser}
whitelabel={whitelabel}>
{/* Routes are injected here */}
{children}
</AppRouteWrapper>
2016-02-05 10:38:59 +01:00
<Footer activeRoute={activeRoute} />
</div>
);
}
});
2016-02-05 10:38:59 +01:00
export default AppBase(PrizeApp);