diff options
author | Fabio Berger <me@fabioberger.com> | 2018-04-12 07:56:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-12 07:56:33 +0800 |
commit | 5eb90697c824f1c98467cdb6cd71dbb94ff70805 (patch) | |
tree | b5e02ec65e8ae5298761f07eae18df145024bb16 /packages/website/ts | |
parent | c47fb8f9a83d409c092dd7449054fa16cf0fa1c9 (diff) | |
parent | faedd2fa0b2582ea24ca4624e13ea7466de18408 (diff) | |
download | dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.gz dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.bz2 dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.lz dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.xz dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.zst dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.zip |
Merge pull request #519 from 0xProject/fix/docImprovements
Doc fixes and improvements
Diffstat (limited to 'packages/website/ts')
-rw-r--r-- | packages/website/ts/components/top_bar/top_bar.tsx | 12 | ||||
-rw-r--r-- | packages/website/ts/containers/sol_cov_documentation.ts | 8 | ||||
-rw-r--r-- | packages/website/ts/containers/subproviders_documentation.ts | 12 | ||||
-rw-r--r-- | packages/website/ts/containers/web3_wrapper_documentation.ts | 29 | ||||
-rw-r--r-- | packages/website/ts/containers/zero_ex_js_documentation.ts | 18 | ||||
-rw-r--r-- | packages/website/ts/index.tsx | 13 | ||||
-rw-r--r-- | packages/website/ts/pages/documentation/doc_page.tsx | 8 | ||||
-rw-r--r-- | packages/website/ts/types.ts | 9 | ||||
-rw-r--r-- | packages/website/ts/utils/utils.ts | 8 |
9 files changed, 78 insertions, 39 deletions
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 4b2e82119..13351dcdc 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -15,7 +15,7 @@ import { TopBarMenuItem } from 'ts/components/top_bar/top_bar_menu_item'; import { DropDown } from 'ts/components/ui/drop_down'; import { Identicon } from 'ts/components/ui/identicon'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { Deco, Key, ProviderType, WebsitePaths } from 'ts/types'; +import { Deco, Key, ProviderType, WebsiteLegacyPaths, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; @@ -462,7 +462,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { return _.includes(this.props.location.pathname, WebsitePaths.FAQ); } private _isViewing0xjsDocs() { - return _.includes(this.props.location.pathname, WebsitePaths.ZeroExJs); + return ( + _.includes(this.props.location.pathname, WebsitePaths.ZeroExJs) || + _.includes(this.props.location.pathname, WebsiteLegacyPaths.ZeroExJs) + ); } private _isViewingConnectDocs() { return _.includes(this.props.location.pathname, WebsitePaths.Connect); @@ -471,7 +474,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { return _.includes(this.props.location.pathname, WebsitePaths.SmartContracts); } private _isViewingWeb3WrapperDocs() { - return _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper); + return ( + _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper) || + _.includes(this.props.location.pathname, WebsiteLegacyPaths.Web3Wrapper) + ); } private _isViewingDeployerDocs() { return _.includes(this.props.location.pathname, WebsitePaths.Deployer); diff --git a/packages/website/ts/containers/sol_cov_documentation.ts b/packages/website/ts/containers/sol_cov_documentation.ts index 2b901ec6f..58755c1e0 100644 --- a/packages/website/ts/containers/sol_cov_documentation.ts +++ b/packages/website/ts/containers/sol_cov_documentation.ts @@ -44,7 +44,7 @@ const docsInfoConfig: DocsInfoConfig = { }, sectionNameToModulePath: { [docSections.coverageSubprovider]: ['"sol-cov/src/coverage_subprovider"'], - [docSections.types]: ['"subproviders/src/types"'], + [docSections.types]: ['"subproviders/src/types"', '"types/src/index"'], }, menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, @@ -52,11 +52,9 @@ const docsInfoConfig: DocsInfoConfig = { typeConfigs: { // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is // currently no way to extract the re-exported types from index.ts via TypeDoc :( - publicTypes: ['NextCallback', 'OnNextCompleted', 'ErrorCallback'], + publicTypes: ['NextCallback', 'OnNextCompleted', 'ErrorCallback', 'JSONRPCRequestPayload'], typeNameToExternalLink: {}, - typeNameToPrefix: { - JSONRPCRequestPayload: 'Web3', - }, + typeNameToPrefix: {}, typeNameToDocSection: {}, }, }; diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts index 7aa05f9a5..4a956acea 100644 --- a/packages/website/ts/containers/subproviders_documentation.ts +++ b/packages/website/ts/containers/subproviders_documentation.ts @@ -91,25 +91,21 @@ const docsInfoConfig: DocsInfoConfig = { 'ErrorCallback', 'ECSignature', 'JSONRPCRequestPayloadWithMethod', + 'JSONRPCRequestPayload', 'JSONRPCResponsePayload', 'AccountFetchingConfigs', 'LedgerEthereumClientFactoryAsync', 'PartialTxParams', 'LedgerEthereumClient', 'LedgerSubproviderConfigs', + 'OnNextCompleted', + 'Provider', ], typeNameToExternalLink: { Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API', BigNumber: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L127', - JSONRPCRequestPayload: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L137', - JSONRPCResponsePayload: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L144', - Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150', - }, - typeNameToPrefix: { - JSONRPCRequestPayload: 'Web3', - JSONRPCResponsePayload: 'Web3', - Provider: 'Web3', }, + typeNameToPrefix: {}, }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts index b0adad536..9c0ca9b9a 100644 --- a/packages/website/ts/containers/web3_wrapper_documentation.ts +++ b/packages/website/ts/containers/web3_wrapper_documentation.ts @@ -59,15 +59,36 @@ const docsInfoConfig: DocsInfoConfig = { 'BlockWithoutTransactionData', 'CallData', 'LogEntryEvent', + 'Provider', + 'AbiDefinition', + 'LogTopic', + 'JSONRPCRequestPayload', + 'JSONRPCResponsePayload', + 'BlockParamLiteral', + 'FunctionAbi', + 'EventAbi', + 'JSONRPCErrorCallback', + 'MethodAbi', + 'ConstructorAbi', + 'FallbackAbi', + 'EventParameter', + 'DataItem', + 'StateMutability', + 'Function', + 'Fallback', + 'Constructor', + 'Event', + 'ConstructorStateMutability', + 'TransactionReceiptWithDecodedLogs', + 'DecodedLogArgs', + 'LogWithDecodedArgs', + 'ContractEventArg', ], typeNameToExternalLink: { Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API', - Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150', BigNumber: 'http://mikemcl.github.io/bignumber.js', }, - typeNameToPrefix: { - Provider: 'Web3', - }, + typeNameToPrefix: {}, typeNameToDocSection: { Web3Wrapper: docSections.web3Wrapper, }, diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts index da8922e79..40853cb9e 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.ts +++ b/packages/website/ts/containers/zero_ex_js_documentation.ts @@ -168,21 +168,15 @@ const docsInfoConfig: DocsInfoConfig = { 'OrderStateWatcherConfig', 'FilterObject', 'OrderRelevantState', + 'JSONRPCRequestPayload', + 'JSONRPCResponsePayload', + 'JSONRPCErrorCallback', + 'LogEntryEvent', + 'LogEntry', ], - typeNameToPrefix: { - Provider: 'Web3', - DecodedLogEntryEvent: 'Web3', - LogEntryEvent: 'Web3', - CallData: 'Web3', - LogEntry: 'Web3', - }, + typeNameToPrefix: {}, typeNameToExternalLink: { - Web3: constants.URL_WEB3_DOCS, - Provider: constants.URL_WEB3_PROVIDER_DOCS, BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - DecodedLogEntryEvent: constants.URL_WEB3_DECODED_LOG_ENTRY_EVENT, - LogEntryEvent: constants.URL_WEB3_LOG_ENTRY_EVENT, - LogEntry: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L366', }, typeNameToDocSection: { ExchangeWrapper: 'exchange', diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index d542bd804..5bc36da32 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -15,7 +15,7 @@ import { createLazyComponent } from 'ts/lazy_component'; import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage'; import { tradeHistoryStorage } from 'ts/local_storage/trade_history_storage'; import { reducer, State } from 'ts/redux/reducer'; -import { WebsitePaths } from 'ts/types'; +import { WebsiteLegacyPaths, WebsitePaths } from 'ts/types'; import { analytics } from 'ts/utils/analytics'; import { muiTheme } from 'ts/utils/mui_theme'; import { utils } from 'ts/utils/utils'; @@ -98,6 +98,17 @@ render( path={`${WebsitePaths.SmartContracts}/:version?`} component={LazySmartContractsDocumentation} /> + + {/* Legacy endpoints */} + <Route + path={`${WebsiteLegacyPaths.ZeroExJs}/:version?`} + component={LazyZeroExJSDocumentation} + /> + <Route + path={`${WebsiteLegacyPaths.Web3Wrapper}/:version?`} + component={LazyWeb3WrapperDocumentation} + /> + <Route component={NotFound as any} /> </Switch> </div> 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/types.ts b/packages/website/ts/types.ts index dba59f704..c03e5676f 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -341,17 +341,22 @@ export enum Docs { SmartContracts, } +export enum WebsiteLegacyPaths { + ZeroExJs = '/docs/0xjs', + Web3Wrapper = '/docs/web3_wrapper', +} + export enum WebsitePaths { Portal = '/portal', Wiki = '/wiki', - ZeroExJs = '/docs/0xjs', + ZeroExJs = '/docs/0x.js', Home = '/', FAQ = '/faq', About = '/about', Whitepaper = '/pdfs/0x_white_paper.pdf', SmartContracts = '/docs/contracts', Connect = '/docs/connect', - Web3Wrapper = '/docs/web3_wrapper', + Web3Wrapper = '/docs/web3-wrapper', Deployer = '/docs/deployer', JSONSchemas = '/docs/json-schemas', SolCov = '/docs/sol-cov', 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); + }, }; |