mirror of
https://github.com/ascribe/onion.git
synced 2024-06-29 00:58:03 +02:00
Incorporate new RedirectProxyRoute into whitelabel pages
This commit is contained in:
parent
cee8d7cae7
commit
69afc6165a
|
@ -75,7 +75,8 @@ class AppGateway {
|
||||||
subdomain = settings.subdomain;
|
subdomain = settings.subdomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(subdomain) {
|
// www and cc do not have a landing page
|
||||||
|
if(subdomain && subdomain !== 'cc') {
|
||||||
redirectRoute = null;
|
redirectRoute = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,19 @@ let PrizeApp = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { history, routes } = this.props;
|
||||||
let header = null;
|
let header = null;
|
||||||
let subdomain = getSubdomain();
|
let subdomain = getSubdomain();
|
||||||
|
|
||||||
if (this.props.history.isActive('/') || this.props.history.isActive('/login') || this.props.history.isActive('/signup')) {
|
// 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')) {
|
||||||
header = <Hero />;
|
header = <Hero />;
|
||||||
} else {
|
} else {
|
||||||
header = <Header showAddWork={false} routes={this.props.routes}/>;
|
header = <Header showAddWork={false} routes={routes}/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Route } from 'react-router';
|
import { Route, IndexRoute } from 'react-router';
|
||||||
|
|
||||||
import Landing from './components/prize_landing';
|
import Landing from './components/prize_landing';
|
||||||
import LoginContainer from './components/prize_login_container';
|
import LoginContainer from './components/prize_login_container';
|
||||||
|
@ -19,22 +19,49 @@ import ErrorNotFoundPage from '../../../components/error_not_found_page';
|
||||||
import App from './prize_app';
|
import App from './prize_app';
|
||||||
import AppConstants from '../../../constants/application_constants';
|
import AppConstants from '../../../constants/application_constants';
|
||||||
|
|
||||||
|
import ProxyRoute from '../../../components/ascribe_routes/proxy_route';
|
||||||
|
import RedirectProxyHandler from '../../../components/ascribe_routes/proxy_routes/redirect_proxy_handler';
|
||||||
|
|
||||||
|
|
||||||
let baseUrl = AppConstants.baseUrl;
|
let baseUrl = AppConstants.baseUrl;
|
||||||
|
|
||||||
function getRoutes() {
|
function getRoutes() {
|
||||||
return (
|
return (
|
||||||
<Route path={baseUrl} component={App}>
|
<Route path={baseUrl} component={App}>
|
||||||
<Route path={baseUrl} component={Landing} />
|
<IndexRoute component={Landing} />
|
||||||
<Route path="login" component={LoginContainer} />
|
<ProxyRoute
|
||||||
<Route path="logout" component={LogoutContainer} />
|
path="login"
|
||||||
<Route path="signup" component={SignupContainer} />
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
<Route path="password_reset" component={PasswordResetContainer} />
|
component={LoginContainer} />
|
||||||
<Route path="register_piece" component={PrizeRegisterPiece} headerTitle="+ NEW WORK" />
|
<ProxyRoute
|
||||||
<Route path="collection" component={PrizePieceList} headerTitle="COLLECTION" />
|
path="logout"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/', when: 'loggedOut'})}
|
||||||
|
component={LogoutContainer}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="signup"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
|
component={SignupContainer} />
|
||||||
|
<ProxyRoute
|
||||||
|
path="password_reset"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
|
component={PasswordResetContainer} />
|
||||||
|
<ProxyRoute
|
||||||
|
path="settings"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={SettingsContainer}/>
|
||||||
|
|
||||||
|
<ProxyRoute
|
||||||
|
path="register_piece"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={PrizeRegisterPiece}
|
||||||
|
headerTitle="+ NEW WORK"/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="collection"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={PrizePieceList}
|
||||||
|
headerTitle="COLLECTION"/>
|
||||||
<Route path="pieces/:pieceId" component={PrizePieceContainer} />
|
<Route path="pieces/:pieceId" component={PrizePieceContainer} />
|
||||||
<Route path="editions/:editionId" component={EditionContainer} />
|
<Route path="editions/:editionId" component={EditionContainer} />
|
||||||
<Route path="settings" component={SettingsContainer} />
|
|
||||||
<Route path="verify" component={CoaVerifyContainer} />
|
<Route path="verify" component={CoaVerifyContainer} />
|
||||||
<Route path="*" component={ErrorNotFoundPage} />
|
<Route path="*" component={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
|
@ -22,20 +22,20 @@ let WalletApp = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let header = null;
|
||||||
let subdomain = getSubdomain();
|
let subdomain = getSubdomain();
|
||||||
|
const { history, routes, children } = this.props;
|
||||||
|
|
||||||
// The second element of routes is always the active component object, where we can
|
// The second element of routes is always the active component object, where we can
|
||||||
// extract the path.
|
// extract the path.
|
||||||
let [, { path } ] = this.props.routes;
|
let path = routes[1] ? routes[1].path : null;
|
||||||
|
|
||||||
let header = null;
|
|
||||||
|
|
||||||
// if the path of the current activeRoute is not defined, then this is the IndexRoute
|
// if the path of the current activeRoute is not defined, then this is the IndexRoute
|
||||||
if ((!path || this.props.history.isActive('/login') || this.props.history.isActive('/signup') || this.props.history.isActive('/contract_notifications'))
|
if ((!path || history.isActive('/login') || history.isActive('/signup') || history.isActive('/contract_notifications'))
|
||||||
&& (['ikonotv', 'cyland']).indexOf(subdomain) > -1) {
|
&& (['ikonotv', 'cyland']).indexOf(subdomain) > -1) {
|
||||||
header = (<div className="hero"/>);
|
header = (<div className="hero"/>);
|
||||||
} else {
|
} else {
|
||||||
header = <Header showAddWork={true} routes={this.props.routes} />;
|
header = <Header showAddWork={true} routes={routes} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In react-router 1.0, Routes have no 'name' property anymore. To keep functionality however,
|
// In react-router 1.0, Routes have no 'name' property anymore. To keep functionality however,
|
||||||
|
@ -44,7 +44,7 @@ let WalletApp = React.createClass({
|
||||||
<div className={classNames('ascribe-wallet-app', 'route--' + (path ? path.split('/')[0] : 'landing'))}>
|
<div className={classNames('ascribe-wallet-app', 'route--' + (path ? path.split('/')[0] : 'landing'))}>
|
||||||
<div className='container'>
|
<div className='container'>
|
||||||
{header}
|
{header}
|
||||||
{this.props.children}
|
{children}
|
||||||
<GlobalNotification />
|
<GlobalNotification />
|
||||||
<div id="modal" className="container"></div>
|
<div id="modal" className="container"></div>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|
|
@ -30,6 +30,9 @@ import IkonotvContractNotifications from './components/ikonotv/ikonotv_contract_
|
||||||
|
|
||||||
import CCRegisterPiece from './components/cc/cc_register_piece';
|
import CCRegisterPiece from './components/cc/cc_register_piece';
|
||||||
|
|
||||||
|
import ProxyRoute from '../../../components/ascribe_routes/proxy_route';
|
||||||
|
import RedirectProxyHandler from '../../../components/ascribe_routes/proxy_routes/redirect_proxy_handler';
|
||||||
|
|
||||||
import WalletApp from './wallet_app';
|
import WalletApp from './wallet_app';
|
||||||
import AppConstants from '../../../constants/application_constants';
|
import AppConstants from '../../../constants/application_constants';
|
||||||
|
|
||||||
|
@ -40,51 +43,139 @@ let ROUTES = {
|
||||||
'cyland': (
|
'cyland': (
|
||||||
<Route path={baseUrl} component={WalletApp}>
|
<Route path={baseUrl} component={WalletApp}>
|
||||||
<IndexRoute component={CylandLanding} />
|
<IndexRoute component={CylandLanding} />
|
||||||
<Route path="login" component={LoginContainer} />
|
<ProxyRoute
|
||||||
<Route path="logout" component={LogoutContainer} />
|
path="login"
|
||||||
<Route path="signup" component={SignupContainer} />
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
<Route path="password_reset" component={PasswordResetContainer} />
|
component={LoginContainer} />
|
||||||
<Route path="register_piece" component={CylandRegisterPiece} headerTitle="+ NEW WORK" />
|
<ProxyRoute
|
||||||
<Route path="collection" component={CylandPieceList} headerTitle="COLLECTION" />
|
path="logout"
|
||||||
<Route path="pieces/:pieceId" component={CylandPieceContainer} />
|
proxyHandler={RedirectProxyHandler({to: '/', when: 'loggedOut'})}
|
||||||
|
component={LogoutContainer}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="signup"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
|
component={SignupContainer} />
|
||||||
|
<ProxyRoute
|
||||||
|
path="password_reset"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
|
component={PasswordResetContainer} />
|
||||||
|
<ProxyRoute
|
||||||
|
path="settings"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={SettingsContainer}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="contract_settings"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={ContractSettings}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="register_piece"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={CylandRegisterPiece}
|
||||||
|
headerTitle="+ NEW WORK"/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="collection"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={CylandPieceList}
|
||||||
|
headerTitle="COLLECTION"/>
|
||||||
<Route path="editions/:editionId" component={EditionContainer} />
|
<Route path="editions/:editionId" component={EditionContainer} />
|
||||||
<Route path="verify" component={CoaVerifyContainer} />
|
<Route path="verify" component={CoaVerifyContainer} />
|
||||||
<Route path="settings" component={SettingsContainer} />
|
<Route path="pieces/:pieceId" component={CylandPieceContainer} />
|
||||||
<Route path="contract_settings" component={ContractSettings} />
|
|
||||||
<Route path="*" component={ErrorNotFoundPage} />
|
<Route path="*" component={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
),
|
),
|
||||||
'cc': (
|
'cc': (
|
||||||
<Route path={baseUrl} component={WalletApp}>
|
<Route path={baseUrl} component={WalletApp}>
|
||||||
<Route path="login" component={LoginContainer} />
|
<ProxyRoute
|
||||||
<Route path="logout" component={LogoutContainer} />
|
path="login"
|
||||||
<Route path="signup" component={SignupContainer} />
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
<Route path="password_reset" component={PasswordResetContainer} />
|
component={LoginContainer} />
|
||||||
<Route path="register_piece" component={CCRegisterPiece} headerTitle="+ NEW WORK" />
|
<ProxyRoute
|
||||||
<Route path="collection" component={PieceList} headerTitle="COLLECTION" />
|
path="logout"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/', when: 'loggedOut'})}
|
||||||
|
component={LogoutContainer}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="signup"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
|
component={SignupContainer} />
|
||||||
|
<ProxyRoute
|
||||||
|
path="password_reset"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
|
component={PasswordResetContainer} />
|
||||||
|
<ProxyRoute
|
||||||
|
path="settings"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={SettingsContainer}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="contract_settings"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={ContractSettings}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="register_piece"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={CCRegisterPiece}
|
||||||
|
headerTitle="+ NEW WORK"/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="collection"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={PieceList}
|
||||||
|
headerTitle="COLLECTION"/>
|
||||||
<Route path="pieces/:pieceId" component={PieceContainer} />
|
<Route path="pieces/:pieceId" component={PieceContainer} />
|
||||||
<Route path="editions/:editionId" component={EditionContainer} />
|
<Route path="editions/:editionId" component={EditionContainer} />
|
||||||
<Route path="verify" component={CoaVerifyContainer} />
|
<Route path="verify" component={CoaVerifyContainer} />
|
||||||
<Route path="settings" component={SettingsContainer} />
|
|
||||||
<Route path="*" component={ErrorNotFoundPage} />
|
<Route path="*" component={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
),
|
),
|
||||||
'ikonotv': (
|
'ikonotv': (
|
||||||
<Route path={baseUrl} component={WalletApp}>
|
<Route path={baseUrl} component={WalletApp}>
|
||||||
<IndexRoute component={IkonotvLanding} />
|
<IndexRoute component={IkonotvLanding} />
|
||||||
<Route path="login" component={LoginContainer} />
|
<ProxyRoute
|
||||||
<Route path="logout" component={LogoutContainer} />
|
path="login"
|
||||||
<Route path="signup" component={SignupContainer} />
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
<Route path="password_reset" component={PasswordResetContainer} />
|
component={LoginContainer} />
|
||||||
<Route path="request_loan" component={ContractAgreementForm} headerTitle="SEND NEW CONTRACT" aclName="acl_create_contractagreement" />
|
<ProxyRoute
|
||||||
<Route path="register_piece" component={IkonotvRegisterPiece} headerTitle="+ NEW WORK" aclName="acl_create_piece"/>
|
path="logout"
|
||||||
<Route path="collection" component={IkonotvPieceList} headerTitle="COLLECTION"/>
|
proxyHandler={RedirectProxyHandler({to: '/', when: 'loggedOut'})}
|
||||||
|
component={LogoutContainer}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="signup"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
|
component={SignupContainer} />
|
||||||
|
<ProxyRoute
|
||||||
|
path="password_reset"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||||
|
component={PasswordResetContainer} />
|
||||||
|
<ProxyRoute
|
||||||
|
path="settings"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={SettingsContainer}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="contract_settings"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={ContractSettings}/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="request_loan"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={ContractAgreementForm}
|
||||||
|
headerTitle="SEND NEW CONTRACT"
|
||||||
|
aclName="acl_create_contractagreement"/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="register_piece"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={IkonotvRegisterPiece}
|
||||||
|
headerTitle="+ NEW WORK"
|
||||||
|
aclName="acl_create_piece"/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="collection"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={IkonotvPieceList}
|
||||||
|
headerTitle="COLLECTION"/>
|
||||||
|
<ProxyRoute
|
||||||
|
path="contract_notifications"
|
||||||
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||||
|
component={IkonotvContractNotifications}/>
|
||||||
<Route path="pieces/:pieceId" component={IkonotvPieceContainer} />
|
<Route path="pieces/:pieceId" component={IkonotvPieceContainer} />
|
||||||
<Route path="editions/:editionId" component={EditionContainer} />
|
<Route path="editions/:editionId" component={EditionContainer} />
|
||||||
<Route path="verify" component={CoaVerifyContainer} />
|
<Route path="verify" component={CoaVerifyContainer} />
|
||||||
<Route path="settings" component={SettingsContainer} />
|
|
||||||
<Route path="contract_settings" component={ContractSettings} />
|
|
||||||
<Route path="contract_notifications" component={IkonotvContractNotifications} />
|
|
||||||
<Route path="*" component={ErrorNotFoundPage} />
|
<Route path="*" component={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user