diff --git a/js/app.js b/js/app.js index 4d1310de..dcd506fc 100644 --- a/js/app.js +++ b/js/app.js @@ -48,6 +48,7 @@ requests.defaults({ } }); +export let history = createBrowserHistory(); class AppGateway { start() { @@ -70,25 +71,28 @@ class AppGateway { load(settings) { let type = 'default'; let subdomain = 'www'; + let redirectRoute = (); if (settings) { type = settings.type; subdomain = settings.subdomain; } + if(subdomain !== 'www') { + redirectRoute = null; + } + // 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); - let history = createBrowserHistory(); - history.listen(EventActions.routeDidChange); React.render(( - + {redirectRoute} {getRoutes(type, subdomain)} ), document.getElementById('main')); diff --git a/js/components/ascribe_forms/form_contract_agreement.js b/js/components/ascribe_forms/form_contract_agreement.js index 8140743b..8d79644e 100644 --- a/js/components/ascribe_forms/form_contract_agreement.js +++ b/js/components/ascribe_forms/form_contract_agreement.js @@ -139,7 +139,7 @@ let ContractAgreementForm = React.createClass({

{getLangText('No contracts uploaded yet, please go to the ')} - {getLangText('settings page')} + {getLangText('contract settings page')} {getLangText(' and create them.')}

diff --git a/js/components/ascribe_settings/contract_settings.js b/js/components/ascribe_settings/contract_settings.js index 76052b26..741039ee 100644 --- a/js/components/ascribe_settings/contract_settings.js +++ b/js/components/ascribe_settings/contract_settings.js @@ -151,7 +151,8 @@ let ContractSettings = React.createClass({ fileClassToUpload={{ singular: getLangText('new contract'), plural: getLangText('new contracts') - }}/> + }} + location={this.props.location}/> {privateContracts.map((contract, i) => { return ( - ); - } -}); - -export default IkonotvRequestLoan; \ No newline at end of file diff --git a/js/components/whitelabel/wallet/wallet_app.js b/js/components/whitelabel/wallet/wallet_app.js index aa61ad69..d8762ba2 100644 --- a/js/components/whitelabel/wallet/wallet_app.js +++ b/js/components/whitelabel/wallet/wallet_app.js @@ -24,20 +24,22 @@ let WalletApp = React.createClass({ render() { let subdomain = getSubdomain(); - // In react-router 1.0, Routes have no 'name' property anymore. To keep functionality however, - // we split the path by the first occurring slash and take the first splitter. - let activeRoutes = this.props.routes.map(elem => 'route--' + elem.path.split('/')[0]); + // The second element of routes is always the active component object, where we can + // extract the path. + let [, { path } ] = this.props.routes; let header = null; - if ((this.props.history.isActive('/login') || this.props.history.isActive('/signup') || this.props.history.isActive('/contract_notifications')) + if ((this.props.history.isActive('/') || this.props.history.isActive('/login') || this.props.history.isActive('/signup') || this.props.history.isActive('/contract_notifications')) && (['ikonotv', 'cyland']).indexOf(subdomain) > -1) { header = (
); } else { header =
; } + // In react-router 1.0, Routes have no 'name' property anymore. To keep functionality however, + // we split the path by the first occurring slash and take the first splitter. return ( -
+
{header} {this.props.children} diff --git a/js/components/whitelabel/wallet/wallet_routes.js b/js/components/whitelabel/wallet/wallet_routes.js index 7fc7a558..ca030018 100644 --- a/js/components/whitelabel/wallet/wallet_routes.js +++ b/js/components/whitelabel/wallet/wallet_routes.js @@ -1,7 +1,7 @@ 'use strict'; import React from 'react'; -import { Route, Redirect } from 'react-router'; +import { Route, IndexRoute } from 'react-router'; // general components import CoaVerifyContainer from '../../../components/coa_verify_container'; @@ -23,7 +23,7 @@ import CylandPieceList from './components/cyland/cyland_piece_list'; import IkonotvLanding from './components/ikonotv/ikonotv_landing'; import IkonotvPieceList from './components/ikonotv/ikonotv_piece_list'; -import IkonotvRequestLoan from './components/ikonotv/ikonotv_request_loan'; +import ContractAgreementForm from '../../../components/ascribe_forms/form_contract_agreement'; import IkonotvRegisterPiece from './components/ikonotv/ikonotv_register_piece'; import IkonotvPieceContainer from './components/ikonotv/ascribe_detail/ikonotv_piece_container'; import IkonotvContractNotifications from './components/ikonotv/ikonotv_contract_notifications'; @@ -39,7 +39,7 @@ let baseUrl = AppConstants.baseUrl; let ROUTES = { 'cyland': ( - + @@ -71,12 +71,12 @@ let ROUTES = { ), 'ikonotv': ( - + - + diff --git a/js/third_party/notifications.js b/js/third_party/notifications.js index eeac1bff..ec423421 100644 --- a/js/third_party/notifications.js +++ b/js/third_party/notifications.js @@ -1,5 +1,6 @@ 'use strict'; +import { history } from '../app'; import alt from '../alt'; import EventActions from '../actions/event_actions'; @@ -26,7 +27,7 @@ class NotificationsHandler { if (res.notifications && res.notifications.length > 0) { this.loaded = true; console.log('Contractagreement notifications loaded'); - setTimeout(() => window.appRouter.transitionTo('contract_notifications'), 0); + history.pushState(null, '/contract_notifications'); } } );