From e744e4cd989bd3ae1070c59f7baa8097f18b8b06 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 22 Dec 2017 15:05:32 +0100 Subject: Apply prettier config --- packages/website/ts/components/order_json.tsx | 115 +++++++++++++++----------- 1 file changed, 67 insertions(+), 48 deletions(-) (limited to 'packages/website/ts/components/order_json.tsx') diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx index 21ec9ba93..bd462b42a 100644 --- a/packages/website/ts/components/order_json.tsx +++ b/packages/website/ts/components/order_json.tsx @@ -3,12 +3,12 @@ import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import TextField from 'material-ui/TextField'; import * as React from 'react'; -import {CopyIcon} from 'ts/components/ui/copy_icon'; -import {SideToAssetToken, SignatureData, TokenByAddress, WebsitePaths} from 'ts/types'; -import {configs} from 'ts/utils/configs'; -import {constants} from 'ts/utils/constants'; -import {errorReporter} from 'ts/utils/error_reporter'; -import {utils} from 'ts/utils/utils'; +import { CopyIcon } from 'ts/components/ui/copy_icon'; +import { SideToAssetToken, SignatureData, TokenByAddress, WebsitePaths } from 'ts/types'; +import { configs } from 'ts/utils/configs'; +import { constants } from 'ts/utils/constants'; +import { errorReporter } from 'ts/utils/error_reporter'; +import { utils } from 'ts/utils/utils'; interface OrderJSONProps { exchangeContractIfExists: string; @@ -39,69 +39,75 @@ export class OrderJSON extends React.Component { this._setShareLinkAsync(); } public render() { - const order = utils.generateOrder(this.props.networkId, this.props.exchangeContractIfExists, - this.props.sideToAssetToken, this.props.orderExpiryTimestamp, - this.props.orderTakerAddress, this.props.orderMakerAddress, - this.props.orderMakerFee, this.props.orderTakerFee, - this.props.orderFeeRecipient, this.props.orderSignatureData, - this.props.tokenByAddress, this.props.orderSalt); + const order = utils.generateOrder( + this.props.networkId, + this.props.exchangeContractIfExists, + this.props.sideToAssetToken, + this.props.orderExpiryTimestamp, + this.props.orderTakerAddress, + this.props.orderMakerAddress, + this.props.orderMakerFee, + this.props.orderTakerFee, + this.props.orderFeeRecipient, + this.props.orderSignatureData, + this.props.tokenByAddress, + this.props.orderSalt, + ); const orderJSON = JSON.stringify(order); return (
- You have successfully generated and cryptographically signed an order! The{' '} - following JSON contains the order parameters and cryptographic signature that{' '} - your counterparty will need to execute a trade with you. + You have successfully generated and cryptographically signed an order! The following JSON contains + the order parameters and cryptographic signature that your counterparty will need to execute a trade + with you.
-
+
+
Share your signed order!
- Share your signed order! -
-
-
- +
+
-
+
-
+
@@ -116,14 +122,17 @@ export class OrderJSON extends React.Component { window.open(`https://twitter.com/intent/tweet?text=${tweetText}`, 'Share your order', 'width=500,height=400'); } private async _shareViaFacebook() { - (window as any).FB.ui({ - display: 'popup', - href: this.state.shareLink, - method: 'share', - }, _.noop); + (window as any).FB.ui( + { + display: 'popup', + href: this.state.shareLink, + method: 'share', + }, + _.noop, + ); } private async _shareViaEmailAsync() { - const encodedSubject = encodeURIComponent('Let\'s trade using the 0x protocol'); + const encodedSubject = encodeURIComponent("Let's trade using the 0x protocol"); const encodedBody = encodeURIComponent(`I generated an order with the 0x protocol. You can see and fill it here: ${this.state.shareLink}`); const mailToLink = `mailto:mail@example.org?subject=${encodedSubject}&body=${encodedBody}`; @@ -137,8 +146,9 @@ You can see and fill it here: ${this.state.shareLink}`); } private async _generateShareLinkAsync(): Promise { const longUrl = encodeURIComponent(this._getOrderUrl()); - const bitlyRequestUrl = - `${constants.URL_BITLY_API}/v3/shorten?access_token=${configs.BITLY_ACCESS_TOKEN}&longUrl=${longUrl}`; + const bitlyRequestUrl = `${constants.URL_BITLY_API}/v3/shorten?access_token=${ + configs.BITLY_ACCESS_TOKEN + }&longUrl=${longUrl}`; const response = await fetch(bitlyRequestUrl); const responseBody = await response.text(); const bodyObj = JSON.parse(responseBody); @@ -148,14 +158,23 @@ You can see and fill it here: ${this.state.shareLink}`); await errorReporter.reportAsync(new Error(`Bitly returned non-200: ${JSON.stringify(response)}`)); return ''; } - return (bodyObj).data.url; + return bodyObj.data.url; } private _getOrderUrl() { - const order = utils.generateOrder(this.props.networkId, this.props.exchangeContractIfExists, - this.props.sideToAssetToken, this.props.orderExpiryTimestamp, this.props.orderTakerAddress, - this.props.orderMakerAddress, this.props.orderMakerFee, this.props.orderTakerFee, - this.props.orderFeeRecipient, this.props.orderSignatureData, this.props.tokenByAddress, - this.props.orderSalt); + const order = utils.generateOrder( + this.props.networkId, + this.props.exchangeContractIfExists, + this.props.sideToAssetToken, + this.props.orderExpiryTimestamp, + this.props.orderTakerAddress, + this.props.orderMakerAddress, + this.props.orderMakerFee, + this.props.orderTakerFee, + this.props.orderFeeRecipient, + this.props.orderSignatureData, + this.props.tokenByAddress, + this.props.orderSalt, + ); const orderJSONString = JSON.stringify(order); const orderUrl = `${configs.BASE_URL}${WebsitePaths.Portal}/fill?order=${orderJSONString}`; return orderUrl; -- cgit v1.2.3