mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
Merge remote-tracking branch 'remotes/origin/master' into AD-806-webapp-users-cannot-withdraw-a-pe
This commit is contained in:
commit
b773ac829a
10
js/app.js
10
js/app.js
@ -10,13 +10,15 @@ import fetch from 'isomorphic-fetch';
|
|||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
import ApiUrls from './constants/api_urls';
|
import ApiUrls from './constants/api_urls';
|
||||||
import { updateApiUrls } from './constants/api_urls';
|
|
||||||
import appConstants from './constants/application_constants';
|
import AppConstants from './constants/application_constants';
|
||||||
import getRoutes from './routes';
|
import getRoutes from './routes';
|
||||||
import requests from './utils/requests';
|
import requests from './utils/requests';
|
||||||
|
|
||||||
|
import { updateApiUrls } from './constants/api_urls';
|
||||||
import { getSubdomainSettings } from './utils/constants_utils';
|
import { getSubdomainSettings } from './utils/constants_utils';
|
||||||
import { initLogging } from './utils/error_utils';
|
import { initLogging } from './utils/error_utils';
|
||||||
|
import { getSubdomain } from './utils/general_utils';
|
||||||
|
|
||||||
import EventActions from './actions/event_actions';
|
import EventActions from './actions/event_actions';
|
||||||
|
|
||||||
@ -48,11 +50,11 @@ requests.defaults({
|
|||||||
class AppGateway {
|
class AppGateway {
|
||||||
start() {
|
start() {
|
||||||
let settings;
|
let settings;
|
||||||
let subdomain = window.location.host.split('.')[0];
|
let subdomain = getSubdomain();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
settings = getSubdomainSettings(subdomain);
|
settings = getSubdomainSettings(subdomain);
|
||||||
appConstants.whitelabel = settings;
|
AppConstants.whitelabel = settings;
|
||||||
updateApiUrls(settings.type, subdomain);
|
updateApiUrls(settings.type, subdomain);
|
||||||
this.load(settings);
|
this.load(settings);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
|
@ -102,7 +102,6 @@ let Edition = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
refreshCollection() {
|
refreshCollection() {
|
||||||
console.log('freshing');
|
|
||||||
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search,
|
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search,
|
||||||
this.state.orderBy, this.state.orderAsc, this.state.filterBy);
|
this.state.orderBy, this.state.orderAsc, this.state.filterBy);
|
||||||
EditionListActions.refreshEditionList({pieceId: this.props.edition.parent});
|
EditionListActions.refreshEditionList({pieceId: this.props.edition.parent});
|
||||||
|
25
js/components/error_not_found_page.js
Normal file
25
js/components/error_not_found_page.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { getLangText } from '../utils/lang_utils';
|
||||||
|
|
||||||
|
|
||||||
|
let ErrorNotFoundPage = React.createClass({
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-md-12">
|
||||||
|
<div className="error-wrapper">
|
||||||
|
<h1>404</h1>
|
||||||
|
<p>
|
||||||
|
{getLangText('Ups, the page you are looking for does not exist.')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default ErrorNotFoundPage;
|
@ -9,6 +9,9 @@ import GlobalNotification from '../../global_notification';
|
|||||||
|
|
||||||
import getRoutes from './prize_routes';
|
import getRoutes from './prize_routes';
|
||||||
|
|
||||||
|
import { getSubdomain } from '../../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let RouteHandler = Router.RouteHandler;
|
let RouteHandler = Router.RouteHandler;
|
||||||
|
|
||||||
let PrizeApp = React.createClass({
|
let PrizeApp = React.createClass({
|
||||||
@ -16,7 +19,7 @@ let PrizeApp = React.createClass({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
let header = null;
|
let header = null;
|
||||||
let subdomain = window.location.host.split('.')[0];
|
let subdomain = getSubdomain();
|
||||||
|
|
||||||
let ROUTES = getRoutes(null, subdomain);
|
let ROUTES = getRoutes(null, subdomain);
|
||||||
|
|
||||||
|
@ -14,11 +14,13 @@ import PrizePieceContainer from './components/ascribe_detail/prize_piece_contain
|
|||||||
import EditionContainer from '../../ascribe_detail/edition_container';
|
import EditionContainer from '../../ascribe_detail/edition_container';
|
||||||
import SettingsContainer from './components/prize_settings_container';
|
import SettingsContainer from './components/prize_settings_container';
|
||||||
import CoaVerifyContainer from '../../../components/coa_verify_container';
|
import CoaVerifyContainer from '../../../components/coa_verify_container';
|
||||||
|
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';
|
||||||
|
|
||||||
let Route = Router.Route;
|
let Route = Router.Route;
|
||||||
|
let NotFoundRoute = Router.NotFoundRoute;
|
||||||
let baseUrl = AppConstants.baseUrl;
|
let baseUrl = AppConstants.baseUrl;
|
||||||
|
|
||||||
|
|
||||||
@ -36,6 +38,7 @@ function getRoutes() {
|
|||||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||||
|
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ import GlobalNotification from '../../global_notification';
|
|||||||
import getRoutes from './wallet_routes';
|
import getRoutes from './wallet_routes';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import { getSubdomain } from '../../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let RouteHandler = Router.RouteHandler;
|
let RouteHandler = Router.RouteHandler;
|
||||||
|
|
||||||
@ -18,7 +20,7 @@ let WalletApp = React.createClass({
|
|||||||
mixins: [Router.State],
|
mixins: [Router.State],
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let subdomain = window.location.host.split('.')[0];
|
let subdomain = getSubdomain();
|
||||||
let ROUTES = getRoutes(null, subdomain);
|
let ROUTES = getRoutes(null, subdomain);
|
||||||
let activeRoutes = this.getRoutes().map(elem => 'route--' + elem.name);
|
let activeRoutes = this.getRoutes().map(elem => 'route--' + elem.name);
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import PieceContainer from '../../../components/ascribe_detail/piece_container';
|
|||||||
import EditionContainer from '../../../components/ascribe_detail/edition_container';
|
import EditionContainer from '../../../components/ascribe_detail/edition_container';
|
||||||
import SettingsContainer from '../../../components/ascribe_settings/settings_container';
|
import SettingsContainer from '../../../components/ascribe_settings/settings_container';
|
||||||
import ContractSettings from '../../../components/ascribe_settings/contract_settings';
|
import ContractSettings from '../../../components/ascribe_settings/contract_settings';
|
||||||
|
import ErrorNotFoundPage from '../../../components/error_not_found_page';
|
||||||
|
|
||||||
import CylandLanding from './components/cyland/cyland_landing';
|
import CylandLanding from './components/cyland/cyland_landing';
|
||||||
import CylandPieceContainer from './components/cyland/ascribe_detail/cyland_piece_container';
|
import CylandPieceContainer from './components/cyland/ascribe_detail/cyland_piece_container';
|
||||||
@ -33,6 +34,7 @@ import WalletApp from './wallet_app';
|
|||||||
import AppConstants from '../../../constants/application_constants';
|
import AppConstants from '../../../constants/application_constants';
|
||||||
|
|
||||||
let Route = Router.Route;
|
let Route = Router.Route;
|
||||||
|
let NotFoundRoute = Router.NotFoundRoute;
|
||||||
let Redirect = Router.Redirect;
|
let Redirect = Router.Redirect;
|
||||||
let baseUrl = AppConstants.baseUrl;
|
let baseUrl = AppConstants.baseUrl;
|
||||||
|
|
||||||
@ -52,6 +54,7 @@ let ROUTES = {
|
|||||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||||
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
||||||
|
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
),
|
),
|
||||||
'cc': (
|
'cc': (
|
||||||
@ -68,6 +71,7 @@ let ROUTES = {
|
|||||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||||
|
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
),
|
),
|
||||||
'ikonotv': (
|
'ikonotv': (
|
||||||
@ -86,6 +90,7 @@ let ROUTES = {
|
|||||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||||
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
||||||
<Route name="contract_notifications" path="contract_notifications" handler={IkonotvContractNotifications} />
|
<Route name="contract_notifications" path="contract_notifications" handler={IkonotvContractNotifications} />
|
||||||
|
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
import requests from '../utils/requests';
|
import requests from '../utils/requests';
|
||||||
|
|
||||||
|
import { getSubdomain } from '../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let LicenseFetcher = {
|
let LicenseFetcher = {
|
||||||
/**
|
/**
|
||||||
* Fetch the available licenses from the API (might be bound to the subdomain e.g. cc.ascribe.io).
|
* Fetch the available licenses from the API (might be bound to the subdomain e.g. cc.ascribe.io).
|
||||||
*/
|
*/
|
||||||
fetch() {
|
fetch() {
|
||||||
return requests.get('licenses', {'subdomain': window.location.host.split('.')[0]});
|
return requests.get('licenses', {'subdomain': getSubdomain()});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
import requests from '../utils/requests';
|
import requests from '../utils/requests';
|
||||||
|
|
||||||
|
import { getSubdomain } from '../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let WhitelabelFetcher = {
|
let WhitelabelFetcher = {
|
||||||
/**
|
/**
|
||||||
* Fetch the custom whitelabel data from the API.
|
* Fetch the custom whitelabel data from the API.
|
||||||
*/
|
*/
|
||||||
fetch() {
|
fetch() {
|
||||||
return requests.get('whitelabel_settings', {'subdomain': window.location.host.split('.')[0]});
|
return requests.get('whitelabel_settings', {'subdomain': getSubdomain()});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,11 +21,14 @@ import ContractSettings from './components/ascribe_settings/contract_settings';
|
|||||||
import SettingsContainer from './components/ascribe_settings/settings_container';
|
import SettingsContainer from './components/ascribe_settings/settings_container';
|
||||||
import CoaVerifyContainer from './components/coa_verify_container';
|
import CoaVerifyContainer from './components/coa_verify_container';
|
||||||
|
|
||||||
|
import ErrorNotFoundPage from './components/error_not_found_page';
|
||||||
|
|
||||||
import RegisterPiece from './components/register_piece';
|
import RegisterPiece from './components/register_piece';
|
||||||
|
|
||||||
import AppConstants from './constants/application_constants';
|
import AppConstants from './constants/application_constants';
|
||||||
|
|
||||||
let Route = Router.Route;
|
let Route = Router.Route;
|
||||||
|
let NotFoundRoute = Router.NotFoundRoute;
|
||||||
let Redirect = Router.Redirect;
|
let Redirect = Router.Redirect;
|
||||||
let baseUrl = AppConstants.baseUrl;
|
let baseUrl = AppConstants.baseUrl;
|
||||||
|
|
||||||
@ -45,6 +48,7 @@ const COMMON_ROUTES = (
|
|||||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||||
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
||||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||||
|
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||||
</Route>
|
</Route>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
4
js/third_party/intercom.js
vendored
4
js/third_party/intercom.js
vendored
@ -3,6 +3,8 @@
|
|||||||
import alt from '../alt';
|
import alt from '../alt';
|
||||||
import EventActions from '../actions/event_actions';
|
import EventActions from '../actions/event_actions';
|
||||||
|
|
||||||
|
import { getSubdomain } from '../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
class IntercomHandler {
|
class IntercomHandler {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -20,7 +22,7 @@ class IntercomHandler {
|
|||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
app_id: 'oboxh5w1',
|
app_id: 'oboxh5w1',
|
||||||
email: profile.email,
|
email: profile.email,
|
||||||
subdomain: window.location.host.split('.')[0],
|
subdomain: getSubdomain(),
|
||||||
widget: {
|
widget: {
|
||||||
activator: '#IntercomDefaultWidget'
|
activator: '#IntercomDefaultWidget'
|
||||||
}
|
}
|
||||||
|
6
js/third_party/notifications.js
vendored
6
js/third_party/notifications.js
vendored
@ -5,6 +5,8 @@ import EventActions from '../actions/event_actions';
|
|||||||
|
|
||||||
import NotificationActions from '../actions/notification_actions';
|
import NotificationActions from '../actions/notification_actions';
|
||||||
|
|
||||||
|
import { getSubdomain } from '../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
class NotificationsHandler {
|
class NotificationsHandler {
|
||||||
|
|
||||||
@ -13,11 +15,11 @@ class NotificationsHandler {
|
|||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onProfileDidLoad(profile) {
|
onProfileDidLoad() {
|
||||||
if (this.loaded) {
|
if (this.loaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let subdomain = window.location.host.split('.')[0];
|
let subdomain = getSubdomain();
|
||||||
if (subdomain === 'ikonotv') {
|
if (subdomain === 'ikonotv') {
|
||||||
NotificationActions.fetchContractAgreementListNotifications().then(
|
NotificationActions.fetchContractAgreementListNotifications().then(
|
||||||
(res) => {
|
(res) => {
|
||||||
|
@ -221,4 +221,15 @@ export function truncateTextAtCharIndex(text, charIndex, replacement = '...') {
|
|||||||
truncatedText += text.length > charIndex ? replacement : '';
|
truncatedText += text.length > charIndex ? replacement : '';
|
||||||
|
|
||||||
return truncatedText;
|
return truncatedText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts the user's subdomain from the browser's window.
|
||||||
|
* If no subdomain is found (for example on a naked domain), the default "www" is just assumed.
|
||||||
|
* @return {string} subdomain as a string
|
||||||
|
*/
|
||||||
|
export function getSubdomain() {
|
||||||
|
let { host } = window.location;
|
||||||
|
let tokens = host.split('.');
|
||||||
|
return tokens.length > 2 ? tokens[0] : 'www';
|
||||||
}
|
}
|
@ -480,3 +480,20 @@ hr {
|
|||||||
border-color: #ccc;
|
border-color: #ccc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
padding: 5% 20% 5% 20%;
|
||||||
|
|
||||||
|
> h1 {
|
||||||
|
font-size: 10em;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: .25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
> p {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user