aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
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.tsx19
-rw-r--r--packages/website/ts/containers/json_schemas_documentation.ts85
-rw-r--r--packages/website/ts/index.tsx7
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx4
-rw-r--r--packages/website/ts/types.ts3
6 files changed, 118 insertions, 1 deletions
diff --git a/packages/website/ts/components/sidebar_header.tsx b/packages/website/ts/components/sidebar_header.tsx
index 33c5ac857..6216d2146 100644
--- a/packages/website/ts/components/sidebar_header.tsx
+++ b/packages/website/ts/components/sidebar_header.tsx
@@ -8,6 +8,7 @@ const titleToIcon: { [title: string]: string } = {
'0x.js': 'zeroExJs.png',
Web3Wrapper: 'zeroExJs.png',
Deployer: 'zeroExJs.png',
+ 'JSON Schemas': '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 9cde5bf3f..9474311b4 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -151,6 +151,12 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
/>
</Link>,
+ <Link key="subMenuItem-jsonSchema" to={WebsitePaths.JSONSchemas} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.JsonSchemas, Deco.CapWords)}
+ />
+ </Link>,
];
const bottomBorderStyle = this._shouldDisplayBottomBar() ? styles.bottomBar : {};
const fullWidthClasses = isFullWidthPage ? 'pr4' : '';
@@ -305,6 +311,14 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</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._isViewingPortal() && (
<Link to={`${WebsitePaths.Portal}`} className="text-decoration-none">
<MenuItem className="py2">
@@ -336,6 +350,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
!this._isViewingSmartContractsDocs() &&
!this._isViewingWeb3WrapperDocs() &&
!this._isViewingDeployerDocs() &&
+ !this._isViewingJsonSchemasDocs() &&
!this._isViewingConnectDocs()) ||
_.isUndefined(this.props.menu)
) {
@@ -430,6 +445,9 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
private _isViewingDeployerDocs() {
return _.includes(this.props.location.pathname, WebsitePaths.Deployer);
}
+ private _isViewingJsonSchemasDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.JSONSchemas);
+ }
private _isViewingWiki() {
return _.includes(this.props.location.pathname, WebsitePaths.Wiki);
}
@@ -441,6 +459,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
this._isViewingSmartContractsDocs() ||
this._isViewingWeb3WrapperDocs() ||
this._isViewingDeployerDocs() ||
+ this._isViewingJsonSchemasDocs() ||
this._isViewingConnectDocs()
);
}
diff --git a/packages/website/ts/containers/json_schemas_documentation.ts b/packages/website/ts/containers/json_schemas_documentation.ts
new file mode 100644
index 000000000..42e441212
--- /dev/null
+++ b/packages/website/ts/containers/json_schemas_documentation.ts
@@ -0,0 +1,85 @@
+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/json_schemas/introduction');
+const InstallationMarkdown = require('md/docs/json_schemas/installation');
+const SchemasMarkdown = require('md/docs/json_schemas/schemas');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ schemaValidator: 'schemaValidator',
+ schemas: 'schemas',
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.JSONSchemas,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'JSON Schemas',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ schemaValidator: [docSections.schemaValidator],
+ schemas: [docSections.schemas],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ [docSections.schemas]: SchemasMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.schemaValidator]: ['"json-schemas/src/schema_validator"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [docSections.schemaValidator],
+ 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: [],
+ typeNameToExternalLink: {
+ Schema:
+ 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49',
+ },
+ },
+};
+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 cc09f2df3..b5166ebca 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -51,6 +51,9 @@ const LazyWeb3WrapperDocumentation = createLazyComponent('Documentation', async
const LazyDeployerDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/deployer_documentation'),
);
+const LazyJSONSchemasDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/json_schemas_documentation'),
+);
analytics.init();
// tslint:disable-next-line:no-floating-promises
@@ -73,6 +76,10 @@ render(
<Route path={`${WebsitePaths.Connect}/:version?`} component={LazyConnectDocumentation} />
<Route path={`${WebsitePaths.Deployer}/:version?`} component={LazyDeployerDocumentation} />
<Route
+ path={`${WebsitePaths.JSONSchemas}/:version?`}
+ component={LazyJSONSchemasDocumentation}
+ />
+ <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 5f09ec9ef..55dbe12af 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -17,13 +17,14 @@ import { utils } from 'ts/utils/utils';
const ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH = '0.32.4';
-const isDevelopment = configs.ENVIRONMENT !== Environments.DEVELOPMENT;
+const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT;
const docIdToS3FolderName: { [id: string]: string } = {
[DocPackages.ZeroExJs]: '0xjs',
[DocPackages.SmartContracts]: 'smart-contracts',
[DocPackages.Connect]: 'connect',
[DocPackages.Web3Wrapper]: 'web3-wrapper',
[DocPackages.Deployer]: 'deployer',
+ [DocPackages.JSONSchemas]: 'json-schemas',
};
const docIdToSubpackageName: { [id: string]: string } = {
@@ -32,6 +33,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.SmartContracts]: 'contracts',
[DocPackages.Web3Wrapper]: 'web3-wrapper',
[DocPackages.Deployer]: 'deployer',
+ [DocPackages.JSONSchemas]: 'json-schemas',
};
export interface DocPageProps {
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index 4a3426b56..b36d389e0 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -357,6 +357,7 @@ export enum WebsitePaths {
Connect = '/docs/connect',
Web3Wrapper = '/docs/web3_wrapper',
Deployer = '/docs/deployer',
+ JSONSchemas = '/docs/json-schemas',
}
export enum DocPackages {
@@ -365,6 +366,7 @@ export enum DocPackages {
SmartContracts = 'SMART_CONTRACTS',
Web3Wrapper = 'WEB3_WRAPPER',
Deployer = 'DEPLOYER',
+ JSONSchemas = 'JSON_SCHEMAS',
}
export interface TimestampMsRange {
@@ -447,6 +449,7 @@ export enum Key {
Careers = 'CAREERS',
Contact = 'CONTACT',
Deployer = 'DEPLOYER',
+ JsonSchemas = 'JSON_SCHEMAS',
Blog = 'BLOG',
Forum = 'FORUM',
Connect = 'CONNECT',