diff --git a/js/app.js b/js/app.js
index a54f01d9..38fcbd40 100644
--- a/js/app.js
+++ b/js/app.js
@@ -8,7 +8,7 @@ import Router from 'react-router';
import fetch from 'isomorphic-fetch';
import ApiUrls from './constants/api_urls';
-import routes from './routes';
+import getRoutes from './routes';
import requests from './utils/requests';
let headers = {
@@ -28,9 +28,35 @@ requests.defaults({
}
});
-Router.run(routes, Router.HistoryLocation, (AscribeApp) => {
- React.render(
- ,
- document.getElementById('main')
- );
-});
+
+class AppGateway {
+
+ start() {
+ let subdomain = window.location.host.split('.')[0];
+ requests.get('whitelabel_settings', {'subdomain': subdomain})
+ .then(this.loadSubdomain.bind(this))
+ .catch(this.loadDefault.bind(this));
+ }
+
+ loadSubdomain(data) {
+ let settings = data.whitelabel;
+
+ this.load('prize');
+ }
+
+ loadDefault() {
+ this.load('default');
+ }
+
+ load(type) {
+ Router.run(getRoutes(type), Router.HistoryLocation, (App) => {
+ React.render(
+ ,
+ document.getElementById('main')
+ );
+ });
+ }
+}
+
+let ag = new AppGateway();
+ag.start();
diff --git a/js/components/routes.js b/js/components/routes.js
new file mode 100644
index 00000000..431d02fb
--- /dev/null
+++ b/js/components/routes.js
@@ -0,0 +1,25 @@
+'use strict';
+
+import React from 'react';
+import Router from 'react-router';
+
+import App from './ascribe_app';
+import AppConstants from '../constants/application_constants';
+
+let Route = Router.Route;
+let Redirect = Router.Redirect;
+let baseUrl = AppConstants.baseUrl;
+
+
+function getRoutes(commonRoutes) {
+ return (
+
+ {commonRoutes}
+
+
+
+ );
+}
+
+
+export default getRoutes;
diff --git a/js/components/whitelabel/prize/app.js b/js/components/whitelabel/prize/app.js
new file mode 100644
index 00000000..c2ca7993
--- /dev/null
+++ b/js/components/whitelabel/prize/app.js
@@ -0,0 +1,24 @@
+'use strict';
+
+import React from 'react';
+import Router from 'react-router';
+import Footer from '../../footer';
+import GlobalNotification from '../../global_notification';
+
+let RouteHandler = Router.RouteHandler;
+
+
+let PrizeApp = React.createClass({
+ render() {
+ return (
+
+ );
+ }
+});
+
+export default PrizeApp;
diff --git a/js/components/whitelabel/prize/components/landing.js b/js/components/whitelabel/prize/components/landing.js
new file mode 100644
index 00000000..e4fb2df8
--- /dev/null
+++ b/js/components/whitelabel/prize/components/landing.js
@@ -0,0 +1,15 @@
+'use strict';
+
+import React from 'react';
+
+let Landing = React.createClass({
+ render() {
+ return (
+
+ Hello from landing
+
+ );
+ }
+});
+
+export default Landing;
diff --git a/js/components/whitelabel/prize/routes.js b/js/components/whitelabel/prize/routes.js
new file mode 100644
index 00000000..e5abb074
--- /dev/null
+++ b/js/components/whitelabel/prize/routes.js
@@ -0,0 +1,26 @@
+'use strict';
+
+import React from 'react';
+import Router from 'react-router';
+
+import Landing from './components/landing';
+
+import App from './app';
+import AppConstants from '../../../constants/application_constants';
+
+let Route = Router.Route;
+// let Redirect = Router.Redirect;
+let baseUrl = AppConstants.baseUrl;
+
+
+function getRoutes(commonRoutes) {
+ return (
+
+
+ {commonRoutes}
+
+ );
+}
+
+
+export default getRoutes;
diff --git a/js/routes.js b/js/routes.js
index db8ed171..0da2f6de 100644
--- a/js/routes.js
+++ b/js/routes.js
@@ -4,6 +4,10 @@ import React from 'react';
import Router from 'react-router';
import AscribeApp from './components/ascribe_app';
+
+import getPrizeRoutes from './components/whitelabel/prize/routes';
+import getDefaultRoutes from './components/routes';
+
import PieceList from './components/piece_list';
import PieceContainer from './components/ascribe_detail/piece_container';
import EditionContainer from './components/ascribe_detail/edition_container';
@@ -22,8 +26,9 @@ let Route = Router.Route;
let Redirect = Router.Redirect;
let baseUrl = AppConstants.baseUrl;
-let routes = (
-
+
+const COMMON_ROUTES = (
+
@@ -33,10 +38,20 @@ let routes = (
-
-
-
);
-export default routes;
+
+function getRoutes(type) {
+ let routes = null;
+ if (type === 'prize') {
+ routes = getPrizeRoutes(COMMON_ROUTES);
+ } else {
+ routes = getDefaultRoutes(COMMON_ROUTES);
+ }
+
+ return routes;
+}
+
+
+export default getRoutes;