aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-02 06:01:02 +0800
committerFabio Berger <me@fabioberger.com>2018-08-02 06:01:02 +0800
commit0132286cab49ff6c705abd70cdd89e36b3550c27 (patch)
tree3fced9e9822d9807e3e688da0de72369eebb0c7d /packages
parent2494af99aad4dd58c0d4e647dedf72946cb3c20b (diff)
downloaddexon-sol-tools-0132286cab49ff6c705abd70cdd89e36b3550c27.tar
dexon-sol-tools-0132286cab49ff6c705abd70cdd89e36b3550c27.tar.gz
dexon-sol-tools-0132286cab49ff6c705abd70cdd89e36b3550c27.tar.bz2
dexon-sol-tools-0132286cab49ff6c705abd70cdd89e36b3550c27.tar.lz
dexon-sol-tools-0132286cab49ff6c705abd70cdd89e36b3550c27.tar.xz
dexon-sol-tools-0132286cab49ff6c705abd70cdd89e36b3550c27.tar.zst
dexon-sol-tools-0132286cab49ff6c705abd70cdd89e36b3550c27.zip
Add contract-wrappers page and make topBar component more concise
Diffstat (limited to 'packages')
-rw-r--r--packages/contract-wrappers/package.json10
-rw-r--r--packages/website/translations/chinese.json2
-rw-r--r--packages/website/translations/english.json2
-rw-r--r--packages/website/translations/korean.json2
-rw-r--r--packages/website/translations/russian.json2
-rw-r--r--packages/website/translations/spanish.json2
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx155
-rw-r--r--packages/website/ts/containers/contract_wrappers_documentation.ts56
-rw-r--r--packages/website/ts/index.tsx4
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx1
-rw-r--r--packages/website/ts/types.ts4
11 files changed, 121 insertions, 119 deletions
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index d21dfe505..7b6e5c3b4 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -25,11 +25,16 @@
"update_artifacts_v2": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;",
"copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts",
"clean": "shx rm -rf _bundles lib test_temp test/artifacts src/contract_wrappers/generated src/artifacts",
- "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit"
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
+ "docs:json": "typedoc --excludePrivate --excludeExternals --ignoreCompilerErrors --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
"contracts_v2_beta": "Exchange ERC20Proxy ERC20Token ERC721Proxy ERC721Token WETH9 ZRXToken",
- "contracts_v2": "DummyERC20Token DummyERC721Token"
+ "contracts_v2": "DummyERC20Token DummyERC721Token",
+ "postpublish": {
+ "assets": [],
+ "shouldPublishDocs": true
+ }
},
"repository": {
"type": "git",
@@ -66,6 +71,7 @@
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
"tslint": "5.11.0",
+ "typedoc": "0xProject/typedoc",
"typescript": "2.7.1",
"web3-provider-engine": "14.0.6"
},
diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json
index 3e9f21370..8af9835ab 100644
--- a/packages/website/translations/chinese.json
+++ b/packages/website/translations/chinese.json
@@ -61,6 +61,8 @@
"SOL_COV": "Solidity Coverage",
"ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
+ "CONTRACT_WRAPPERS": "Contract Wrappers",
+ "0x.js": "0x.js",
"BLOG": "博客",
"FORUM": "论坛",
"CONNECT": "0x 连接",
diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json
index d94dbb29e..b6a8113d3 100644
--- a/packages/website/translations/english.json
+++ b/packages/website/translations/english.json
@@ -62,6 +62,8 @@
"SOL_COV": "Solidity Coverage",
"ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
+ "CONTRACT_WRAPPERS": "Contract Wrappers",
+ "0X_JS": "0x.js",
"BLOG": "blog",
"FORUM": "forum",
"CONNECT": "0x Connect",
diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json
index c38de6677..1c2b585bf 100644
--- a/packages/website/translations/korean.json
+++ b/packages/website/translations/korean.json
@@ -61,6 +61,8 @@
"SOL_COV": "Solidity Coverage",
"ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
+ "CONTRACT_WRAPPERS": "Contract Wrappers",
+ "0X_JS": "0x.js",
"BLOG": "블로그",
"FORUM": "포럼",
"CONNECT": "0x Connect",
diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json
index a7e06d646..c2df8ee2a 100644
--- a/packages/website/translations/russian.json
+++ b/packages/website/translations/russian.json
@@ -61,6 +61,8 @@
"SOL_COV": "Solidity Coverage",
"ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
+ "CONTRACT_WRAPPERS": "Contract Wrappers",
+ "0X_JS": "0x.js",
"BLOG": "Блог",
"FORUM": "Форум",
"CONNECT": "0x Connect",
diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json
index 5a8920f61..a874673cf 100644
--- a/packages/website/translations/spanish.json
+++ b/packages/website/translations/spanish.json
@@ -62,6 +62,8 @@
"SOL_COV": "Solidity Coverage",
"ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
+ "CONTRACT_WRAPPERS": "Contract Wrappers",
+ "0X_JS": "0x.js",
"BLOG": "blog",
"FORUM": "foro",
"CONNECT": "0x Connect",
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index 646d3fc94..d2f530fb5 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -74,6 +74,18 @@ const styles: Styles = {
},
};
+const DOC_WEBSITE_PATHS_TO_KEY = {
+ [WebsitePaths.SolCov]: Key.SolCov,
+ [WebsitePaths.SmartContracts]: Key.SmartContracts,
+ [WebsitePaths.Web3Wrapper]: Key.Web3Wrapper,
+ [WebsitePaths.SolCompiler]: Key.SolCompiler,
+ [WebsitePaths.JSONSchemas]: Key.JsonSchemas,
+ [WebsitePaths.Subproviders]: Key.Subproviders,
+ [WebsitePaths.ContractWrappers]: Key.ContractWrappers,
+ [WebsitePaths.Connect]: Key.Connect,
+ [WebsitePaths.ZeroExJs]: Key.ZeroExJs,
+}
+
const DEFAULT_HEIGHT = 68;
const EXPANDED_HEIGHT = 75;
@@ -154,6 +166,12 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)}
/>
</Link>,
+ <Link key="subMenuItem-contractWrappers" to={WebsitePaths.ContractWrappers} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.ContractWrappers, Deco.CapWords)}
+ />
+ </Link>,
<Link key="subMenuItem-sol-compiler" to={WebsitePaths.SolCompiler} className="text-decoration-none">
<MenuItem
style={{ fontSize: styles.menuItem.fontSize }}
@@ -334,75 +352,16 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
<Link to={`${WebsitePaths.Wiki}`} className="text-decoration-none">
<MenuItem className="py2">{this.props.translate.get(Key.Wiki, Deco.Cap)}</MenuItem>
</Link>
- {!this._isViewing0xjsDocs() && (
- <Link to={WebsitePaths.ZeroExJs} className="text-decoration-none">
- <MenuItem className="py2">0x.js {this.props.translate.get(Key.Docs, Deco.Cap)}</MenuItem>
- </Link>
- )}
- {!this._isViewingConnectDocs() && (
- <Link to={WebsitePaths.Connect} className="text-decoration-none">
- <MenuItem className="py2">
- {this.props.translate.get(Key.Connect, Deco.Cap)}{' '}
- {this.props.translate.get(Key.Docs, Deco.Cap)}
- </MenuItem>
- </Link>
- )}
- {!this._isViewingSmartContractsDocs() && (
- <Link to={WebsitePaths.SmartContracts} className="text-decoration-none">
- <MenuItem className="py2">
- {this.props.translate.get(Key.SmartContract, Deco.Cap)}{' '}
- {this.props.translate.get(Key.Docs, Deco.Cap)}
- </MenuItem>
- </Link>
- )}
- {!this._isViewingWeb3WrapperDocs() && (
- <Link to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
- <MenuItem className="py2">
- {this.props.translate.get(Key.Web3Wrapper, Deco.Cap)}{' '}
- {this.props.translate.get(Key.Docs, Deco.Cap)}
- </MenuItem>
- </Link>
- )}
- {!this._isViewingSolCompilerDocs() && (
- <Link to={WebsitePaths.SolCompiler} className="text-decoration-none">
- <MenuItem className="py2">
- {this.props.translate.get(Key.SolCompiler, Deco.Cap)}{' '}
- {this.props.translate.get(Key.Docs, Deco.Cap)}
- </MenuItem>
- </Link>
- )}
- {!this._isViewingJsonSchemasDocs() && (
- <Link to={WebsitePaths.JSONSchemas} className="text-decoration-none">
- <MenuItem className="py2">
- {this.props.translate.get(Key.JsonSchemas, Deco.Cap)}{' '}
- {this.props.translate.get(Key.Docs, Deco.Cap)}
- </MenuItem>
- </Link>
- )}
- {!this._isViewingSolCovDocs() && (
- <Link to={WebsitePaths.SolCov} className="text-decoration-none">
- <MenuItem className="py2">
- {this.props.translate.get(Key.SolCov, Deco.Cap)}{' '}
- {this.props.translate.get(Key.Docs, Deco.Cap)}
- </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._isViewingEthereumTypesDocs() && (
- <Link to={WebsitePaths.EthereumTypes} className="text-decoration-none">
- <MenuItem className="py2">
- {this.props.translate.get(Key.EthereumTypes, Deco.Cap)}{' '}
- {this.props.translate.get(Key.Docs, Deco.Cap)}
- </MenuItem>
- </Link>
- )}
+ {_.map(DOC_WEBSITE_PATHS_TO_KEY, (key, websitePath) => {
+ if (!this._doesUrlInclude(websitePath)) {
+ <Link to={websitePath} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(key, 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">
@@ -429,15 +388,11 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
);
}
private _renderDocsMenu(): React.ReactNode {
+ const isViewingDocsPage = _.some(DOC_WEBSITE_PATHS_TO_KEY, (_key, websitePath) => {
+ return this._doesUrlInclude(websitePath);
+ });
if (
- (!this._isViewing0xjsDocs() &&
- !this._isViewingSmartContractsDocs() &&
- !this._isViewingWeb3WrapperDocs() &&
- !this._isViewingSolCompilerDocs() &&
- !this._isViewingJsonSchemasDocs() &&
- !this._isViewingSolCovDocs() &&
- !this._isViewingSubprovidersDocs() &&
- !this._isViewingConnectDocs()) ||
+ !isViewingDocsPage ||
_.isUndefined(this.props.menu)
) {
return undefined;
@@ -488,55 +443,21 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
private _isViewingFAQ(): boolean {
return _.includes(this.props.location.pathname, WebsitePaths.FAQ);
}
- private _isViewing0xjsDocs(): boolean {
- return (
- _.includes(this.props.location.pathname, WebsitePaths.ZeroExJs) ||
- _.includes(this.props.location.pathname, WebsiteLegacyPaths.ZeroExJs)
- );
- }
- private _isViewingConnectDocs(): boolean {
- return _.includes(this.props.location.pathname, WebsitePaths.Connect);
- }
- private _isViewingSmartContractsDocs(): boolean {
- return _.includes(this.props.location.pathname, WebsitePaths.SmartContracts);
- }
- private _isViewingWeb3WrapperDocs(): boolean {
- return (
- _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper) ||
- _.includes(this.props.location.pathname, WebsiteLegacyPaths.Web3Wrapper)
- );
- }
- private _isViewingSolCompilerDocs(): boolean {
- return _.includes(this.props.location.pathname, WebsitePaths.SolCompiler);
- }
- private _isViewingJsonSchemasDocs(): boolean {
- return _.includes(this.props.location.pathname, WebsitePaths.JSONSchemas);
- }
- private _isViewingSolCovDocs(): boolean {
- return _.includes(this.props.location.pathname, WebsitePaths.SolCov);
- }
- private _isViewingSubprovidersDocs(): boolean {
- return _.includes(this.props.location.pathname, WebsitePaths.Subproviders);
- }
- private _isViewingEthereumTypesDocs(): boolean {
- return _.includes(this.props.location.pathname, WebsitePaths.EthereumTypes);
+ private _doesUrlInclude(aPath: string): boolean {
+ return _.includes(this.props.location.pathname, aPath);
}
private _isViewingWiki(): boolean {
return _.includes(this.props.location.pathname, WebsitePaths.Wiki);
}
private _shouldDisplayBottomBar(): boolean {
+ const isViewingDocsPage = _.some(DOC_WEBSITE_PATHS_TO_KEY, (_key, websitePath) => {
+ return this._doesUrlInclude(websitePath);
+ });
return (
+ isViewingDocsPage ||
this._isViewingWiki() ||
this._isViewingFAQ() ||
this._isViewingDocs() ||
- this._isViewing0xjsDocs() ||
- this._isViewingSmartContractsDocs() ||
- this._isViewingWeb3WrapperDocs() ||
- this._isViewingSolCompilerDocs() ||
- this._isViewingJsonSchemasDocs() ||
- this._isViewingSolCovDocs() ||
- this._isViewingSubprovidersDocs() ||
- this._isViewingConnectDocs() ||
this._isViewingPortal()
);
}
diff --git a/packages/website/ts/containers/contract_wrappers_documentation.ts b/packages/website/ts/containers/contract_wrappers_documentation.ts
new file mode 100644
index 000000000..f0547cecd
--- /dev/null
+++ b/packages/website/ts/containers/contract_wrappers_documentation.ts
@@ -0,0 +1,56 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+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 } from 'ts/types';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+// TODO: Add MD sections
+const markdownSections = {};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.ContractWrappers,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Contract Wrappers',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ markdownMenu: {},
+ sectionNameToMarkdownByVersion: {},
+ markdownSections,
+ typeConfigs: {
+ typeNameToPrefix: {},
+ typeNameToExternalLink: {
+ BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
+ },
+ },
+};
+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,
+ docsInfo,
+ translate: state.translate,
+});
+
+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 ed52e28d2..36b2f6b87 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -37,6 +37,9 @@ const LazyPortal = createLazyComponent('Portal', async () =>
const LazyZeroExJSDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "zeroExDocs" */ 'ts/containers/zero_ex_js_documentation'),
);
+const LazyContractWrappersDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "contractWrapperDocs" */ 'ts/containers/contract_wrappers_documentation'),
+);
const LazySmartContractsDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "smartContractDocs" */ 'ts/containers/smart_contracts_documentation'),
);
@@ -80,6 +83,7 @@ render(
<Route path={WebsitePaths.About} component={About as any} />
<Route path={WebsitePaths.Wiki} component={Wiki as any} />
<Route path={`${WebsitePaths.ZeroExJs}/:version?`} component={LazyZeroExJSDocumentation} />
+ <Route path={`${WebsitePaths.ContractWrappers}/:version?`} component={LazyContractWrappersDocumentation} />
<Route path={`${WebsitePaths.Connect}/:version?`} component={LazyConnectDocumentation} />
<Route
path={`${WebsitePaths.SolCompiler}/:version?`}
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 6e11dead9..e7e5f8a8c 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -28,6 +28,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.Connect]: 'connect',
[DocPackages.SmartContracts]: 'contracts',
[DocPackages.Web3Wrapper]: 'web3-wrapper',
+ [DocPackages.ContractWrappers]: 'contract-wrappers',
[DocPackages.SolCompiler]: 'sol-compiler',
[DocPackages.JSONSchemas]: 'json-schemas',
[DocPackages.SolCov]: 'sol-cov',
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index e1b5be39a..fd82ef7cb 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -371,6 +371,7 @@ export enum WebsitePaths {
SmartContracts = '/docs/contracts',
Connect = '/docs/connect',
Web3Wrapper = '/docs/web3-wrapper',
+ ContractWrappers = '/docs/contract-wrappers',
SolCompiler = '/docs/sol-compiler',
JSONSchemas = '/docs/json-schemas',
SolCov = '/docs/sol-cov',
@@ -391,6 +392,7 @@ export enum DocPackages {
Subproviders = 'SUBPROVIDERS',
OrderUtils = 'ORDER_UTILS',
EthereumTypes = 'ETHEREUM_TYPES',
+ ContractWrappers = 'CONTRACT_WRAPPERS',
}
export enum Key {
@@ -444,6 +446,8 @@ export enum Key {
SolCov = 'SOL_COV',
EthereumTypes = 'ETHEREUM_TYPES',
Subproviders = 'SUBPROVIDERS',
+ ZeroExJs = '0X_JS',
+ ContractWrappers = 'CONTRACT_WRAPPERS',
Blog = 'BLOG',
Forum = 'FORUM',
Connect = 'CONNECT',