aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-04-11 17:04:02 +0800
committerFabio Berger <me@fabioberger.com>2018-04-11 17:04:02 +0800
commit6d1a587c5c5666a54c29302db90dd4d9fc79059e (patch)
tree08db658038ef6de4d73beb0a51de93a8641887f7
parentbce97c2543d8f1f4fef3e65086d25ed37977b361 (diff)
downloaddexon-sol-tools-6d1a587c5c5666a54c29302db90dd4d9fc79059e.tar
dexon-sol-tools-6d1a587c5c5666a54c29302db90dd4d9fc79059e.tar.gz
dexon-sol-tools-6d1a587c5c5666a54c29302db90dd4d9fc79059e.tar.bz2
dexon-sol-tools-6d1a587c5c5666a54c29302db90dd4d9fc79059e.tar.lz
dexon-sol-tools-6d1a587c5c5666a54c29302db90dd4d9fc79059e.tar.xz
dexon-sol-tools-6d1a587c5c5666a54c29302db90dd4d9fc79059e.tar.zst
dexon-sol-tools-6d1a587c5c5666a54c29302db90dd4d9fc79059e.zip
Show staging docs on development and staging
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx8
-rw-r--r--packages/website/ts/utils/utils.ts8
2 files changed, 12 insertions, 4 deletions
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 8ec1a023d..aca20447b 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -8,14 +8,14 @@ import semverSort = require('semver-sort');
import { SidebarHeader } from 'ts/components/sidebar_header';
import { TopBar } from 'ts/components/top_bar/top_bar';
import { Dispatcher } from 'ts/redux/dispatcher';
-import { DocPackages, Environments } from 'ts/types';
+import { DocPackages } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import { docUtils } from 'ts/utils/doc_utils';
import { Translate } from 'ts/utils/translate';
import { utils } from 'ts/utils/utils';
-const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT;
+const isDevelopmentOrStaging = utils.isDevelopment() || utils.isStaging();
const DEFAULT_ICON = 'docs.png';
const ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH = '0.32.4';
@@ -106,7 +106,9 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> {
}
private async _fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> {
const folderName = docIdToSubpackageName[this.props.docsInfo.id];
- const docBucketRoot = isDevelopment ? constants.S3_STAGING_DOC_BUCKET_ROOT : constants.S3_DOC_BUCKET_ROOT;
+ const docBucketRoot = isDevelopmentOrStaging
+ ? constants.S3_STAGING_DOC_BUCKET_ROOT
+ : constants.S3_DOC_BUCKET_ROOT;
const versionToFilePath = await docUtils.getVersionToFilePathAsync(docBucketRoot, folderName);
const versions = _.keys(versionToFilePath);
this.props.dispatcher.updateAvailableDocVersions(versions);
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index afe159beb..53d60b3ce 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -5,7 +5,7 @@ import { BigNumber } from '@0xproject/utils';
import deepEqual = require('deep-equal');
import * as _ from 'lodash';
import * as moment from 'moment';
-import { Order, Providers, ScreenWidths, Side, SideToAssetToken, Token, TokenByAddress } from 'ts/types';
+import { Environments, Order, Providers, ScreenWidths, Side, SideToAssetToken, Token, TokenByAddress } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import * as u2f from 'ts/vendor/u2f_api';
@@ -292,4 +292,10 @@ export const utils = {
}
return parsedProviderName;
},
+ isDevelopment() {
+ return configs.ENVIRONMENT === Environments.DEVELOPMENT;
+ },
+ isStaging() {
+ return _.includes(window.location.href, configs.DOMAIN_STAGING);
+ },
};