2015-07-10 16:43:35 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
2016-02-05 10:38:59 +01:00
|
|
|
import classNames from 'classnames';
|
2016-01-11 15:14:54 +01:00
|
|
|
|
2015-08-11 14:47:28 +02:00
|
|
|
import Hero from './components/prize_hero';
|
2016-01-11 15:14:54 +01:00
|
|
|
|
2016-02-05 10:38:59 +01:00
|
|
|
import AppBase from '../../../app_base';
|
2016-01-11 15:14:54 +01:00
|
|
|
import AppRouteWrapper from '../../../app_route_wrapper';
|
2015-11-05 16:45:12 +01:00
|
|
|
import Footer from '../../../footer';
|
2016-02-05 10:38:59 +01:00
|
|
|
import Header from '../../../header';
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2016-02-05 10:38:59 +01:00
|
|
|
import { getSubdomain } from '../../../../utils/general_utils';
|
2015-09-29 14:58:56 +02:00
|
|
|
|
|
|
|
|
2015-07-10 16:43:35 +02:00
|
|
|
let PrizeApp = 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
|
|
|
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
|
2016-01-11 15:14:54 +01:00
|
|
|
},
|
|
|
|
|
2015-07-10 16:43:35 +02:00
|
|
|
render() {
|
2016-02-05 10:38:59 +01:00
|
|
|
const { activeRoute, children, currentUser, history, routes, whitelabel } = this.props;
|
2016-01-11 15:14:54 +01:00
|
|
|
const subdomain = getSubdomain();
|
2016-02-05 10:38:59 +01:00
|
|
|
const path = activeRoute && activeRoute.path;
|
2015-10-09 15:19:24 +02:00
|
|
|
|
2016-01-11 15:14:54 +01:00
|
|
|
let header = null;
|
2015-10-09 15:19:24 +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')) {
|
2016-01-11 18:41:07 +01:00
|
|
|
header = (<Hero />);
|
2015-07-14 18:55:34 +02:00
|
|
|
} else {
|
2016-01-11 18:41:07 +01:00
|
|
|
header = (
|
|
|
|
<Header
|
|
|
|
currentUser={currentUser}
|
|
|
|
routes={routes}
|
|
|
|
whitelabel={whitelabel} />
|
|
|
|
);
|
2015-07-13 16:34:26 +02:00
|
|
|
}
|
|
|
|
|
2015-07-10 16:43:35 +02:00
|
|
|
return (
|
2016-02-05 10:38:59 +01:00
|
|
|
<div className={classNames('ascribe-prize-app', `route--${(path ? path.split('/')[0] : 'landing')}`)}>
|
2015-07-13 16:34:26 +02:00
|
|
|
{header}
|
2016-01-11 15:14:54 +01:00
|
|
|
<AppRouteWrapper
|
|
|
|
currentUser={currentUser}
|
|
|
|
whitelabel={whitelabel}>
|
|
|
|
{/* Routes are injected here */}
|
|
|
|
{children}
|
|
|
|
</AppRouteWrapper>
|
2016-02-05 10:38:59 +01:00
|
|
|
<Footer activeRoute={activeRoute} />
|
2015-07-10 16:43:35 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-02-05 10:38:59 +01:00
|
|
|
export default AppBase(PrizeApp);
|