Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/beta-render-et-al

This commit is contained in:
fragosti 2018-10-19 09:44:47 -07:00
commit 100f446031
25 changed files with 320 additions and 158 deletions

View File

@ -21,23 +21,31 @@ If you're developing on 0x now or are interested in using 0x infrastructure in t
### Published Packages
| Package | Version | Description |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
| [`@0x/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen.svg)](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
| [`@0x/abi-gen-wrappers`](/packages/abi-gen-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen-wrappers.svg)](https://www.npmjs.com/package/@0x/abi-gen-wrappers) | Low-level 0x smart contract wrappers generated using @0x/abi-gen |
| [`@0x/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0x/assert.svg)](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
| [`@0x/asset-buyer`](/packages/asset-buyer) | [![npm](https://img.shields.io/npm/v/@0x/asset-buyer.svg)](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether. |
| [`@0x/asset-buyer`](/packages/asset-buyer) | [![npm](https://img.shields.io/npm/v/@0x/asset-buyer.svg)](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether |
| [`@0x/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0x/base-contract.svg)](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
| [`@0x/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0x/connect.svg)](https://www.npmjs.com/package/@0x/connect) | A Javascript library for interacting with the Standard Relayer API |
| [`@0x/contract-addresses`](/packages/contract-addresses) | [![npm](https://img.shields.io/npm/v/@0x/contract-addresses.svg)](https://www.npmjs.com/package/@0x/contract-addresses) | Used to get known addresses of deployed 0x contracts |
| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts |
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/contract-wrappers.svg)](https://www.npmjs.com/package/@0x/contract-wrappers) | Smart TS wrappers for 0x smart contracts |
| [`@0x/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0x/dev-utils.svg)](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x projects and packages |
| [`@0x/fill-scenarios`](/packages/fill-scenarios) | [![npm](https://img.shields.io/npm/v/@0x/fill-scenarios.svg)](https://www.npmjs.com/package/@0x/fill-scenarios) | 0x order fill scenario generation |
| [`@0x/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0x/json-schemas.svg)](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related json schemas |
| [`@0x/monorepo-scripts`](/packages/monorepo-scripts) | [![npm](https://img.shields.io/npm/v/@0x/monorepo-scripts.svg)](https://www.npmjs.com/package/@0x/monorepo-scripts) | Monorepo scripts |
| [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders. |
| [`@0x/migrations`](/packages/migrations) | [![npm](https://img.shields.io/npm/v/@0x/migrations.svg)](https://www.npmjs.com/package/@0x/migrations) | 0x smart contract migrations |
| [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`@0x/order-watcher`](/packages/order-watcher) | [![npm](https://img.shields.io/npm/v/@0x/order-watcher.svg)](https://www.npmjs.com/package/@0x/order-watcher) | An order watcher daemon that watches for order validity |
| [`@0x/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0x/react-docs.svg)](https://www.npmjs.com/package/@0x/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
| [`@0x/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0x/react-shared.svg)](https://www.npmjs.com/package/@0x/react-shared) | 0x shared react components |
| [`@0x/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0x/sol-compiler.svg)](https://www.npmjs.com/package/@0x/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties. |
| [`@0x/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0x/sol-compiler.svg)](https://www.npmjs.com/package/@0x/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties |
| [`@0x/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0x/sol-cov.svg)](https://www.npmjs.com/package/@0x/sol-cov) | Solidity test coverage tool |
| [`@0x/sol-doc`](/packages/sol-doc) | [![npm](https://img.shields.io/npm/v/@0x/sol-doc.svg)](https://www.npmjs.com/package/@0x/sol-doc) | Solidity documentation generator |
| [`@0x/sol-resolver`](/packages/sol-resolver) | [![npm](https://img.shields.io/npm/v/@0x/sol-resolver.svg)](https://www.npmjs.com/package/@0x/sol-resolver) | Import resolver for smart contracts dependencies |
| [`@0x/sra-spec`](/packages/sra-spec) | [![npm](https://img.shields.io/npm/v/@0x/sra-spec.svg)](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the standard relayer API |
| [`@0x/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0x/subproviders.svg)](https://www.npmjs.com/package/@0x/subproviders) | Useful web3 subproviders (e.g LedgerSubprovider) |
| [`@0x/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0x/subproviders.svg)](https://www.npmjs.com/package/@0x/subproviders) | Useful web3 subproviders (e.g. LedgerSubprovider) |
| [`@0x/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0x/tslint-config.svg)](https://www.npmjs.com/package/@0x/tslint-config) | Custom 0x development TSLint rules |
| [`@0x/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0x/types.svg)](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
| [`@0x/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0x/typescript-typings.svg)](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |

View File

@ -0,0 +1,13 @@
{
"domain": "0x-instant-dogfood",
"build_command": "yarn build:umd:prod",
"upload_directory": "public",
"index_key": "index.html",
"error_key": "index.html",
"trailing_slashes": true,
"cache": 3600,
"aws_profile": "default",
"aws_region": "us-east-1",
"cdn": false,
"dns_configured": true
}

View File

@ -46,6 +46,18 @@ The package is also available as a UMD module named `zeroExInstant`.
</body>
```
## Deploying
You can deploy a work-in-progress version of 0x Instant at http://0x-instant-dogfood.s3-website-us-east-1.amazonaws.com for easy sharing.
To build and deploy the site run
```
yarn deploy
```
**NOTE: On deploying the site, it will say the site is available at a non-existent URL. Please ignore and use the (now updated) URL above.**
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.

View File

@ -22,6 +22,7 @@
"rebuild_and_test": "run-s clean build test",
"test:circleci": "yarn test:coverage",
"clean": "shx rm -rf lib coverage scripts",
"deploy": "discharge deploy",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"config": {
@ -61,6 +62,7 @@
"ts-optchain": "^0.1.1"
},
"devDependencies": {
"@static/discharge": "^1.2.2",
"@0x/tslint-config": "^1.0.9",
"@types/enzyme": "^3.1.14",
"@types/enzyme-adapter-react-16": "^1.0.3",

View File

@ -11,7 +11,7 @@ import { utils } from './utils/utils';
async function prepublishChecksAsync(): Promise<void> {
const shouldIncludePrivate = false;
const updatedPublicPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
const updatedPublicPackages = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
await checkCurrentVersionMatchesLatestPublishedNPMPackageAsync(updatedPublicPackages);
await checkChangelogFormatAsync(updatedPublicPackages);

View File

@ -34,12 +34,12 @@ async function confirmAsync(message: string): Promise<void> {
(async () => {
// Fetch public, updated Lerna packages
const shouldIncludePrivate = true;
const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
if (_.isEmpty(allUpdatedPackages)) {
const allPackagesToPublish = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
if (_.isEmpty(allPackagesToPublish)) {
utils.log('No packages need publishing');
process.exit(0);
}
const packagesWithDocs = getPackagesWithDocs(allUpdatedPackages);
const packagesWithDocs = getPackagesWithDocs(allPackagesToPublish);
if (!configs.IS_LOCAL_PUBLISH) {
await confirmAsync(
@ -49,12 +49,12 @@ async function confirmAsync(message: string): Promise<void> {
}
// Update CHANGELOGs
const updatedPublicPackages = _.filter(allUpdatedPackages, pkg => !pkg.packageJson.private);
const updatedPublicPackages = _.filter(allPackagesToPublish, pkg => !pkg.packageJson.private);
const updatedPublicPackageNames = _.map(updatedPublicPackages, pkg => pkg.packageJson.name);
utils.log(`Will update CHANGELOGs and publish: \n${updatedPublicPackageNames.join('\n')}\n`);
const packageToNextVersion = await updateChangeLogsAsync(updatedPublicPackages);
const updatedPrivatePackages = _.filter(allUpdatedPackages, pkg => pkg.packageJson.private);
const updatedPrivatePackages = _.filter(allPackagesToPublish, pkg => pkg.packageJson.private);
_.each(updatedPrivatePackages, pkg => {
const currentVersion = pkg.packageJson.version;
const packageName = pkg.packageJson.name;

View File

@ -22,7 +22,7 @@ const args = yargs
let packages;
if (_.isUndefined(args.packages)) {
const shouldIncludePrivate = false;
packages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
packages = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
} else {
const packageNames = args.packages.split(' ');
packages = await utils.getPackagesByNameAsync(packageNames);

View File

@ -12,7 +12,7 @@ import { utils } from './utils';
const publishReleaseAsync = promisify(publishRelease);
// tslint:disable-next-line:completed-docs
export async function publishReleaseNotesAsync(updatedPublishPackages: Package[], isDryRun: boolean): Promise<void> {
export async function publishReleaseNotesAsync(packagesToPublish: Package[], isDryRun: boolean): Promise<void> {
// Git push a tag representing this publish (publish-{commit-hash}) (truncate hash)
const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath });
const latestGitCommit = result.stdout;
@ -40,12 +40,8 @@ export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]
let assets: string[] = [];
let aggregateNotes = '';
_.each(updatedPublishPackages, pkg => {
const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version);
if (_.isEmpty(notes)) {
return; // don't include it
}
aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`;
_.each(packagesToPublish, pkg => {
aggregateNotes += getReleaseNotesForPackage(pkg.packageJson.name);
const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets');
if (!_.isUndefined(packageAssets)) {
@ -92,7 +88,7 @@ function adjustAssetPaths(assets: string[]): string[] {
return finalAssets;
}
function getReleaseNotesForPackage(packageName: string, version: string): string {
function getReleaseNotesForPackage(packageName: string): string {
const packageNameWithoutNamespace = packageName.replace('@0x/', '');
const changelogJSONPath = path.join(
constants.monorepoRootPath,
@ -115,5 +111,9 @@ function getReleaseNotesForPackage(packageName: string, version: string): string
}
notes += `\n`;
});
return notes;
if (_.isEmpty(notes)) {
return ''; // don't include it
}
const releaseNotesSection = `### ${packageName}@${latestLog.version}\n${notes}\n\n`;
return releaseNotesSection;
}

View File

@ -61,7 +61,7 @@ export const utils = {
});
return updatedPackages;
},
async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
async getPackagesToPublishAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name);

View File

@ -50,7 +50,7 @@
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-markdown": "^3.2.2",
"react-scroll": "0xproject/react-scroll#similar-to-pr-330-but-with-replace-state",
"react-scroll": "0xproject/react-scroll#pr-330-and-replace-state",
"react-tooltip": "^3.2.7",
"semver": "5.5.0",
"styled-components": "^3.3.0"

View File

@ -55,7 +55,7 @@
"react-highlight": "0xproject/react-highlight#2f40a42e0a3f0ad126f9f42d505b97b603fc7162",
"react-markdown": "^3.2.2",
"react-router-dom": "^4.1.1",
"react-scroll": "0xproject/react-scroll#similar-to-pr-330-but-with-replace-state",
"react-scroll": "0xproject/react-scroll#pr-330-and-replace-state",
"styled-components": "^3.3.0",
"valid-url": "^1.0.9"
},

View File

@ -48,7 +48,7 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd
const formattedSectionName = utils.convertCamelCaseToSpaces(sectionName);
const title = !_.isUndefined(this.props.alternativeSectionTitle)
? this.props.alternativeSectionTitle
: formattedSectionName;
: _.capitalize(formattedSectionName);
return (
<div
className="md-px1 sm-px2 overflow-hidden"
@ -61,7 +61,7 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd
<span style={{ color: colors.grey700 }}>
<AnchorTitle
headerSize={headerSize}
title={_.capitalize(title)}
title={title}
id={id}
shouldShowAnchor={this.state.shouldShowAnchor}
/>

View File

@ -52,7 +52,7 @@
"react-helmet": "^5.2.0",
"react-popper": "^1.0.0-beta.6",
"react-redux": "^5.0.3",
"react-scroll": "0xproject/react-scroll#similar-to-pr-330-but-with-replace-state",
"react-scroll": "0xproject/react-scroll#pr-330-and-replace-state",
"react-tooltip": "^3.2.7",
"react-typist": "^2.0.4",
"redux": "^3.6.0",

View File

@ -80,13 +80,13 @@
"HOME": "Rocket.chat",
"ROCKETCHAT": "开发人员",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"ORDER_BASICS": "0x order basics",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_SHARED_LIQUIDITY": "use shared liquidity",
"USE_SHARED_LIQUIDITY_DESCRIPTION": "Access the shared liquidity pool using the Standard Relayer API",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
"USE_NETWORKED_LIQUIDITY_DESCRIPTION": "Access the shared liquidity pool using the Standard Relayer API",
"VIEW_ALL_DOCUMENTATION": "view all documentation",
"SANDBOX": "0x.js sandbox",
"GITHUB": "github",

View File

@ -84,13 +84,13 @@
"ROCKETCHAT": "rocket.chat",
"TRADE_CALL_TO_ACTION": "trade on 0x",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"ORDER_BASICS": "0x order basics",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_SHARED_LIQUIDITY": "use shared liquidity",
"USE_SHARED_LIQUIDITY_DESCRIPTION": "Learn how to tap into shared liquidity using the Standard Relayer API",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
"USE_NETWORKED_LIQUIDITY_DESCRIPTION": "Learn how to tap into networked liquidity using the Standard Relayer API",
"VIEW_ALL_DOCUMENTATION": "view all documentation",
"SANDBOX": "0x.js sandbox",
"GITHUB": "github",

View File

@ -80,13 +80,13 @@
"ROCKETCHAT": "Rocket.chat",
"DEVELOPERS": "개발자",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"ORDER_BASICS": "0x order basics",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_SHARED_LIQUIDITY": "use shared liquidity",
"USE_SHARED_LIQUIDITY_DESCRIPTION": "Learn how to tap into shared liquidity using the Standard Relayer API",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
"USE_NETWORKED_LIQUIDITY_DESCRIPTION": "Learn how to tap into networked liquidity using the Standard Relayer API",
"VIEW_ALL_DOCUMENTATION": "view all documentation",
"SANDBOX": "0x.js sandbox",
"GITHUB": "github",

View File

@ -80,13 +80,13 @@
"HOME": "Rocket.chat",
"ROCKETCHAT": "Для разработчиков",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"ORDER_BASICS": "0x order basics",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_SHARED_LIQUIDITY": "use shared liquidity",
"USE_SHARED_LIQUIDITY_DESCRIPTION": "Learn how to tap into shared liquidity using the Standard Relayer API",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
"USE_NETWORKED_LIQUIDITY_DESCRIPTION": "Learn how to tap into networked liquidity using the Standard Relayer API",
"VIEW_ALL_DOCUMENTATION": "view all documentation",
"SANDBOX": "0x.js sandbox",
"GITHUB": "github",

View File

@ -81,13 +81,13 @@
"HOME": "rocket.chat",
"ROCKETCHAT": "desarrolladores",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
"ORDER_BASICS": "0x order basics",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_SHARED_LIQUIDITY": "use shared liquidity",
"USE_SHARED_LIQUIDITY_DESCRIPTION": "Learn how to tap into shared liquidity using the Standard Relayer API",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
"USE_NETWORKED_LIQUIDITY_DESCRIPTION": "Learn how to tap into networked liquidity using the Standard Relayer API",
"VIEW_ALL_DOCUMENTATION": "view all documentation",
"SANDBOX": "0x.js sandbox",
"GITHUB": "github",

View File

@ -24,7 +24,7 @@ const gettingStartedKeyToLinkInfo2: ALink[] = [
to: `${WebsitePaths.Wiki}#Ethereum-Development`,
},
{
title: Key.UseSharedLiquidity,
title: Key.UseNetworkedLiquidity,
to: `${WebsitePaths.Wiki}#Find,-Submit,-Fill-Order-From-Relayer`,
},
];

View File

@ -1,4 +1,4 @@
import { colors, constants as sharedConstants } from '@0x/react-shared';
import { colors, constants as sharedConstants, utils as sharedUtils } from '@0x/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
import DocumentTitle = require('react-document-title');
@ -6,13 +6,33 @@ import { DocsLogo } from 'ts/components/documentation/docs_logo';
import { DocsTopBar } from 'ts/components/documentation/docs_top_bar';
import { Container } from 'ts/components/ui/container';
import { Dispatcher } from 'ts/redux/dispatcher';
import { ScreenWidths } from 'ts/types';
import { styled } from 'ts/style/theme';
import { BrowserType, OperatingSystemType, ScreenWidths } from 'ts/types';
import { Translate } from 'ts/utils/translate';
import { utils } from 'ts/utils/utils';
const THROTTLE_TIMEOUT = 100;
const TOP_BAR_HEIGHT = 80;
const SCROLLER_WIDTH = 4;
const browserType = utils.getBrowserType();
let SCROLLBAR_WIDTH;
switch (browserType) {
case BrowserType.Firefox:
// HACK: Firefox doesn't allow styling of their scrollbar's.
// Source: https://stackoverflow.com/questions/6165472/custom-css-scrollbar-for-firefox
const os = utils.getOperatingSystem();
SCROLLBAR_WIDTH = os === OperatingSystemType.Windows ? 17 : 15;
break;
case BrowserType.Edge:
// Edge's scrollbar is placed outside of the div content and doesn't
// need to be accounted for
SCROLLBAR_WIDTH = 0;
break;
default:
SCROLLBAR_WIDTH = 4;
}
const SIDEBAR_PADDING = 22;
export interface DevelopersPageProps {
location: Location;
@ -24,11 +44,71 @@ export interface DevelopersPageProps {
}
export interface DevelopersPageState {
isHoveringSidebar: boolean;
isHoveringMainContent: boolean;
isSidebarScrolling: boolean;
}
const isUserOnMobile = sharedUtils.isUserOnMobile();
const scrollableContainerStyles = `
position: absolute;
top: ${TOP_BAR_HEIGHT}px;
left: 0px;
bottom: 0px;
right: 0px;
overflow-x: hidden;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
/* Required for hide/show onHover of scrollbar on Microsoft Edge */
-ms-overflow-style: -ms-autohiding-scrollbar;
`;
interface SidebarContainerProps {
className?: string;
}
const SidebarContainer =
styled.div <
SidebarContainerProps >
`
${scrollableContainerStyles}
padding-top: 27px;
padding-bottom: 100px;
padding-left: ${SIDEBAR_PADDING}px;
padding-right: ${SIDEBAR_PADDING}px;
overflow: hidden;
&:hover {
overflow: auto;
padding-right: ${SIDEBAR_PADDING - SCROLLBAR_WIDTH}px;
}
`;
interface MainContentContainerProps {
className?: string;
}
const MainContentContainer =
styled.div <
MainContentContainerProps >
`
${scrollableContainerStyles}
padding-top: 0px;
padding-left: 50px;
padding-right: 50px;
overflow: ${isUserOnMobile ? 'auto' : 'hidden'};
&:hover {
padding-right: ${50 - SCROLLBAR_WIDTH}px;
overflow: auto;
}
@media (max-width: 40em) {
padding-left: 20px;
padding-right: 20px;
&:hover {
padding-right: ${20 - SCROLLBAR_WIDTH}px;
overflow: auto;
}
}
`;
export class DevelopersPage extends React.Component<DevelopersPageProps, DevelopersPageState> {
private readonly _throttledScreenWidthUpdate: () => void;
private readonly _throttledSidebarScrolling: () => void;
@ -38,8 +118,6 @@ export class DevelopersPage extends React.Component<DevelopersPageProps, Develop
this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT);
this._throttledSidebarScrolling = _.throttle(this._onSidebarScroll.bind(this), THROTTLE_TIMEOUT);
this.state = {
isHoveringSidebar: false,
isHoveringMainContent: false,
isSidebarScrolling: false,
};
}
@ -57,20 +135,8 @@ export class DevelopersPage extends React.Component<DevelopersPageProps, Develop
window.clearInterval(this._sidebarScrollClearingInterval);
}
public render(): React.ReactNode {
const scrollableContainerStyles: React.CSSProperties = {
position: 'absolute',
top: 80,
left: 0,
bottom: 0,
right: 0,
overflowX: 'hidden',
overflowY: 'scroll',
minHeight: `calc(100vh - ${TOP_BAR_HEIGHT}px)`,
WebkitOverflowScrolling: 'touch',
};
const isSmallScreen = this.props.screenWidth === ScreenWidths.Sm;
const mainContentPadding = isSmallScreen ? 20 : 50;
const sidebarPadding = 22;
return (
<Container
className="flex items-center overflow-hidden"
@ -79,7 +145,7 @@ export class DevelopersPage extends React.Component<DevelopersPageProps, Develop
colors.white
} 50%, ${colors.white} 100%)`}
>
<DocumentTitle title="0x Docs DevelopersPage" />
<DocumentTitle title="0x Docs" />
<Container className="flex mx-auto" height="100vh">
<Container
className="sm-hide xs-hide relative"
@ -96,28 +162,9 @@ export class DevelopersPage extends React.Component<DevelopersPageProps, Develop
<DocsLogo height={36} />
</Container>
</Container>
<div
style={{
...scrollableContainerStyles,
paddingTop: 27,
overflow: this.state.isHoveringSidebar ? 'auto' : 'hidden',
}}
onMouseEnter={this._onSidebarHover.bind(this, true)}
onMouseLeave={this._onSidebarHover.bind(this, false)}
onWheel={this._throttledSidebarScrolling}
>
<div
style={{
paddingBottom: 100,
paddingLeft: sidebarPadding,
paddingRight: this.state.isHoveringSidebar
? sidebarPadding - SCROLLER_WIDTH
: sidebarPadding,
}}
>
<SidebarContainer onWheel={this._throttledSidebarScrolling}>
{this.props.screenWidth !== ScreenWidths.Sm && this.props.sidebar}
</div>
</div>
</SidebarContainer>
</Container>
<Container
className="relative"
@ -133,43 +180,14 @@ export class DevelopersPage extends React.Component<DevelopersPageProps, Develop
sidebar={this.props.sidebar}
/>
</Container>
<div
id={sharedConstants.SCROLL_CONTAINER_ID}
className="absolute"
style={{
...scrollableContainerStyles,
paddingTop: 0,
paddingLeft: mainContentPadding,
paddingRight: this.state.isHoveringMainContent
? mainContentPadding - SCROLLER_WIDTH
: mainContentPadding,
overflow: this.state.isHoveringMainContent ? 'auto' : 'hidden',
}}
onMouseEnter={this._onMainContentHover.bind(this, true)}
onMouseOver={this._onMainContentHover.bind(this, true)}
onMouseLeave={this._onMainContentHover.bind(this, false)}
>
<MainContentContainer id={sharedConstants.SCROLL_CONTAINER_ID}>
{this.props.mainContent}
</div>
</MainContentContainer>
</Container>
</Container>
</Container>
);
}
private _onSidebarHover(isHovering: boolean, _event: React.FormEvent<HTMLInputElement>): void {
if (isHovering !== this.state.isHoveringSidebar) {
this.setState({
isHoveringSidebar: isHovering,
});
}
}
private _onMainContentHover(isHovering: boolean, _event: React.FormEvent<HTMLInputElement>): void {
if (isHovering !== this.state.isHoveringMainContent) {
this.setState({
isHoveringMainContent: isHovering,
});
}
}
private _onSidebarScroll(_event: React.FormEvent<HTMLInputElement>): void {
this.setState({
isSidebarScrolling: true,

View File

@ -37,9 +37,9 @@ const TUTORIALS: TutorialInfo[] = [
},
{
iconUrl: '/images/developers/tutorials/use_shared_liquidity.svg',
description: Key.UseSharedLiquidityDescription,
description: Key.UseNetworkedLiquidityDescription,
link: {
title: Key.UseSharedLiquidity,
title: Key.UseNetworkedLiquidity,
to: `${WebsitePaths.Wiki}#Find,-Submit,-Fill-Order-From-Relayer`,
},
},
@ -194,7 +194,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
},
{
description:
"ERCdex's Javascript SDK for trading on their relayer, as well as other Aquaduct partner relayers",
"ERCdEX's Javascript SDK for trading on their relayer, as well as other Aquaduct partner relayers",
link: {
title: 'Aquaduct',
to: 'https://www.npmjs.com/package/aqueduct',
@ -219,26 +219,26 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
},
},
{
description: "The ERC dEX Trade Widget let's any website provide token liquidity to it's users",
description: "The ERCdEX Trade Widget let's any website provide token liquidity to it's users",
link: {
to: 'https://github.com/ERCdEX/widget',
title: 'ERCdex Widget',
title: 'ERCdEX Widget',
shouldOpenInNewTab: true,
},
},
{
description: "ERCdex's Java SDK for trading on their relayer, as well as other Aquaduct partner relayers",
description: "ERCdEX's Java SDK for trading on their relayer, as well as other Aquaduct partner relayers",
link: {
to: 'https://github.com/ERCdEX/java',
title: 'ERCdex Java SDK',
title: 'ERCdEX Java SDK',
shouldOpenInNewTab: true,
},
},
{
description: "ERCdex's Python SDK for trading on their relayer, as well as other Aquaduct partner relayers",
description: "ERCdEX's Python SDK for trading on their relayer, as well as other Aquaduct partner relayers",
link: {
to: 'https://github.com/ERCdEX/python',
title: 'ERCdex Python SDK',
title: 'ERCdEX Python SDK',
shouldOpenInNewTab: true,
},
},

View File

@ -73,10 +73,14 @@ export class Wiki extends React.Component<WikiProps, WikiState> {
{this._renderWikiArticles()}
</div>
);
const isSmallScreen = this.props.screenWidth === ScreenWidths.Sm;
const sidebar = _.isUndefined(this.state.articlesBySection) ? (
<div />
) : (
<NestedSidebarMenu sidebarHeader={this._renderSidebarHeader()} sectionNameToLinks={sectionNameToLinks} />
<NestedSidebarMenu
sidebarHeader={isSmallScreen ? this._renderSidebarHeader() : undefined}
sectionNameToLinks={sectionNameToLinks}
/>
);
return (
<DevelopersPage

View File

@ -468,8 +468,8 @@ export enum Key {
DevelopOnEthereumDescription = 'DEVELOP_ON_ETHEREUM_DESCRIPTION',
OrderBasics = 'ORDER_BASICS',
OrderBasicsDescription = 'ORDER_BASICS_DESCRIPTION',
UseSharedLiquidity = 'USE_SHARED_LIQUIDITY',
UseSharedLiquidityDescription = 'USE_SHARED_LIQUIDITY_DESCRIPTION',
UseNetworkedLiquidity = 'USE_NETWORKED_LIQUIDITY',
UseNetworkedLiquidityDescription = 'USE_NETWORKED_LIQUIDITY_DESCRIPTION',
ViewAllDocumentation = 'VIEW_ALL_DOCUMENTATION',
Sandbox = 'SANDBOX',
Github = 'GITHUB',
@ -590,6 +590,8 @@ export enum BrowserType {
Chrome = 'Chrome',
Firefox = 'Firefox',
Opera = 'Opera',
Safari = 'Safari',
Edge = 'Edge',
Other = 'Other',
}

View File

@ -413,6 +413,10 @@ export const utils = {
return BrowserType.Firefox;
} else if (bowser.opera) {
return BrowserType.Opera;
} else if (bowser.msedge) {
return BrowserType.Edge;
} else if (bowser.safari) {
return BrowserType.Safari;
} else {
return BrowserType.Other;
}

113
yarn.lock
View File

@ -1112,12 +1112,35 @@
call-me-maybe "^1.0.1"
glob-to-regexp "^0.3.0"
"@samverschueren/stream-to-observable@^0.3.0":
version "0.3.0"
resolved "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f"
dependencies:
any-observable "^0.3.0"
"@sinonjs/formatio@^2.0.0":
version "2.0.0"
resolved "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz#84db7e9eb5531df18a8c5e0bfb6e449e55e654b2"
dependencies:
samsam "1.3.0"
"@static/discharge@^1.2.2":
version "1.2.2"
resolved "https://registry.npmjs.org/@static/discharge/-/discharge-1.2.2.tgz#dc941e0c02c421b338b83ac2e59e140d7214c971"
dependencies:
aws-sdk "^2.304.0"
execa "^1.0.0"
glob "^7.1.3"
inquirer "^6.2.0"
listr "^0.14.1"
lodash.differenceby "^4.8.0"
lodash.intersectionby "^4.7.0"
lodash.intersectionwith "^4.4.0"
log-symbols "^2.2.0"
meow "^5.0.0"
mime "^2.3.1"
update-notifier "^2.5.0"
"@types/accounting@^0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@types/accounting/-/accounting-0.4.1.tgz#865d9f5694fd7c438fba34eb4bc82eec6f34cdd5"
@ -1977,6 +2000,10 @@ antlr4@4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.7.0.tgz#297f956ddc06f83397fc0990ecf2e0cf20bfbbee"
any-observable@^0.3.0:
version "0.3.0"
resolved "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b"
any-promise@1.3.0, any-promise@^1.0.0, any-promise@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
@ -2270,6 +2297,20 @@ aws-sdk@^2.127.0:
uuid "3.1.0"
xml2js "0.4.19"
aws-sdk@^2.304.0:
version "2.338.0"
resolved "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.338.0.tgz#f1b1347f78defa27b92b030b5787fad0f89ac83b"
dependencies:
buffer "4.9.1"
events "1.1.1"
ieee754 "1.1.8"
jmespath "0.15.0"
querystring "0.2.0"
sax "1.2.1"
url "0.10.3"
uuid "3.1.0"
xml2js "0.4.19"
aws-sign2@~0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f"
@ -7003,6 +7044,17 @@ glob@^5.0.15:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.1.3:
version "7.1.3"
resolved "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@~3.1.21:
version "3.1.21"
resolved "https://registry.yarnpkg.com/glob/-/glob-3.1.21.tgz#d29e0a055dea5138f4d07ed40e8982e83c2066cd"
@ -8156,6 +8208,12 @@ is-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470"
is-observable@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/is-observable/-/is-observable-1.1.0.tgz#b3e986c8f44de950867cab5403f5a3465005975e"
dependencies:
symbol-observable "^1.1.0"
is-odd@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-2.0.0.tgz#7646624671fd7ea558ccd9a2795182f2958f1b24"
@ -9335,6 +9393,19 @@ listr-update-renderer@^0.2.0:
log-update "^1.0.2"
strip-ansi "^3.0.1"
listr-update-renderer@^0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.4.0.tgz#344d980da2ca2e8b145ba305908f32ae3f4cc8a7"
dependencies:
chalk "^1.1.3"
cli-truncate "^0.2.1"
elegant-spinner "^1.0.1"
figures "^1.7.0"
indent-string "^3.0.0"
log-symbols "^1.0.2"
log-update "^1.0.2"
strip-ansi "^3.0.1"
listr-verbose-renderer@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#8206f4cf6d52ddc5827e5fd14989e0e965933a35"
@ -9365,6 +9436,20 @@ listr@^0.12.0:
stream-to-observable "^0.1.0"
strip-ansi "^3.0.1"
listr@^0.14.1:
version "0.14.2"
resolved "https://registry.npmjs.org/listr/-/listr-0.14.2.tgz#cbe44b021100a15376addfc2d79349ee430bfe14"
dependencies:
"@samverschueren/stream-to-observable" "^0.3.0"
is-observable "^1.1.0"
is-promise "^2.1.0"
is-stream "^1.1.0"
listr-silent-renderer "^1.1.1"
listr-update-renderer "^0.4.0"
listr-verbose-renderer "^0.4.0"
p-map "^1.1.1"
rxjs "^6.1.0"
load-json-file@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0"
@ -9994,6 +10079,20 @@ meow@^4.0.0:
redent "^2.0.0"
trim-newlines "^2.0.0"
meow@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4"
dependencies:
camelcase-keys "^4.0.0"
decamelize-keys "^1.0.0"
loud-rejection "^1.0.0"
minimist-options "^3.0.1"
normalize-package-data "^2.3.4"
read-pkg-up "^3.0.0"
redent "^2.0.0"
trim-newlines "^2.0.0"
yargs-parser "^10.0.0"
merge-descriptors@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
@ -12427,9 +12526,9 @@ react-router@^4.2.0:
prop-types "^15.5.4"
warning "^3.0.0"
react-scroll@0xproject/react-scroll#similar-to-pr-330-but-with-replace-state:
version "1.7.10"
resolved "https://codeload.github.com/0xproject/react-scroll/tar.gz/0f625b270d7e966313cac8b811c0ae807b37e170"
react-scroll@0xproject/react-scroll#pr-330-and-replace-state:
version "1.7.11"
resolved "https://codeload.github.com/0xproject/react-scroll/tar.gz/d2afc2729dc09980e4113d8c38a1b012ba180d81"
dependencies:
lodash.throttle "^4.1.1"
prop-types "^15.5.8"
@ -15352,7 +15451,7 @@ upath@^1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.4.tgz#ee2321ba0a786c50973db043a50b7bcba822361d"
update-notifier@^2.3.0:
update-notifier@^2.3.0, update-notifier@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.5.0.tgz#d0744593e13f161e406acb1d9408b72cad08aff6"
dependencies:
@ -16131,8 +16230,8 @@ websocket@^1.0.24, websocket@^1.0.25:
yaeti "^0.0.6"
"websocket@git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible":
version "1.0.24"
resolved "git://github.com/frozeman/WebSocket-Node.git#7004c39c42ac98875ab61126e5b4a925430f592c"
version "1.0.26"
resolved "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"
dependencies:
debug "^2.2.0"
nan "^2.3.3"
@ -16440,7 +16539,7 @@ yallist@^3.0.0, yallist@^3.0.2:
version "3.0.2"
resolved "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9"
yargs-parser@10.x, yargs-parser@^10.1.0:
yargs-parser@10.x, yargs-parser@^10.0.0, yargs-parser@^10.1.0:
version "10.1.0"
resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8"
dependencies: