From dd116b3cd62b59772326936356bce2d08fb41439 Mon Sep 17 00:00:00 2001
From: Fabio Berger <me@fabioberger.com>
Date: Mon, 26 Feb 2018 09:52:08 -0800
Subject: remove docsJsonRoot from docsInfo

---
 packages/website/ts/pages/documentation/doc_page.tsx | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'packages/website/ts/pages/documentation/doc_page.tsx')

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);
-- 
cgit v1.2.3

