+ {this.props.notification.length - 1} more...
;
+ numNotifications =
@@ -196,7 +184,7 @@ let NotificationListItem = React.createClass({
render() {
if (this.props.pieceOrEdition) {
return (
-
+
diff --git a/js/components/login_container.js b/js/components/login_container.js
index f050014b..33919cd6 100644
--- a/js/components/login_container.js
+++ b/js/components/login_container.js
@@ -1,21 +1,20 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { Link } from 'react-router';
import LoginForm from './ascribe_forms/form_login';
import { getLangText } from '../utils/lang_utils';
-let Link = Router.Link;
-
let LoginContainer = React.createClass({
propTypes: {
message: React.PropTypes.string,
redirectOnLoggedIn: React.PropTypes.bool,
redirectOnLoginSuccess: React.PropTypes.bool,
- onLogin: React.PropTypes.func
+ onLogin: React.PropTypes.func,
+ location: React.PropTypes.object
},
getDefaultProps() {
@@ -33,10 +32,11 @@ let LoginContainer = React.createClass({
redirectOnLoggedIn={this.props.redirectOnLoggedIn}
redirectOnLoginSuccess={this.props.redirectOnLoginSuccess}
message={this.props.message}
- onLogin={this.props.onLogin}/>
+ onLogin={this.props.onLogin}
+ location={this.props.location}/>
- {getLangText('Not an ascribe user')}? {getLangText('Sign up')}...
- {getLangText('Forgot my password')}? {getLangText('Rescue me')}...
+ {getLangText('Not an ascribe user')}? {getLangText('Sign up')}...
+ {getLangText('Forgot my password')}? {getLangText('Rescue me')}...
);
diff --git a/js/components/logout_container.js b/js/components/logout_container.js
index 74c16439..bfd3fd4f 100644
--- a/js/components/logout_container.js
+++ b/js/components/logout_container.js
@@ -1,38 +1,28 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { History } from 'react-router';
import UserActions from '../actions/user_actions';
import { alt, altWhitelabel, altUser, altThirdParty } from '../alt';
-import AppConstants from '../constants/application_constants';
-let baseUrl = AppConstants.baseUrl;
let LogoutContainer = React.createClass({
-
- mixins: [Router.Navigation, Router.State],
+ mixins: [History],
componentDidMount() {
- UserActions.logoutCurrentUser()
- .then(() => {
- alt.flush();
- altWhitelabel.flush();
- altUser.flush();
- altThirdParty.flush();
- // kill intercom (with fire)
- window.Intercom('shutdown');
- this.replaceWith(baseUrl);
- })
- .catch((err) => {
- console.logGlobal(err);
- });
+ UserActions.logoutCurrentUser();
+ alt.flush();
+ altWhitelabel.flush();
+ altUser.flush();
+ altThirdParty.flush();
+ // kill intercom (with fire)
+ window.Intercom('shutdown');
},
render() {
return null;
}
-
});
diff --git a/js/components/nav_routes_links.js b/js/components/nav_routes_links.js
index d3342cb8..b2c9d9c3 100644
--- a/js/components/nav_routes_links.js
+++ b/js/components/nav_routes_links.js
@@ -13,7 +13,7 @@ import { sanitizeList } from '../utils/general_utils';
let NavRoutesLinks = React.createClass({
propTypes: {
- routes: React.PropTypes.element,
+ routes: React.PropTypes.arrayOf(React.PropTypes.object),
userAcl: React.PropTypes.object
},
@@ -33,15 +33,15 @@ let NavRoutesLinks = React.createClass({
return;
}
- let links = node.props.children.map((child, j) => {
+ let links = node.childRoutes.map((child, j) => {
let childrenFn = null;
- let { aclName, headerTitle, name, children } = child.props;
+ let { aclName, headerTitle, path, childRoutes } = child;
// If the node has children that could be rendered, then we want
// to execute this function again with the child as the root
//
// Otherwise we'll just pass childrenFn as false
- if(child.props.children && child.props.children.length > 0) {
+ if(child.childRoutes && child.childRoutes.length > 0) {
childrenFn = this.extractLinksFromRoutes(child, userAcl, i++);
}
@@ -58,7 +58,7 @@ let NavRoutesLinks = React.createClass({
aclObject={this.props.userAcl}>
@@ -68,7 +68,7 @@ let NavRoutesLinks = React.createClass({
);
@@ -88,7 +88,7 @@ let NavRoutesLinks = React.createClass({
return (
- {this.extractLinksFromRoutes(routes, userAcl, 0)}
+ {this.extractLinksFromRoutes(routes[0], userAcl, 0)}
);
}
diff --git a/js/components/nav_routes_links_link.js b/js/components/nav_routes_links_link.js
index 15aff405..11235ccd 100644
--- a/js/components/nav_routes_links_link.js
+++ b/js/components/nav_routes_links_link.js
@@ -3,13 +3,16 @@
import React from 'react';
import DropdownButton from 'react-bootstrap/lib/DropdownButton';
-import MenuItemLink from 'react-router-bootstrap/lib/MenuItemLink';
-import NavItemLink from 'react-router-bootstrap/lib/NavItemLink';
+import MenuItem from 'react-bootstrap/lib/MenuItem';
+import NavItem from 'react-bootstrap/lib/NavItem';
+
+import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
+
let NavRoutesLinksLink = React.createClass({
propTypes: {
headerTitle: React.PropTypes.string,
- routeName: React.PropTypes.string,
+ routePath: React.PropTypes.string,
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element),
@@ -20,10 +23,10 @@ let NavRoutesLinksLink = React.createClass({
},
render() {
- let { children, headerTitle, depth, routeName } = this.props;
+ let { children, headerTitle, depth, routePath } = this.props;
// if the route has children, we're returning a DropdownButton that will get filled
- // with MenuItemLinks
+ // with MenuItems
if(children) {
return (
@@ -33,13 +36,17 @@ let NavRoutesLinksLink = React.createClass({
} else {
if(depth === 1) {
// if the node's child is actually a node of level one (a child of a node), we're
- // returning a DropdownButton matching MenuItemLink
+ // returning a DropdownButton matching MenuItem
return (
- {headerTitle}
+
+ {headerTitle}
+
);
} else if(depth === 0) {
return (
- {headerTitle}
+
+ {headerTitle}
+
);
} else {
return null;
diff --git a/js/components/password_reset_container.js b/js/components/password_reset_container.js
index ae581fdf..1009a0f4 100644
--- a/js/components/password_reset_container.js
+++ b/js/components/password_reset_container.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { History } from 'react-router';
import Form from './ascribe_forms/form';
import Property from './ascribe_forms/property';
@@ -13,7 +13,9 @@ import { getLangText } from '../utils/lang_utils';
let PasswordResetContainer = React.createClass({
- mixins: [Router.Navigation],
+ propTypes: {
+ location: React.PropTypes.object
+ },
getInitialState() {
return {isRequested: false};
@@ -24,12 +26,14 @@ let PasswordResetContainer = React.createClass({
},
render() {
- if (this.props.query.email && this.props.query.token) {
+ let { location } = this.props;
+
+ if (location.query.email && location.query.token) {
return (
+ email={location.query.email}
+ token={location.query.token}/>
);
}
@@ -112,7 +116,7 @@ let PasswordResetForm = React.createClass({
token: React.PropTypes.string
},
- mixins: [Router.Navigation],
+ mixins: [History],
getFormData() {
return {
@@ -122,7 +126,7 @@ let PasswordResetForm = React.createClass({
},
handleSuccess() {
- this.transitionTo('pieces');
+ this.history.pushState(null, '/collection');
let notification = new GlobalNotificationModel(getLangText('password successfully updated'), 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
},
diff --git a/js/components/piece_list.js b/js/components/piece_list.js
index 05557418..be0aab9d 100644
--- a/js/components/piece_list.js
+++ b/js/components/piece_list.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { History } from 'react-router';
import PieceListStore from '../stores/piece_list_store';
import PieceListActions from '../actions/piece_list_actions';
@@ -33,10 +33,11 @@ let PieceList = React.createClass({
customSubmitButton: React.PropTypes.element,
filterParams: React.PropTypes.array,
orderParams: React.PropTypes.array,
- orderBy: React.PropTypes.string
+ orderBy: React.PropTypes.string,
+ location: React.PropTypes.object
},
- mixins: [Router.Navigation, Router.State],
+ mixins: [History],
getDefaultProps() {
return {
@@ -60,7 +61,7 @@ let PieceList = React.createClass({
},
componentDidMount() {
- let page = this.getQuery().page || 1;
+ let page = this.props.location.query.page || 1;
PieceListStore.listen(this.onChange);
EditionListStore.listen(this.onChange);
@@ -75,7 +76,7 @@ let PieceList = React.createClass({
componentDidUpdate() {
if (this.props.redirectTo && this.state.unfilteredPieceListCount === 0) {
// FIXME: hack to redirect out of the dispatch cycle
- window.setTimeout(() => this.transitionTo(this.props.redirectTo, this.getQuery()));
+ window.setTimeout(() => this.history.pushState(null, this.props.redirectTo, this.props.location.query), 0);
}
},
@@ -100,7 +101,7 @@ let PieceList = React.createClass({
},
getPagination() {
- let currentPage = parseInt(this.getQuery().page, 10) || 1;
+ let currentPage = parseInt(this.props.location.query.page, 10) || 1;
let totalPages = Math.ceil(this.state.pieceListCount / this.state.pageSize);
if (this.state.pieceListCount > 10) {
@@ -116,7 +117,7 @@ let PieceList = React.createClass({
searchFor(searchTerm) {
PieceListActions.fetchPieceList(1, this.state.pageSize, searchTerm, this.state.orderBy,
this.state.orderAsc, this.state.filterBy);
- this.transitionTo(this.getPathname(), {page: 1});
+ this.history.pushState(null, this.props.location.pathname, {page: 1});
},
applyFilterBy(filterBy){
@@ -140,7 +141,7 @@ let PieceList = React.createClass({
// we have to redirect the user always to page one as it could be that there is no page two
// for filtered pieces
- this.transitionTo(this.getPathname(), {page: 1});
+ this.history.pushState(null, this.props.location.pathname, {page: 1});
},
applyOrderBy(orderBy) {
diff --git a/js/components/register_piece.js b/js/components/register_piece.js
index 1a09e64f..02ca79a0 100644
--- a/js/components/register_piece.js
+++ b/js/components/register_piece.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { History } from 'react-router';
import Col from 'react-bootstrap/lib/Col';
import Row from 'react-bootstrap/lib/Row';
@@ -20,10 +20,6 @@ import GlobalNotificationActions from '../actions/global_notification_actions';
import PropertyCollapsible from './ascribe_forms/property_collapsible';
import RegisterPieceForm from './ascribe_forms/form_register_piece';
-import LoginContainer from './login_container';
-import SlidesContainer from './ascribe_slides_container/slides_container';
-
-
import { mergeOptions } from '../utils/general_utils';
import { getLangText } from '../utils/lang_utils';
@@ -37,10 +33,11 @@ let RegisterPiece = React.createClass( {
React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element,
React.PropTypes.string
- ])
+ ]),
+ location: React.PropTypes.object
},
- mixins: [Router.Navigation],
+ mixins: [History],
getDefaultProps() {
return {
@@ -60,10 +57,10 @@ let RegisterPiece = React.createClass( {
},
componentDidMount() {
- WhitelabelActions.fetchWhitelabel();
PieceListStore.listen(this.onChange);
UserStore.listen(this.onChange);
WhitelabelStore.listen(this.onChange);
+ WhitelabelActions.fetchWhitelabel();
},
componentWillUnmount() {
@@ -98,7 +95,7 @@ let RegisterPiece = React.createClass( {
this.state.filterBy
);
- this.transitionTo('piece', {pieceId: response.piece.id});
+ this.history.pushState(null, `/pieces/${response.piece.id}`);
},
getSpecifyEditions() {
@@ -117,53 +114,20 @@ let RegisterPiece = React.createClass( {
}
},
- // basically redirects to the second slide (index: 1), when the user is not logged in
- onLoggedOut() {
- // only transition to the login store, if user is not logged in
- // ergo the currentUser object is not properly defined
- if(this.state.currentUser && !this.state.currentUser.email) {
- this.refs.slidesContainer.setSlideNum(1);
- }
- },
-
- onLogin() {
- // once the currentUser object from UserStore is defined (eventually the user was transitioned
- // to the login form via the slider and successfully logged in), we can direct him back to the
- // register_piece slide
- if(this.state.currentUser && this.state.currentUser.email) {
- window.history.back();
- }
- },
-
render() {
return (
-
-
-
-
-
- {this.props.children}
- {this.getSpecifyEditions()}
-
-
-
-
-
-
-
-
+
+
+
+ {this.props.children}
+ {this.getSpecifyEditions()}
+
+
+
);
}
});
diff --git a/js/components/signup_container.js b/js/components/signup_container.js
index 69fab1e8..7c7b5ee7 100644
--- a/js/components/signup_container.js
+++ b/js/components/signup_container.js
@@ -1,15 +1,18 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { Link } from 'react-router';
import SignupForm from './ascribe_forms/form_signup';
import { getLangText } from '../utils/lang_utils';
-let Link = Router.Link;
let SignupContainer = React.createClass({
+ propTypes: {
+ location: React.PropTypes.object
+ },
+
getInitialState() {
return {
submitted: false,
@@ -37,9 +40,11 @@ let SignupContainer = React.createClass({
}
return (
-
+
- {getLangText('Already an ascribe user')}? {getLangText('Log in')}...
+ {getLangText('Already an ascribe user')}? {getLangText('Log in')}...
diff --git a/js/components/whitelabel/prize/components/ascribe_accordion_list/accordion_list_item_prize.js b/js/components/whitelabel/prize/components/ascribe_accordion_list/accordion_list_item_prize.js
index 7b3d5de0..a444b836 100644
--- a/js/components/whitelabel/prize/components/ascribe_accordion_list/accordion_list_item_prize.js
+++ b/js/components/whitelabel/prize/components/ascribe_accordion_list/accordion_list_item_prize.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { Link } from 'react-router';
import StarRating from 'react-star-rating';
import PieceListActions from '../../../../../actions/piece_list_actions';
@@ -21,12 +21,9 @@ import GlobalNotificationActions from '../../../../../actions/global_notificatio
import AclProxy from '../../../../acl_proxy';
import SubmitToPrizeButton from './../ascribe_buttons/submit_to_prize_button';
-
import { getLangText } from '../../../../../utils/lang_utils';
import { mergeOptions } from '../../../../../utils/general_utils';
-let Link = Router.Link;
-
let AccordionListItemPrize = React.createClass({
propTypes: {
@@ -85,7 +82,7 @@ let AccordionListItemPrize = React.createClass({
return (
-
+
-
+
{getLangText('Submit your rating')}
diff --git a/js/components/whitelabel/prize/components/ascribe_detail/prize_piece_container.js b/js/components/whitelabel/prize/components/ascribe_detail/prize_piece_container.js
index 73cfa83a..77774126 100644
--- a/js/components/whitelabel/prize/components/ascribe_detail/prize_piece_container.js
+++ b/js/components/whitelabel/prize/components/ascribe_detail/prize_piece_container.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { Link } from 'react-router';
import Moment from 'moment';
import StarRating from 'react-star-rating';
@@ -41,7 +41,6 @@ import ApiUrls from '../../../../../constants/api_urls';
import { mergeOptions } from '../../../../../utils/general_utils';
import { getLangText } from '../../../../../utils/lang_utils';
-let Link = Router.Link;
/**
* This is the component that implements resource/data specific functionality
@@ -169,12 +168,12 @@ let NavigationHeader = React.createClass({
return (
-
+
{getLangText('Previous')}
-
+
{getLangText('Next')}
diff --git a/js/components/whitelabel/prize/components/prize_landing.js b/js/components/whitelabel/prize/components/prize_landing.js
index c47f8088..355b3786 100644
--- a/js/components/whitelabel/prize/components/prize_landing.js
+++ b/js/components/whitelabel/prize/components/prize_landing.js
@@ -1,14 +1,16 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { History } from 'react-router';
import PrizeActions from '../actions/prize_actions';
import PrizeStore from '../stores/prize_store';
-import ButtonLink from 'react-router-bootstrap/lib/ButtonLink';
+import Button from 'react-bootstrap/lib/Button';
import ButtonGroup from 'react-bootstrap/lib/ButtonGroup';
+import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
+
import UserStore from '../../../../stores/user_store';
import UserActions from '../../../../actions/user_actions';
@@ -17,7 +19,7 @@ import { getLangText } from '../../../../utils/lang_utils';
let Landing = React.createClass({
- mixins: [Router.Navigation],
+ mixins: [History],
getInitialState() {
return mergeOptions(
@@ -44,7 +46,7 @@ let Landing = React.createClass({
// if user is already logged in, redirect him to piece list
if(this.state.currentUser && this.state.currentUser.email) {
// FIXME: hack to redirect out of the dispatch cycle
- window.setTimeout(() => this.replaceWith('pieces'), 0);
+ window.setTimeout(() => this.history.replaceState(null, '/collection'), 0);
}
},
@@ -52,16 +54,20 @@ let Landing = React.createClass({
if (this.state.prize && this.state.prize.active){
return (
-
- {getLangText('Sign up to submit')}
-
+
+
+ {getLangText('Sign up to submit')}
+
+
{getLangText('or, already an ascribe user?')}
-
- {getLangText('Log in to submit')}
-
+
+
+ {getLangText('Log in to submit')}
+
+
);
}
@@ -74,9 +80,11 @@ let Landing = React.createClass({
{getLangText('or, already an ascribe user?')}
-
- {getLangText('Log in')}
-
+
+
+ {getLangText('Log in')}
+
+
);
},
diff --git a/js/components/whitelabel/prize/components/prize_login_container.js b/js/components/whitelabel/prize/components/prize_login_container.js
index eaceb503..8f06ee91 100644
--- a/js/components/whitelabel/prize/components/prize_login_container.js
+++ b/js/components/whitelabel/prize/components/prize_login_container.js
@@ -1,29 +1,32 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { Link } from 'react-router';
import LoginForm from '../../../ascribe_forms/form_login';
import { getLangText } from '../../../../utils/lang_utils';
-let Link = Router.Link;
-
let LoginContainer = React.createClass({
+ propTypes: {
+ location: React.PropTypes.object
+ },
+
render() {
return (
+ headerMessage={getLangText('Log in with ascribe')}
+ location={this.props.location}/>
{getLangText('I\'m not a user') + ' '}
- {getLangText('Sign up...')}
+ {getLangText('Sign up...')}
{getLangText('I forgot my password') + ' '}
- {getLangText('Rescue me...')}
+ {getLangText('Rescue me...')}
);
diff --git a/js/components/whitelabel/prize/components/prize_piece_list.js b/js/components/whitelabel/prize/components/prize_piece_list.js
index 04f8eb42..99d7452a 100644
--- a/js/components/whitelabel/prize/components/prize_piece_list.js
+++ b/js/components/whitelabel/prize/components/prize_piece_list.js
@@ -9,13 +9,20 @@ import UserStore from '../../../../stores/user_store';
import PrizeActions from '../actions/prize_actions';
import PrizeStore from '../stores/prize_store';
-import ButtonLink from 'react-router-bootstrap/lib/ButtonLink';
+import Button from 'react-bootstrap/lib/Button';
+
+import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
+
import AccordionListItemPrize from './ascribe_accordion_list/accordion_list_item_prize';
import { mergeOptions } from '../../../../utils/general_utils';
import { getLangText } from '../../../../utils/lang_utils';
let PrizePieceList = React.createClass({
+ propTypes: {
+ location: React.PropTypes.object
+ },
+
getInitialState() {
return mergeOptions(
PrizeStore.getState(),
@@ -42,9 +49,11 @@ let PrizePieceList = React.createClass({
getButtonSubmit() {
if (this.state.prize && this.state.prize.active && !this.state.currentUser.is_jury){
return (
-
- {getLangText('Submit to prize')}
-
+
+
+ {getLangText('Submit to prize')}
+
+
);
}
else if (this.state.prize && this.state.currentUser.is_judge){
@@ -65,12 +74,13 @@ let PrizePieceList = React.createClass({
+ customSubmitButton={this.getButtonSubmit()}
+ location={this.props.location}/>
);
}
diff --git a/js/components/whitelabel/prize/components/prize_signup_container.js b/js/components/whitelabel/prize/components/prize_signup_container.js
index f269864d..e78e8e6c 100644
--- a/js/components/whitelabel/prize/components/prize_signup_container.js
+++ b/js/components/whitelabel/prize/components/prize_signup_container.js
@@ -6,6 +6,10 @@ import SignupForm from '../../../ascribe_forms/form_signup';
import { getLangText } from '../../../../utils/lang_utils';
let SignupContainer = React.createClass({
+ propTypes: {
+ location: React.PropTypes.object
+ },
+
getInitialState() {
return {
submitted: false,
@@ -35,7 +39,8 @@ let SignupContainer = React.createClass({
+ handleSuccess={this.handleSuccess}
+ location={this.props.location}/>
);
}
diff --git a/js/components/whitelabel/prize/prize_app.js b/js/components/whitelabel/prize/prize_app.js
index e0be7707..aadb0b05 100644
--- a/js/components/whitelabel/prize/prize_app.js
+++ b/js/components/whitelabel/prize/prize_app.js
@@ -1,38 +1,44 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
import Hero from './components/prize_hero';
import Header from '../../header';
import Footer from '../../footer';
import GlobalNotification from '../../global_notification';
-import getRoutes from './prize_routes';
-
import { getSubdomain } from '../../../utils/general_utils';
-let RouteHandler = Router.RouteHandler;
-
let PrizeApp = React.createClass({
- mixins: [Router.State],
+ propTypes: {
+ children: React.PropTypes.oneOfType([
+ React.PropTypes.arrayOf(React.PropTypes.element),
+ React.PropTypes.element
+ ]),
+ history: React.PropTypes.object,
+ routes: React.PropTypes.arrayOf(React.PropTypes.object)
+ },
render() {
+ const { history, routes } = this.props;
let header = null;
let subdomain = getSubdomain();
- let ROUTES = getRoutes(null, subdomain);
+ // 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 (this.isActive('landing') || this.isActive('login') || this.isActive('signup')) {
+ // if the path of the current activeRoute is not defined, then this is the IndexRoute
+ if (!path || history.isActive('/login') || history.isActive('/signup')) {
header =
;
} else {
- header =
;
+ header = ;
}
return (
{header}
-
+ {this.props.children}
diff --git a/js/components/whitelabel/prize/prize_routes.js b/js/components/whitelabel/prize/prize_routes.js
index 7ca132e2..14d8b4d9 100644
--- a/js/components/whitelabel/prize/prize_routes.js
+++ b/js/components/whitelabel/prize/prize_routes.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { Route, IndexRoute } from 'react-router';
import Landing from './components/prize_landing';
import LoginContainer from './components/prize_login_container';
@@ -17,31 +17,45 @@ import CoaVerifyContainer from '../../../components/coa_verify_container';
import ErrorNotFoundPage from '../../../components/error_not_found_page';
import App from './prize_app';
-import AppConstants from '../../../constants/application_constants';
-let Route = Router.Route;
-let NotFoundRoute = Router.NotFoundRoute;
-let baseUrl = AppConstants.baseUrl;
+import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
function getRoutes() {
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
);
}
-export default getRoutes;
\ No newline at end of file
+export default getRoutes;
diff --git a/js/components/whitelabel/wallet/components/cc/cc_register_piece.js b/js/components/whitelabel/wallet/components/cc/cc_register_piece.js
index c9690477..fe59f819 100644
--- a/js/components/whitelabel/wallet/components/cc/cc_register_piece.js
+++ b/js/components/whitelabel/wallet/components/cc/cc_register_piece.js
@@ -11,6 +11,9 @@ import { getLangText } from '../../../../../utils/lang_utils';
import { mergeOptions } from '../../../../../utils/general_utils';
let CCRegisterPiece = React.createClass({
+ propTypes: {
+ location: React.PropTypes.object
+ },
getInitialState() {
return mergeOptions(
@@ -82,7 +85,8 @@ let CCRegisterPiece = React.createClass({
+ submitMessage={getLangText('Submit')}
+ location={this.props.location}>
{this.getLicenses()}
);
diff --git a/js/components/whitelabel/wallet/components/cyland/cyland_buttons/cyland_submit_button.js b/js/components/whitelabel/wallet/components/cyland/cyland_buttons/cyland_submit_button.js
index d8a039a3..45b8c45e 100644
--- a/js/components/whitelabel/wallet/components/cyland/cyland_buttons/cyland_submit_button.js
+++ b/js/components/whitelabel/wallet/components/cyland/cyland_buttons/cyland_submit_button.js
@@ -3,7 +3,9 @@
import React from 'react';
import classNames from 'classnames';
-import ButtonLink from 'react-router-bootstrap/lib/ButtonLink';
+import Button from 'react-bootstrap/lib/Button';
+
+import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
import WhitelabelActions from '../../../../../../actions/whitelabel_actions';
import WhitelabelStore from '../../../../../../stores/whitelabel_store';
@@ -37,29 +39,21 @@ let CylandSubmitButton = React.createClass({
},
render() {
- let piece = this.props.piece;
- let startFrom = 1;
-
- // In the Cyland register page a user has to complete three steps.
- // Since every one of those steps is atomic a user should always be able to continue
- // where he left of.
- // This is why we start the process form slide 1/2 if the user has already finished
- // it in another session.
- if(piece && piece.extra_data && Object.keys(piece.extra_data).length > 0) {
- startFrom = 2;
- }
+ const { piece, className } = this.props;
return (
-
- {getLangText('Submit to Cyland')}
-
+ 'start_from': 1,
+ 'piece_id': piece.id
+ }}>
+
+ {getLangText('Submit to Cyland')}
+
+
);
}
});
diff --git a/js/components/whitelabel/wallet/components/cyland/cyland_detail/cyland_piece_container.js b/js/components/whitelabel/wallet/components/cyland/cyland_detail/cyland_piece_container.js
index 17d06d19..2362d759 100644
--- a/js/components/whitelabel/wallet/components/cyland/cyland_detail/cyland_piece_container.js
+++ b/js/components/whitelabel/wallet/components/cyland/cyland_detail/cyland_piece_container.js
@@ -22,6 +22,7 @@ import { mergeOptions } from '../../../../../../utils/general_utils';
let CylandPieceContainer = React.createClass({
propTypes: {
+ location: React.PropTypes.object,
params: React.PropTypes.object
},
@@ -72,7 +73,8 @@ let CylandPieceContainer = React.createClass({
+ isInline={true}
+ location={this.props.location}/>
);
diff --git a/js/components/whitelabel/wallet/components/cyland/cyland_forms/cyland_additional_data_form.js b/js/components/whitelabel/wallet/components/cyland/cyland_forms/cyland_additional_data_form.js
index eeeb6546..1ef12557 100644
--- a/js/components/whitelabel/wallet/components/cyland/cyland_forms/cyland_additional_data_form.js
+++ b/js/components/whitelabel/wallet/components/cyland/cyland_forms/cyland_additional_data_form.js
@@ -26,7 +26,8 @@ let CylandAdditionalDataForm = React.createClass({
handleSuccess: React.PropTypes.func,
piece: React.PropTypes.object.isRequired,
disabled: React.PropTypes.bool,
- isInline: React.PropTypes.bool
+ isInline: React.PropTypes.bool,
+ location: React.PropTypes.object
},
getDefaultProps() {
@@ -140,7 +141,8 @@ let CylandAdditionalDataForm = React.createClass({
isReadyForFormSubmission={formSubmissionValidation.fileOptional}
pieceId={piece.id}
otherData={piece.other_data}
- multiple={true}/>
+ multiple={true}
+ location={this.props.location}/>
);
} else {
diff --git a/js/components/whitelabel/wallet/components/cyland/cyland_landing.js b/js/components/whitelabel/wallet/components/cyland/cyland_landing.js
index 29d966cc..c830e78a 100644
--- a/js/components/whitelabel/wallet/components/cyland/cyland_landing.js
+++ b/js/components/whitelabel/wallet/components/cyland/cyland_landing.js
@@ -1,12 +1,15 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { History } from 'react-router';
+
import WhitelabelActions from '../../../../../actions/whitelabel_actions';
import WhitelabelStore from '../../../../../stores/whitelabel_store';
-import ButtonLink from 'react-router-bootstrap/lib/ButtonLink';
+import Button from 'react-bootstrap/lib/Button';
+
+import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
import UserStore from '../../../../../stores/user_store';
import UserActions from '../../../../../actions/user_actions';
@@ -16,7 +19,7 @@ import { getLangText } from '../../../../../utils/lang_utils';
let CylandLanding = React.createClass({
- mixins: [Router.Navigation],
+ mixins: [History],
getInitialState() {
return mergeOptions(
@@ -43,7 +46,7 @@ let CylandLanding = React.createClass({
// if user is already logged in, redirect him to piece list
if(this.state.currentUser && this.state.currentUser.email) {
// FIXME: hack to redirect out of the dispatch cycle
- window.setTimeout(() => this.replaceWith('pieces'), 0);
+ window.setTimeout(() => this.history.replaceState(null, '/collection'), 0);
}
},
@@ -67,17 +70,21 @@ let CylandLanding = React.createClass({
{getLangText('Existing ascribe user?')}
-
- {getLangText('Log in')}
-
+
+
+ {getLangText('Log in')}
+
+
{getLangText('Do you need an account?')}
-
- {getLangText('Sign up')}
-
+
+
+ {getLangText('Sign up')}
+
+
diff --git a/js/components/whitelabel/wallet/components/cyland/cyland_piece_list.js b/js/components/whitelabel/wallet/components/cyland/cyland_piece_list.js
index f5270bcf..5fbb326b 100644
--- a/js/components/whitelabel/wallet/components/cyland/cyland_piece_list.js
+++ b/js/components/whitelabel/wallet/components/cyland/cyland_piece_list.js
@@ -12,6 +12,10 @@ import { getLangText } from '../../../../../utils/lang_utils';
let CylandPieceList = React.createClass({
+ propTypes: {
+ location: React.PropTypes.object
+ },
+
getInitialState() {
return UserStore.getState();
},
@@ -33,7 +37,7 @@ let CylandPieceList = React.createClass({
return (
+ location={this.props.location}/>
);
}
diff --git a/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js b/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js
index 710bef3e..aaa348c6 100644
--- a/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js
+++ b/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { History } from 'react-router';
import Moment from 'moment';
@@ -39,8 +39,11 @@ import { getAclFormMessage } from '../../../../../utils/form_utils';
let CylandRegisterPiece = React.createClass({
+ propTypes: {
+ location: React.PropTypes.object
+ },
- mixins: [Router.Navigation, Router.State],
+ mixins: [History],
getInitialState(){
return mergeOptions(
@@ -63,7 +66,7 @@ let CylandRegisterPiece = React.createClass({
UserActions.fetchCurrentUser();
WhitelabelActions.fetchWhitelabel();
- let queryParams = this.getQuery();
+ let queryParams = this.props.location.query;
// Since every step of this register process is atomic,
// we may need to enter the process at step 1 or 2.
@@ -101,12 +104,13 @@ let CylandRegisterPiece = React.createClass({
// also start loading the piece for the next step
if(response && response.piece) {
+ PieceActions.updatePiece({});
PieceActions.updatePiece(response.piece);
}
this.incrementStep();
- this.refs.slidesContainer.nextSlide();
+ this.refs.slidesContainer.nextSlide({ piece_id: response.piece.id });
},
handleAdditionalDataSuccess() {
@@ -130,7 +134,8 @@ let CylandRegisterPiece = React.createClass({
this.refreshPieceList();
PieceActions.fetchOne(this.state.piece.id);
- this.transitionTo('piece', {pieceId: this.state.piece.id});
+
+ this.history.pushState(null, `/pieces/${this.state.piece.id}`);
},
// We need to increase the step to lock the forms that are already filled out
@@ -163,7 +168,7 @@ let CylandRegisterPiece = React.createClass({
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
- this.transitionTo('login');
+ this.history.pushState(null, '/login');
},
render() {
@@ -179,7 +184,8 @@ let CylandRegisterPiece = React.createClass({
glyphiconClassNames={{
pending: 'glyphicon glyphicon-chevron-right',
completed: 'glyphicon glyphicon-lock'
- }}>
+ }}
+ location={this.props.location}>
@@ -190,7 +196,8 @@ let CylandRegisterPiece = React.createClass({
submitMessage={getLangText('Submit')}
isFineUploaderActive={this.state.isFineUploaderActive}
handleSuccess={this.handleRegisterSuccess}
- onLoggedOut={this.onLoggedOut} />
+ onLoggedOut={this.onLoggedOut}
+ location={this.props.location}/>
@@ -200,7 +207,8 @@ let CylandRegisterPiece = React.createClass({
1}
handleSuccess={this.handleAdditionalDataSuccess}
- piece={this.state.piece}/>
+ piece={this.state.piece}
+ location={this.props.location}/>
diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_buttons/ikonotv_submit_button.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_buttons/ikonotv_submit_button.js
index 0a2b46bc..24af1d0b 100644
--- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_buttons/ikonotv_submit_button.js
+++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_buttons/ikonotv_submit_button.js
@@ -2,7 +2,10 @@
import React from 'react';
import classNames from 'classnames';
-import ButtonLink from 'react-router-bootstrap/lib/ButtonLink';
+
+import Button from 'react-bootstrap/lib/Button';
+
+import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
import { getLangText } from '../../../../../../utils/lang_utils';
@@ -32,16 +35,18 @@ let IkonotvSubmitButton = React.createClass({
}
return (
-
- {getLangText('Loan to IkonoTV')}
-
+ }}>
+
+ {getLangText('Loan to IkonoTV')}
+
+
);
}
});
diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_contract_notifications.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_contract_notifications.js
index 03e01a7e..42b1fc9b 100644
--- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_contract_notifications.js
+++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_contract_notifications.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { History } from 'react-router';
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
import Button from 'react-bootstrap/lib/Button';
@@ -29,11 +29,10 @@ import AppConstants from '../../../../../constants/application_constants';
import { getLangText } from '../../../../../utils/lang_utils';
import { mergeOptions } from '../../../../../utils/general_utils';
-let Navigation = Router.Navigation;
let IkonotvContractNotifications = React.createClass({
- mixins: [Navigation],
+ mixins: [History],
getInitialState() {
return mergeOptions(
@@ -114,7 +113,7 @@ let IkonotvContractNotifications = React.createClass({
handleConfirmSuccess() {
let notification = new GlobalNotificationModel(getLangText('You have accepted the conditions'), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification);
- this.transitionTo('pieces');
+ this.history.pushState(null, '/collection');
},
handleDeny() {
@@ -127,7 +126,7 @@ let IkonotvContractNotifications = React.createClass({
handleDenySuccess() {
let notification = new GlobalNotificationModel(getLangText('You have denied the conditions'), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification);
- this.transitionTo('pieces');
+ this.history.pushState(null, '/collection');
},
getCopyrightAssociationForm(){
diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_landing.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_landing.js
index 57abc5db..43d2d803 100644
--- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_landing.js
+++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_landing.js
@@ -1,9 +1,10 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
-import ButtonLink from 'react-router-bootstrap/lib/ButtonLink';
+import Button from 'react-bootstrap/lib/Button';
+
+import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
import UserStore from '../../../../../stores/user_store';
import UserActions from '../../../../../actions/user_actions';
@@ -12,8 +13,9 @@ import { getLangText } from '../../../../../utils/lang_utils';
let IkonotvLanding = React.createClass({
-
- mixins: [Router.Navigation, Router.State],
+ propTypes: {
+ location: React.PropTypes.object
+ },
getInitialState() {
return UserStore.getState();
@@ -33,18 +35,21 @@ let IkonotvLanding = React.createClass({
},
getEnterButton() {
- let redirect = 'login';
+ let redirect = '/login';
if(this.state.currentUser && this.state.currentUser.email) {
- redirect = 'pieces';
+ redirect = '/collection';
}
- else if (this.getQuery() && this.getQuery().redirect) {
- redirect = this.getQuery().redirect;
+ else if (this.props.location.query && this.props.location.query.redirect) {
+ redirect = '/' + this.props.location.query.redirect;
}
+
return (
-
- {getLangText('ENTER TO START')}
-
+
+
+ {getLangText('ENTER TO START')}
+
+
);
},
diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_piece_list.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_piece_list.js
index 36869fef..48d1f952 100644
--- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_piece_list.js
+++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_piece_list.js
@@ -12,6 +12,10 @@ import { getLangText } from '../../../../../utils/lang_utils';
let IkonotvPieceList = React.createClass({
+ propTypes: {
+ location: React.PropTypes.object
+ },
+
getInitialState() {
return UserStore.getState();
},
@@ -33,7 +37,7 @@ let IkonotvPieceList = React.createClass({
return (
+ }]}
+ location={this.props.location}/>
);
}
diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js
index 4cf1ccfb..98fe6715 100644
--- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js
+++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js
@@ -2,7 +2,7 @@
import React from 'react';
import Moment from 'moment';
-import Router from 'react-router';
+import { History } from 'react-router';
import Col from 'react-bootstrap/lib/Col';
import Row from 'react-bootstrap/lib/Row';
@@ -33,13 +33,13 @@ import { mergeOptions } from '../../../../../utils/general_utils';
import { getLangText } from '../../../../../utils/lang_utils';
let IkonotvRegisterPiece = React.createClass({
-
propTypes: {
handleSuccess: React.PropTypes.func,
- piece: React.PropTypes.object.isRequired
+ piece: React.PropTypes.object.isRequired,
+ location: React.PropTypes.object
},
- mixins: [Router.Navigation, Router.State],
+ mixins: [History],
getInitialState(){
return mergeOptions(
@@ -61,7 +61,7 @@ let IkonotvRegisterPiece = React.createClass({
// not want to display to the user.
PieceActions.updatePiece({});
- let queryParams = this.getQuery();
+ let queryParams = this.props.location.query;
// Since every step of this register process is atomic,
// we may need to enter the process at step 1 or 2.
@@ -102,7 +102,7 @@ let IkonotvRegisterPiece = React.createClass({
PieceActions.updatePiece(response.piece);
}
if (!this.canSubmit()) {
- this.transitionTo('pieces');
+ this.history.pushState(null, '/collection');
}
else {
this.incrementStep();
@@ -132,7 +132,7 @@ let IkonotvRegisterPiece = React.createClass({
this.refreshPieceList();
PieceActions.fetchOne(this.state.piece.id);
- this.transitionTo('piece', {pieceId: this.state.piece.id});
+ this.history.pushState(null, `/pieces/${this.state.piece.id}`);
},
// We need to increase the step to lock the forms that are already filled out
@@ -165,7 +165,7 @@ let IkonotvRegisterPiece = React.createClass({
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
- this.transitionTo('login');
+ this.history.pushState(null, '/login');
},
canSubmit() {
@@ -245,7 +245,8 @@ let IkonotvRegisterPiece = React.createClass({
glyphiconClassNames={{
pending: 'glyphicon glyphicon-chevron-right',
completed: 'glyphicon glyphicon-lock'
- }}>
+ }}
+ location={this.props.location}>
@@ -256,7 +257,8 @@ let IkonotvRegisterPiece = React.createClass({
submitMessage={getLangText('Register')}
isFineUploaderActive={this.state.isFineUploaderActive}
handleSuccess={this.handleRegisterSuccess}
- onLoggedOut={this.onLoggedOut} />
+ onLoggedOut={this.onLoggedOut}
+ location={this.props.location}/>
diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_request_loan.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_request_loan.js
deleted file mode 100644
index bbe47540..00000000
--- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_request_loan.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict';
-
-import React from 'react';
-
-import ContractAgreementForm from '../../../../ascribe_forms/form_contract_agreement';
-
-
-let IkonotvRequestLoan = React.createClass({
- render() {
- 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 bbc58689..2ae0a7fc 100644
--- a/js/components/whitelabel/wallet/wallet_app.js
+++ b/js/components/whitelabel/wallet/wallet_app.js
@@ -1,43 +1,50 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
import Header from '../../header';
import Footer from '../../footer';
import GlobalNotification from '../../global_notification';
-import getRoutes from './wallet_routes';
import classNames from 'classnames';
import { getSubdomain } from '../../../utils/general_utils';
-let RouteHandler = Router.RouteHandler;
-
-
let WalletApp = React.createClass({
- mixins: [Router.State],
+ propTypes: {
+ children: React.PropTypes.oneOfType([
+ React.PropTypes.arrayOf(React.PropTypes.element),
+ React.PropTypes.element
+ ]),
+ history: React.PropTypes.object,
+ routes: React.PropTypes.arrayOf(React.PropTypes.object)
+ },
render() {
- let subdomain = getSubdomain();
- let ROUTES = getRoutes(null, subdomain);
- let activeRoutes = this.getRoutes().map(elem => 'route--' + elem.name);
-
let header = null;
- if ((this.isActive('landing') || this.isActive('login') || this.isActive('signup') || this.isActive('contract_notifications'))
+ let subdomain = getSubdomain();
+ const { history, routes, children } = this.props;
+
+ // 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') || history.isActive('/contract_notifications'))
&& (['ikonotv', 'cyland']).indexOf(subdomain) > -1) {
- header = (
-
);
+ header = (
);
} else {
- header =
;
+ 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}
-
+ {children}
diff --git a/js/components/whitelabel/wallet/wallet_routes.js b/js/components/whitelabel/wallet/wallet_routes.js
index 44bad476..8e4d5197 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 Router from 'react-router';
+import { Route, IndexRoute } from 'react-router';
// general components
import CoaVerifyContainer from '../../../components/coa_verify_container';
@@ -23,74 +23,130 @@ 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/ikonotv_detail/ikonotv_piece_container';
import IkonotvContractNotifications from './components/ikonotv/ikonotv_contract_notifications';
import CCRegisterPiece from './components/cc/cc_register_piece';
-import WalletApp from './wallet_app';
-import AppConstants from '../../../constants/application_constants';
+import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
-let Route = Router.Route;
-let NotFoundRoute = Router.NotFoundRoute;
-let Redirect = Router.Redirect;
-let baseUrl = AppConstants.baseUrl;
+import WalletApp from './wallet_app';
let ROUTES = {
'cyland': (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
),
'cc': (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
),
'ikonotv': (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
};
@@ -105,4 +161,4 @@ function getRoutes(commonRoutes, subdomain) {
}
-export default getRoutes;
\ No newline at end of file
+export default getRoutes;
diff --git a/js/history.js b/js/history.js
new file mode 100644
index 00000000..903f2b73
--- /dev/null
+++ b/js/history.js
@@ -0,0 +1,13 @@
+'use strict';
+
+import useBasename from 'history/lib/useBasename';
+import createBrowserHistory from 'history/lib/createBrowserHistory';
+import AppConstants from './constants/application_constants';
+
+
+// Remove the trailing slash if present
+let baseUrl = AppConstants.baseUrl.replace(/\/$/, '');
+
+export default useBasename(createBrowserHistory)({
+ basename: baseUrl
+});
diff --git a/js/routes.js b/js/routes.js
index a8b024d4..116fb663 100644
--- a/js/routes.js
+++ b/js/routes.js
@@ -1,7 +1,7 @@
'use strict';
import React from 'react';
-import Router from 'react-router';
+import { Route } from 'react-router';
import getPrizeRoutes from './components/whitelabel/prize/prize_routes';
import getWalletRoutes from './components/whitelabel/wallet/wallet_routes';
@@ -25,30 +25,41 @@ import ErrorNotFoundPage from './components/error_not_found_page';
import RegisterPiece from './components/register_piece';
-import AppConstants from './constants/application_constants';
-
-let Route = Router.Route;
-let NotFoundRoute = Router.NotFoundRoute;
-let Redirect = Router.Redirect;
-let baseUrl = AppConstants.baseUrl;
+import AuthProxyHandler from './components/ascribe_routes/proxy_routes/auth_proxy_handler';
-const COMMON_ROUTES = (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+let COMMON_ROUTES = (
+
+
+
+
+
+
+
+
+
+
+
+
+
);
diff --git a/js/third_party/notifications.js b/js/third_party/notifications.js
index 90a613b8..85379479 100644
--- a/js/third_party/notifications.js
+++ b/js/third_party/notifications.js
@@ -1,6 +1,9 @@
'use strict';
+import history from '../history';
import { altThirdParty } from '../alt';
+
+
import EventActions from '../actions/event_actions';
import NotificationActions from '../actions/notification_actions';
@@ -9,7 +12,6 @@ import { getSubdomain } from '../utils/general_utils';
class NotificationsHandler {
-
constructor() {
this.bindActions(EventActions);
this.loaded = false;
@@ -19,6 +21,7 @@ class NotificationsHandler {
if (this.loaded) {
return;
}
+
let subdomain = getSubdomain();
if (subdomain === 'ikonotv') {
NotificationActions.fetchContractAgreementListNotifications().then(
@@ -26,7 +29,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');
}
}
);
diff --git a/js/utils/constants_utils.js b/js/utils/constants_utils.js
index 34786af5..8bf408d1 100644
--- a/js/utils/constants_utils.js
+++ b/js/utils/constants_utils.js
@@ -8,8 +8,8 @@ export function getSubdomainSettings(subdomain) {
if(settings.length === 1) {
return settings[0];
} else if(settings.length === 0) {
+ console.warn('There are no subdomain settings for the subdomain: ' + subdomain);
return appConstants.defaultDomain;
- // throw new Error('There are no subdomain settings for the subdomain: ' + subdomain);
} else {
throw new Error('Matched multiple subdomains. Adjust constants file.');
}
diff --git a/package.json b/package.json
index 0e41d714..f962e4a4 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",
@@ -64,6 +64,8 @@
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.4",
"harmonize": "^1.4.2",
+ "history": "^1.11.1",
+ "invariant": "^2.1.1",
"isomorphic-fetch": "^2.0.2",
"jest-cli": "^0.4.0",
"lodash": "^3.9.3",
@@ -72,11 +74,11 @@
"opn": "^3.0.2",
"q": "^1.4.1",
"raven-js": "^1.1.19",
- "react": "^0.13.2",
- "react-bootstrap": "^0.25.1",
+ "react": "0.13.2",
+ "react-bootstrap": "0.25.1",
"react-datepicker": "^0.12.0",
- "react-router": "^0.13.3",
- "react-router-bootstrap": "~0.16.0",
+ "react-router": "^1.0.0-rc1",
+ "react-router-bootstrap": "^0.19.0",
"react-star-rating": "~1.3.2",
"react-textarea-autosize": "^2.5.2",
"reactify": "^1.1.0",