From 5ded1e0760c58d3886fe39e1e45afdc3ca86f6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 30 Sep 2015 15:05:27 +0200 Subject: [PATCH 01/42] Update browserify-shim and react-router --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0e41d714..951682e8 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "bootstrap-sass": "^3.3.4", "browser-sync": "^2.7.5", "browserify": "^9.0.8", - "browserify-shim": "^3.8.9", + "browserify-shim": "^3.8.10", "classnames": "^1.2.2", "compression": "^1.4.4", "envify": "^3.4.0", @@ -75,7 +75,7 @@ "react": "^0.13.2", "react-bootstrap": "^0.25.1", "react-datepicker": "^0.12.0", - "react-router": "^0.13.3", + "react-router": "^1.0.0-rc1", "react-router-bootstrap": "~0.16.0", "react-star-rating": "~1.3.2", "react-textarea-autosize": "^2.5.2", From eebe936023152206353b89a72114db0fc7772d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 30 Sep 2015 17:09:46 +0200 Subject: [PATCH 02/42] Change: router rendering, router location, route configs, notFound routes, redirect routes, --- js/app.js | 22 +++-- js/components/ascribe_app.js | 15 ++- .../whitelabel/prize/prize_routes.js | 32 +++---- .../whitelabel/wallet/wallet_routes.js | 91 +++++++++---------- js/routes.js | 37 ++++---- package.json | 1 + 6 files changed, 102 insertions(+), 96 deletions(-) diff --git a/js/app.js b/js/app.js index bd1b839a..26129893 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,9 @@ require('babel/polyfill'); import React from 'react'; -import Router from 'react-router'; +import { Router } from 'react-router'; +import createBrowserHistory from 'history/lib/createBrowserHistory'; + /* eslint-disable */ import fetch from 'isomorphic-fetch'; @@ -74,16 +76,20 @@ class AppGateway { subdomain = settings.subdomain; } + // Adds a client specific class to the body for whitelabel styling window.document.body.classList.add('client--' + subdomain); + // Send the applicationWillBoot event to the third-party stores EventActions.applicationWillBoot(settings); - window.appRouter = Router.run(getRoutes(type, subdomain), Router.HistoryLocation, (App) => { - React.render( - , - document.getElementById('main') - ); - EventActions.routeDidChange(); - }); + + let history = createBrowserHistory(); + React.render(( + + {getRoutes(type, subdomain)} + + ), document.getElementById('main')); + + // Send the applicationDidBoot event to the third-party stores EventActions.applicationDidBoot(settings); } } diff --git a/js/components/ascribe_app.js b/js/components/ascribe_app.js index 789399b0..394401be 100644 --- a/js/components/ascribe_app.js +++ b/js/components/ascribe_app.js @@ -1,7 +1,6 @@ 'use strict'; import React from 'react'; -import Router from 'react-router'; import Header from '../components/header'; import Footer from '../components/footer'; import GlobalNotification from './global_notification'; @@ -9,14 +8,22 @@ import GlobalNotification from './global_notification'; import getRoutes from '../routes'; -let RouteHandler = Router.RouteHandler; - let AscribeApp = React.createClass({ + propTypes: { + children: React.PropTypes.oneOfType([ + React.PropTypes.arrayOf(React.PropTypes.element), + React.PropTypes.element + ]) + }, + render() { + let { children } = this.props; + return (
- + {/* Routes are injected here */} + {children}