2015-08-11 13:10:15 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import Router from 'react-router';
|
|
|
|
|
2015-08-12 09:30:24 +02:00
|
|
|
// general components
|
2015-08-11 14:47:28 +02:00
|
|
|
import LoginContainer from '../../../components/login_container';
|
2015-08-11 13:10:15 +02:00
|
|
|
import LogoutContainer from '../../../components/logout_container';
|
2015-08-11 14:47:28 +02:00
|
|
|
import SignupContainer from '../../../components/signup_container';
|
2015-08-11 13:10:15 +02:00
|
|
|
import PasswordResetContainer from '../../../components/password_reset_container';
|
2015-08-11 14:47:28 +02:00
|
|
|
import PieceList from '../../../components/piece_list';
|
|
|
|
import PieceContainer from '../../../components/ascribe_detail/piece_container';
|
|
|
|
import EditionContainer from '../../../components/ascribe_detail/edition_container';
|
2015-08-31 16:36:24 +02:00
|
|
|
import SettingsContainer from '../../../components/ascribe_settings/settings_container';
|
2015-08-27 14:47:33 +02:00
|
|
|
import RegisterPiece from '../../../components/register_piece';
|
2015-08-11 13:10:15 +02:00
|
|
|
|
2015-08-19 09:31:36 +02:00
|
|
|
import CylandLanding from './components/cyland/cyland_landing';
|
2015-08-17 20:52:36 +02:00
|
|
|
import CylandPieceContainer from './components/cyland/ascribe_detail/cyland_piece_container';
|
2015-08-12 09:30:24 +02:00
|
|
|
import CylandRegisterPiece from './components/cyland/cyland_register_piece';
|
2015-08-17 20:52:36 +02:00
|
|
|
import CylandPieceList from './components/cyland/cyland_piece_list';
|
|
|
|
|
2015-08-18 12:36:38 +02:00
|
|
|
import IkonotvPieceList from './components/ikonotv/ikonotv_piece_list';
|
2015-08-25 16:33:26 +02:00
|
|
|
import IkonotvRequestLoan from './components/ikonotv/ikonotv_request_loan';
|
2015-08-28 12:33:00 +02:00
|
|
|
import IkonotvPieceContainer from './components/ikonotv/ascribe_detail/ikonotv_piece_container';
|
2015-09-04 11:49:55 +02:00
|
|
|
import IkonotvContractNotifications from './components/ikonotv/ikonotv_contract_notifications';
|
2015-08-18 12:36:38 +02:00
|
|
|
|
2015-08-12 09:30:24 +02:00
|
|
|
import CCRegisterPiece from './components/cc/cc_register_piece';
|
2015-08-11 17:40:26 +02:00
|
|
|
|
2015-08-11 14:47:28 +02:00
|
|
|
import WalletApp from './wallet_app';
|
2015-08-11 13:10:15 +02:00
|
|
|
import AppConstants from '../../../constants/application_constants';
|
|
|
|
|
|
|
|
let Route = Router.Route;
|
2015-08-11 17:40:26 +02:00
|
|
|
let Redirect = Router.Redirect;
|
2015-08-11 13:10:15 +02:00
|
|
|
let baseUrl = AppConstants.baseUrl;
|
|
|
|
|
|
|
|
|
2015-08-11 17:40:26 +02:00
|
|
|
let ROUTES = {
|
|
|
|
'cyland': (
|
2015-08-11 14:47:28 +02:00
|
|
|
<Route name="app" path={baseUrl} handler={WalletApp}>
|
2015-08-19 09:31:36 +02:00
|
|
|
<Route name="landing" path={baseUrl} handler={CylandLanding} />
|
2015-08-11 13:10:15 +02:00
|
|
|
<Route name="login" path="login" handler={LoginContainer} />
|
|
|
|
<Route name="logout" path="logout" handler={LogoutContainer} />
|
|
|
|
<Route name="signup" path="signup" handler={SignupContainer} />
|
|
|
|
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
2015-08-27 14:34:15 +02:00
|
|
|
<Route name="register_piece" path="register_piece" handler={CylandRegisterPiece} headerTitle="+ NEW WORK" />
|
|
|
|
<Route name="pieces" path="collection" handler={CylandPieceList} headerTitle="COLLECTION" />
|
2015-08-17 20:52:36 +02:00
|
|
|
<Route name="piece" path="pieces/:pieceId" handler={CylandPieceContainer} />
|
2015-08-11 13:10:15 +02:00
|
|
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
|
|
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
|
|
|
</Route>
|
2015-08-11 17:40:26 +02:00
|
|
|
),
|
|
|
|
'cc': (
|
|
|
|
<Route name="app" path={baseUrl} handler={WalletApp}>
|
|
|
|
<Redirect from={baseUrl} to="login" />
|
|
|
|
<Redirect from={baseUrl + '/'} to="login" />
|
|
|
|
<Route name="login" path="login" handler={LoginContainer} />
|
|
|
|
<Route name="logout" path="logout" handler={LogoutContainer} />
|
|
|
|
<Route name="signup" path="signup" handler={SignupContainer} />
|
|
|
|
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
2015-08-27 14:34:15 +02:00
|
|
|
<Route name="register_piece" path="register_piece" handler={CCRegisterPiece} headerTitle="+ NEW WORK" />
|
|
|
|
<Route name="pieces" path="collection" handler={PieceList} headerTitle="COLLECTION" />
|
2015-08-11 17:40:26 +02:00
|
|
|
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
|
|
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
|
|
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
|
|
|
</Route>
|
2015-08-18 12:08:01 +02:00
|
|
|
),
|
|
|
|
'ikonotv': (
|
|
|
|
<Route name="app" path={baseUrl} handler={WalletApp}>
|
2015-08-28 12:11:29 +02:00
|
|
|
<Redirect from={baseUrl} to="login" />
|
|
|
|
<Redirect from={baseUrl + '/'} to="login" />
|
2015-08-18 12:08:01 +02:00
|
|
|
<Route name="login" path="login" handler={LoginContainer} />
|
|
|
|
<Route name="logout" path="logout" handler={LogoutContainer} />
|
|
|
|
<Route name="signup" path="signup" handler={SignupContainer} />
|
|
|
|
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
2015-09-08 14:20:06 +02:00
|
|
|
<Route name="request_loan" path="request_loan" handler={IkonotvRequestLoan} headerTitle="SEND NEW CONTRACT" aclName="acl_create_contract" />
|
2015-08-27 14:47:33 +02:00
|
|
|
<Route name="register_piece" path="register_piece" handler={RegisterPiece} headerTitle="+ NEW WORK"/>
|
2015-08-27 14:34:15 +02:00
|
|
|
<Route name="pieces" path="collection" handler={IkonotvPieceList} headerTitle="COLLECTION"/>
|
2015-08-28 12:33:00 +02:00
|
|
|
<Route name="piece" path="pieces/:pieceId" handler={IkonotvPieceContainer} />
|
2015-08-18 12:08:01 +02:00
|
|
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
|
|
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
2015-09-07 12:03:59 +02:00
|
|
|
<Route name="contract_notifications" path="contract_notifications" handler={IkonotvContractNotifications} />
|
2015-08-18 12:08:01 +02:00
|
|
|
</Route>
|
2015-08-11 17:40:26 +02:00
|
|
|
)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function getRoutes(commonRoutes, subdomain) {
|
|
|
|
if(subdomain in ROUTES) {
|
|
|
|
return ROUTES[subdomain];
|
|
|
|
} else {
|
|
|
|
throw new Error('Subdomain wasn\'t specified in the wallet app.');
|
|
|
|
}
|
2015-08-11 13:10:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default getRoutes;
|