2015-07-10 16:43:35 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
2015-08-11 14:47:28 +02:00
|
|
|
import Hero from './components/prize_hero';
|
2015-11-05 16:45:12 +01:00
|
|
|
import Header from '../../../header';
|
|
|
|
import Footer from '../../../footer';
|
|
|
|
import GlobalNotification from '../../../global_notification';
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2015-11-05 16:45:12 +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: {
|
|
|
|
children: React.PropTypes.oneOfType([
|
|
|
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
|
|
|
React.PropTypes.element
|
|
|
|
]),
|
2015-10-01 14:54:56 +02:00
|
|
|
history: React.PropTypes.object,
|
|
|
|
routes: React.PropTypes.arrayOf(React.PropTypes.object)
|
2015-10-01 11:16:38 +02:00
|
|
|
},
|
2015-07-13 16:34:26 +02:00
|
|
|
|
2015-07-10 16:43:35 +02:00
|
|
|
render() {
|
2015-10-09 15:19:24 +02:00
|
|
|
const { history, routes } = this.props;
|
2015-07-13 16:34:26 +02:00
|
|
|
let header = null;
|
2015-09-29 14:58:56 +02:00
|
|
|
let subdomain = getSubdomain();
|
2015-08-27 14:34:15 +02:00
|
|
|
|
2015-10-09 15:19:24 +02:00
|
|
|
// The second element of routes is always the active component object, where we can
|
|
|
|
// extract the path.
|
|
|
|
let path = routes[1] ? routes[1].path : null;
|
|
|
|
|
|
|
|
// if the path of the current activeRoute is not defined, then this is the IndexRoute
|
|
|
|
if (!path || history.isActive('/login') || history.isActive('/signup')) {
|
2015-07-14 18:55:34 +02:00
|
|
|
header = <Hero />;
|
|
|
|
} else {
|
2015-10-09 15:19:24 +02:00
|
|
|
header = <Header showAddWork={false} routes={routes}/>;
|
2015-07-13 16:34:26 +02:00
|
|
|
}
|
|
|
|
|
2015-07-10 16:43:35 +02:00
|
|
|
return (
|
2015-09-18 13:46:15 +02:00
|
|
|
<div className={'container ascribe-prize-app client--' + subdomain}>
|
2015-07-13 16:34:26 +02:00
|
|
|
{header}
|
2015-10-01 11:16:38 +02:00
|
|
|
{this.props.children}
|
2015-07-10 16:43:35 +02:00
|
|
|
<GlobalNotification />
|
|
|
|
<div id="modal" className="container"></div>
|
2015-08-18 09:42:28 +02:00
|
|
|
<Footer />
|
2015-07-10 16:43:35 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default PrizeApp;
|