1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00
onion/js/routes.js
vrde 729d27559d WIP: Refactoring forms
Conflicts:
	js/components/ascribe_forms/form.js
	js/components/ascribe_forms/form_contract_agreement.js
	js/components/settings_container.js
2015-09-16 22:04:19 +02:00

81 lines
2.9 KiB
JavaScript

'use strict';
import React from 'react';
import Router from 'react-router';
import getPrizeRoutes from './components/whitelabel/prize/prize_routes';
import getWalletRoutes from './components/whitelabel/wallet/wallet_routes';
import App from './components/ascribe_app';
import PieceList from './components/piece_list';
import PieceContainer from './components/ascribe_detail/piece_container';
import EditionContainer from './components/ascribe_detail/edition_container';
import LoginContainer from './components/login_container';
import LogoutContainer from './components/logout_container';
import SignupContainer from './components/signup_container';
import PasswordResetContainer from './components/password_reset_container';
import SettingsContainer from './components/ascribe_settings/settings_container';
import CoaVerifyContainer from './components/coa_verify_container';
import RegisterPiece from './components/register_piece';
import ContractNotification from './components/contract_notification';
import AppConstants from './constants/application_constants';
let Route = Router.Route;
let Redirect = Router.Redirect;
let baseUrl = AppConstants.baseUrl;
function getDebugRoutes() {
let StyleGuideContainer = require('./styleguide/container.js');
if (window.DEBUG) {
return (
<Route name="styleguide" path="styleguide" handler={StyleGuideContainer} headerTitle="Style Guide" />
);
} else {
return null;
}
}
const COMMON_ROUTES = (
<Route name="app" path={baseUrl} handler={App}>
<Redirect from={baseUrl} to="login" />
<Redirect from={baseUrl + '/'} to="login" />
<Route name="signup" path="signup" handler={SignupContainer} />
<Route name="login" path="login" handler={LoginContainer} />
<Route name="logout" path="logout" handler={LogoutContainer} />
<Route name="register_piece" path="register_piece" handler={RegisterPiece} headerTitle="+ NEW WORK" />
<Route name="pieces" path="collection" handler={PieceList} headerTitle="COLLECTION" />
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
<Route name="settings" path="settings" handler={SettingsContainer} />
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
<Route name="contract_notifications" path="verify" handler={ContractNotification} />
{getDebugRoutes()}
</Route>
);
function getRoutes(type, subdomain) {
let routes = null;
if (type === 'prize') {
routes = getPrizeRoutes(COMMON_ROUTES, subdomain);
} else if(type === 'wallet') {
routes = getWalletRoutes(COMMON_ROUTES, subdomain);
} else {
routes = COMMON_ROUTES;
}
return routes;
}
export default getRoutes;