aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-19 02:04:16 +0800
committerFabio Berger <me@fabioberger.com>2018-03-19 02:04:16 +0800
commit5468358f2142549c68ffae0085ce7d31ea271ea4 (patch)
tree9c7886744f85a1ed6b1ced653d9312c30d5ffda2 /packages/website/ts
parent87044313c2219f7130c1856f636f3db29b0fd1c4 (diff)
downloaddexon-0x-contracts-5468358f2142549c68ffae0085ce7d31ea271ea4.tar.gz
dexon-0x-contracts-5468358f2142549c68ffae0085ce7d31ea271ea4.tar.zst
dexon-0x-contracts-5468358f2142549c68ffae0085ce7d31ea271ea4.zip
Add Subprovider docs to website
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/components/sidebar_header.tsx1
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx33
-rw-r--r--packages/website/ts/containers/subproviders_documentation.ts137
-rw-r--r--packages/website/ts/index.tsx7
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx2
-rw-r--r--packages/website/ts/types.ts3
6 files changed, 176 insertions, 7 deletions
diff --git a/packages/website/ts/components/sidebar_header.tsx b/packages/website/ts/components/sidebar_header.tsx
index 6fae03691..556243430 100644
--- a/packages/website/ts/components/sidebar_header.tsx
+++ b/packages/website/ts/components/sidebar_header.tsx
@@ -10,6 +10,7 @@ const titleToIcon: { [title: string]: string } = {
Deployer: 'zeroExJs.png',
'Sol-cov': 'zeroExJs.png',
'JSON Schemas': 'zeroExJs.png',
+ Subproviders: 'zeroExJs.png',
'0x Connect': 'connect.png',
'0x Smart Contracts': 'contracts.png',
Wiki: 'wiki.png',
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index 66efe0d24..3a6ceed34 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -120,22 +120,28 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.StandardRelayerApi, Deco.CapWords)}
/>
</a>,
- <Link key="subMenuItem-web3Wrapper" to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
+ <Link key="subMenuItem-jsonSchema" to={WebsitePaths.JSONSchemas} className="text-decoration-none">
<MenuItem
style={{ fontSize: styles.menuItem.fontSize }}
- primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)}
+ primaryText={this.props.translate.get(Key.JsonSchemas, Deco.CapWords)}
/>
</Link>,
- <Link key="subMenuItem-deployer" to={WebsitePaths.Deployer} className="text-decoration-none">
+ <Link key="subMenuItem-subproviders" to={WebsitePaths.Subproviders} className="text-decoration-none">
<MenuItem
style={{ fontSize: styles.menuItem.fontSize }}
- primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
+ primaryText={this.props.translate.get(Key.Subproviders, Deco.CapWords)}
/>
</Link>,
- <Link key="subMenuItem-jsonSchema" to={WebsitePaths.JSONSchemas} className="text-decoration-none">
+ <Link key="subMenuItem-web3Wrapper" to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
<MenuItem
style={{ fontSize: styles.menuItem.fontSize }}
- primaryText={this.props.translate.get(Key.JsonSchemas, Deco.CapWords)}
+ primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)}
+ />
+ </Link>,
+ <Link key="subMenuItem-deployer" to={WebsitePaths.Deployer} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
/>
</Link>,
<Link key="subMenuItem-sol-cov" to={WebsitePaths.SolCov} className="text-decoration-none">
@@ -333,6 +339,14 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</MenuItem>
</Link>
)}
+ {!this._isViewingSubprovidersDocs() && (
+ <Link to={WebsitePaths.Subproviders} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.Subproviders, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
{!this._isViewingPortal() && (
<Link to={`${WebsitePaths.Portal}`} className="text-decoration-none">
<MenuItem className="py2">
@@ -366,6 +380,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
!this._isViewingDeployerDocs() &&
!this._isViewingJsonSchemasDocs() &&
!this._isViewingSolCovDocs() &&
+ !this._isViewingSubprovidersDocs() &&
!this._isViewingConnectDocs()) ||
_.isUndefined(this.props.menu)
) {
@@ -466,6 +481,9 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
private _isViewingSolCovDocs() {
return _.includes(this.props.location.pathname, WebsitePaths.SolCov);
}
+ private _isViewingSubprovidersDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.Subproviders);
+ }
private _isViewingWiki() {
return _.includes(this.props.location.pathname, WebsitePaths.Wiki);
}
@@ -479,7 +497,8 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
this._isViewingDeployerDocs() ||
this._isViewingJsonSchemasDocs() ||
this._isViewingSolCovDocs() ||
+ this._isViewingSubprovidersDocs() ||
this._isViewingConnectDocs()
);
}
-}
+} // tslint:disable:max-file-line-count
diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts
new file mode 100644
index 000000000..34a3d7da2
--- /dev/null
+++ b/packages/website/ts/containers/subproviders_documentation.ts
@@ -0,0 +1,137 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentation/doc_page';
+import { Dispatcher } from 'ts/redux/dispatcher';
+import { State } from 'ts/redux/reducer';
+import { DocPackages, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/subproviders/introduction');
+const InstallationMarkdown = require('md/docs/subproviders/installation');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ subprovider: 'subprovider',
+ ledgerSubprovider: 'ledgerSubprovider',
+ factoryMethods: 'factory-methods',
+ emptyWalletSubprovider: 'emptyWalletSubprovider',
+ fakeGasEstimateSubprovider: 'fakeGasEstimateSubprovider',
+ injectedWeb3Subprovider: 'injectedWeb3Subprovider',
+ redundantRPCSubprovider: 'redundantRPCSubprovider',
+ ganacheSubprovider: 'ganacheSubprovider',
+ nonceTrackerSubprovider: 'nonceTrackerSubprovider',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.Subproviders,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Subproviders',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ subprovider: [docSections.subprovider],
+ ['ledger-subprovider']: [docSections.ledgerSubprovider],
+ ['factory-methods']: [docSections.factoryMethods],
+ ['emptyWallet-subprovider']: [docSections.emptyWalletSubprovider],
+ ['fakeGasEstimate-subprovider']: [docSections.fakeGasEstimateSubprovider],
+ ['injectedWeb3-subprovider']: [docSections.injectedWeb3Subprovider],
+ ['redundantRPC-subprovider']: [docSections.redundantRPCSubprovider],
+ ['ganache-subprovider']: [docSections.ganacheSubprovider],
+ ['nonceTracker-subprovider']: [docSections.nonceTrackerSubprovider],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.subprovider]: ['"subproviders/src/subproviders/subprovider"'],
+ [docSections.ledgerSubprovider]: ['"subproviders/src/subproviders/ledger"'],
+ [docSections.factoryMethods]: ['"subproviders/src/index"'],
+ [docSections.emptyWalletSubprovider]: ['"subproviders/src/subproviders/empty_wallet_subprovider"'],
+ [docSections.fakeGasEstimateSubprovider]: ['"subproviders/src/subproviders/fake_gas_estimate_subprovider"'],
+ [docSections.injectedWeb3Subprovider]: ['"subproviders/src/subproviders/injected_web3"'],
+ [docSections.redundantRPCSubprovider]: ['"subproviders/src/subproviders/redundant_rpc"'],
+ [docSections.ganacheSubprovider]: ['"subproviders/src/subproviders/ganache"'],
+ [docSections.nonceTrackerSubprovider]: ['"subproviders/src/subproviders/nonce_tracker"'],
+ [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [
+ docSections.subprovider,
+ docSections.ledgerSubprovider,
+ docSections.emptyWalletSubprovider,
+ docSections.fakeGasEstimateSubprovider,
+ docSections.injectedWeb3Subprovider,
+ docSections.redundantRPCSubprovider,
+ docSections.ganacheSubprovider,
+ docSections.nonceTrackerSubprovider,
+ ],
+ 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: [
+ 'Callback',
+ 'NextCallback',
+ 'ErrorCallback',
+ 'ECSignature',
+ 'JSONRPCRequestPayloadWithMethod',
+ 'JSONRPCResponsePayload',
+ 'AccountFetchingConfigs',
+ 'LedgerEthereumClientFactoryAsync',
+ 'PartialTxParams',
+ 'LedgerEthereumClient',
+ 'LedgerSubproviderConfigs',
+ ],
+ 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',
+ },
+ },
+};
+const docsInfo = new DocsInfo(docsInfoConfig);
+
+interface ConnectedState {
+ docsVersion: string;
+ availableDocVersions: string[];
+ docsInfo: DocsInfo;
+ translate: Translate;
+}
+
+interface ConnectedDispatch {
+ dispatcher: Dispatcher;
+}
+
+const mapStateToProps = (state: State, ownProps: DocPageProps): ConnectedState => ({
+ docsVersion: state.docsVersion,
+ availableDocVersions: state.availableDocVersions,
+ translate: state.translate,
+ docsInfo,
+});
+
+const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
+ dispatcher: new Dispatcher(dispatch),
+});
+
+export const Documentation: React.ComponentClass<DocPageProps> = connect(mapStateToProps, mapDispatchToProps)(
+ DocPageComponent,
+);
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index 1241c222b..0d33e389f 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -57,6 +57,9 @@ const LazyJSONSchemasDocumentation = createLazyComponent('Documentation', async
const LazySolCovDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/sol_cov_documentation'),
);
+const LazySubprovidersDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/subproviders_documentation'),
+);
analytics.init();
// tslint:disable-next-line:no-floating-promises
@@ -84,6 +87,10 @@ render(
component={LazyJSONSchemasDocumentation}
/>
<Route
+ path={`${WebsitePaths.Subproviders}/:version?`}
+ component={LazySubprovidersDocumentation}
+ />
+ <Route
path={`${WebsitePaths.Web3Wrapper}/:version?`}
component={LazyWeb3WrapperDocumentation}
/>
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 78ab9dfa9..80c47ea5c 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -26,6 +26,7 @@ const docIdToS3FolderName: { [id: string]: string } = {
[DocPackages.Deployer]: 'deployer',
[DocPackages.JSONSchemas]: 'json-schemas',
[DocPackages.SolCov]: 'sol-cov',
+ [DocPackages.Subproviders]: 'subproviders',
};
const docIdToSubpackageName: { [id: string]: string } = {
@@ -36,6 +37,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.Deployer]: 'deployer',
[DocPackages.JSONSchemas]: 'json-schemas',
[DocPackages.SolCov]: 'sol-cov',
+ [DocPackages.Subproviders]: 'subproviders',
};
export interface DocPageProps {
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index b6518110a..262c96c76 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -359,6 +359,7 @@ export enum WebsitePaths {
Deployer = '/docs/deployer',
JSONSchemas = '/docs/json-schemas',
SolCov = '/docs/sol-cov',
+ Subproviders = '/docs/subproviders',
}
export enum DocPackages {
@@ -369,6 +370,7 @@ export enum DocPackages {
Deployer = 'DEPLOYER',
JSONSchemas = 'JSON_SCHEMAS',
SolCov = 'SOL_COV',
+ Subproviders = 'SUBPROVIDERS',
}
export interface TimestampMsRange {
@@ -453,6 +455,7 @@ export enum Key {
Deployer = 'DEPLOYER',
JsonSchemas = 'JSON_SCHEMAS',
SolCov = 'SOL_COV',
+ Subproviders = 'SUBPROVIDERS',
Blog = 'BLOG',
Forum = 'FORUM',
Connect = 'CONNECT',