aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-02-27 01:52:08 +0800
committerFabio Berger <me@fabioberger.com>2018-02-27 01:52:08 +0800
commitdd116b3cd62b59772326936356bce2d08fb41439 (patch)
tree61f8d5902d9863f489e40712802196ad27ada033
parent7dd9ce2e3280b8e4e911cf797267db4619dbcae3 (diff)
downloaddexon-sol-tools-dd116b3cd62b59772326936356bce2d08fb41439.tar.gz
dexon-sol-tools-dd116b3cd62b59772326936356bce2d08fb41439.tar.zst
dexon-sol-tools-dd116b3cd62b59772326936356bce2d08fb41439.zip
remove docsJsonRoot from docsInfo
-rw-r--r--packages/website/ts/containers/connect_documentation.tsx5
-rw-r--r--packages/website/ts/containers/smart_contracts_documentation.tsx1
-rw-r--r--packages/website/ts/containers/zero_ex_js_documentation.tsx4
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx13
-rw-r--r--packages/website/ts/pages/documentation/docs_info.ts2
-rw-r--r--packages/website/ts/types.ts1
-rw-r--r--packages/website/ts/utils/constants.ts1
7 files changed, 13 insertions, 14 deletions
diff --git a/packages/website/ts/containers/connect_documentation.tsx b/packages/website/ts/containers/connect_documentation.tsx
index d11bab924..0add2add6 100644
--- a/packages/website/ts/containers/connect_documentation.tsx
+++ b/packages/website/ts/containers/connect_documentation.tsx
@@ -25,16 +25,11 @@ const connectDocSections = {
types: constants.TYPES_SECTION_NAME,
};
-const s3BucketName =
- configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-connect-docs-jsons' : 'connect-docs-jsons';
-const docsJsonRoot = `https://s3.amazonaws.com/${s3BucketName}`;
-
const docsInfoConfig: DocsInfoConfig = {
displayName: '0x Connect',
subPackageName: 'connect',
packageUrl: 'https://github.com/0xProject/0x.js',
websitePath: WebsitePaths.Connect,
- docsJsonRoot,
menu: {
introduction: [connectDocSections.introduction],
install: [connectDocSections.installation],
diff --git a/packages/website/ts/containers/smart_contracts_documentation.tsx b/packages/website/ts/containers/smart_contracts_documentation.tsx
index caf57f1c2..b56ce9949 100644
--- a/packages/website/ts/containers/smart_contracts_documentation.tsx
+++ b/packages/website/ts/containers/smart_contracts_documentation.tsx
@@ -18,7 +18,6 @@ const docsInfoConfig: DocsInfoConfig = {
displayName: '0x Smart Contracts',
packageUrl: 'https://github.com/0xProject/contracts',
websitePath: WebsitePaths.SmartContracts,
- docsJsonRoot: 'https://s3.amazonaws.com/smart-contracts-docs-json',
menu: {
introduction: [Sections.Introduction],
contracts: [Sections.Exchange, Sections.TokenRegistry, Sections.ZRXToken, Sections.TokenTransferProxy],
diff --git a/packages/website/ts/containers/zero_ex_js_documentation.tsx b/packages/website/ts/containers/zero_ex_js_documentation.tsx
index 67089d9e3..b960d0ea1 100644
--- a/packages/website/ts/containers/zero_ex_js_documentation.tsx
+++ b/packages/website/ts/containers/zero_ex_js_documentation.tsx
@@ -37,15 +37,11 @@ const zeroExJsDocSections = {
types: constants.TYPES_SECTION_NAME,
};
-const s3BucketName = configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-0xjs-docs-jsons' : '0xjs-docs-jsons';
-const docsJsonRoot = `https://s3.amazonaws.com/${s3BucketName}`;
-
const docsInfoConfig: DocsInfoConfig = {
displayName: '0x.js',
packageUrl: 'https://github.com/0xProject/0x.js',
subPackageName: '0x.js',
websitePath: WebsitePaths.ZeroExJs,
- docsJsonRoot,
menu: {
introduction: [zeroExJsDocSections.introduction],
install: [zeroExJsDocSections.installation],
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 2b77bb2be..ff22a7236 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -7,10 +7,19 @@ import { TopBar } from 'ts/components/top_bar/top_bar';
import { DocsInfo } from 'ts/pages/documentation/docs_info';
import { Documentation } from 'ts/pages/documentation/documentation';
import { Dispatcher } from 'ts/redux/dispatcher';
-import { DocAgnosticFormat, DoxityDocObj, MenuSubsectionsBySection } from 'ts/types';
+import { DocAgnosticFormat, DoxityDocObj, Environments, MenuSubsectionsBySection } 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';
+const displayNameToS3BucketName: { [displayName: string]: string } = {
+ '0x.js': configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-0xjs-docs-jsons' : '0xjs-docs-jsons',
+ '0x Smart Contracts': 'smart-contracts-docs-json',
+ '0x Connect':
+ configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-connect-docs-jsons' : 'connect-docs-jsons',
+};
+
export interface DocPageProps {
location: Location;
dispatcher: Dispatcher;
@@ -74,6 +83,8 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> {
);
}
private async _fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> {
+ const s3BucketName = displayNameToS3BucketName[this.props.docsInfo.displayName];
+ const docsJsonRoot = `${constants.S3_BUCKET_ROOT}/${s3BucketName}`;
const versionToFileName = await docUtils.getVersionToFileNameAsync(this.props.docsInfo.docsJsonRoot);
const versions = _.keys(versionToFileName);
this.props.dispatcher.updateAvailableDocVersions(versions);
diff --git a/packages/website/ts/pages/documentation/docs_info.ts b/packages/website/ts/pages/documentation/docs_info.ts
index 4b1ec122a..f90b39e1f 100644
--- a/packages/website/ts/pages/documentation/docs_info.ts
+++ b/packages/website/ts/pages/documentation/docs_info.ts
@@ -15,7 +15,6 @@ export class DocsInfo {
public packageUrl: string;
public subPackageName?: string;
public websitePath: string;
- public docsJsonRoot: string;
public menu: DocsMenu;
public sections: SectionsMap;
public sectionNameToMarkdown: { [sectionName: string]: string };
@@ -25,7 +24,6 @@ export class DocsInfo {
this.packageUrl = config.packageUrl;
this.subPackageName = config.subPackageName;
this.websitePath = config.websitePath;
- this.docsJsonRoot = config.docsJsonRoot;
this.sections = config.sections;
this.sectionNameToMarkdown = config.sectionNameToMarkdown;
this._docsInfo = config;
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index f6413eec5..18b18cde4 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -631,7 +631,6 @@ export interface DocsInfoConfig {
displayName: string;
packageUrl: string;
websitePath: string;
- docsJsonRoot: string;
menu: DocsMenu;
sections: SectionsMap;
sectionNameToMarkdown: { [sectionName: string]: string };
diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts
index 6af821dbe..3476b7375 100644
--- a/packages/website/ts/utils/constants.ts
+++ b/packages/website/ts/utils/constants.ts
@@ -42,6 +42,7 @@ export const constants = {
PROVIDER_NAME_GENERIC: 'Injected Web3',
PROVIDER_NAME_PUBLIC: '0x Public',
ROLLBAR_ACCESS_TOKEN: 'a6619002b51c4464928201e6ea94de65',
+ S3_BUCKET_ROOT: 'https://s3.amazonaws.com',
SUCCESS_STATUS: 200,
UNAVAILABLE_STATUS: 503,
TAKER_FEE: new BigNumber(0),