diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-28 12:08:08 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-11-28 12:08:08 +0800 |
commit | 5a59ac4c6b9068fa55168bb072ee782cf3c7cd91 (patch) | |
tree | 89f29601440e401dace6a4ab9886fa608aa1bf20 /packages/website/ts/components | |
parent | 0a19ba3014ac68c1c94fcb376bc1ddb5081db757 (diff) | |
download | dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.tar dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.tar.gz dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.tar.bz2 dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.tar.lz dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.tar.xz dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.tar.zst dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.zip |
fix remaining tslint errors
Diffstat (limited to 'packages/website/ts/components')
55 files changed, 314 insertions, 291 deletions
diff --git a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx index 2e12fc889..963bd4388 100644 --- a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx +++ b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx @@ -1,12 +1,12 @@ import * as _ from 'lodash'; -import * as React from 'react'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; import {colors} from 'material-ui/styles'; -import {constants} from 'ts/utils/constants'; -import {configs} from 'ts/utils/configs'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; import {BlockchainErrs} from 'ts/types'; +import {configs} from 'ts/utils/configs'; +import {constants} from 'ts/utils/constants'; interface BlockchainErrDialogProps { blockchain: Blockchain; @@ -21,6 +21,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp public render() { const dialogActions = [ <FlatButton + key="blockchainErrOk" label="Ok" primary={true} onTouchTap={this.props.toggleDialogFn.bind(this.props.toggleDialogFn, false)} diff --git a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx index 1db85e375..aba5b9faf 100644 --- a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx +++ b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx @@ -1,12 +1,12 @@ -import * as React from 'react'; +import BigNumber from 'bignumber.js'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; -import RadioButtonGroup from 'material-ui/RadioButton/RadioButtonGroup'; import RadioButton from 'material-ui/RadioButton'; -import {Side, Token, TokenState} from 'ts/types'; -import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; +import RadioButtonGroup from 'material-ui/RadioButton/RadioButtonGroup'; +import * as React from 'react'; import {EthAmountInput} from 'ts/components/inputs/eth_amount_input'; -import BigNumber from 'bignumber.js'; +import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; +import {Side, Token, TokenState} from 'ts/types'; interface EthWethConversionDialogProps { onComplete: (direction: Side, value: BigNumber) => void; diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index f89935500..d3c95a011 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -1,24 +1,24 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; -import {colors} from 'material-ui/styles'; +import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; -import TextField from 'material-ui/TextField'; +import {colors} from 'material-ui/styles'; import { Table, TableBody, TableHeader, - TableRow, TableHeaderColumn, + TableRow, TableRowColumn, } from 'material-ui/Table'; +import TextField from 'material-ui/TextField'; +import * as React from 'react'; import ReactTooltip = require('react-tooltip'); -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; import {Blockchain} from 'ts/blockchain'; -import {Dispatcher} from 'ts/redux/dispatcher'; import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const VALID_ETHEREUM_DERIVATION_PATH_PREFIX = `44'/60'`; @@ -59,6 +59,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, public render() { const dialogActions = [ <FlatButton + key="ledgerConnectCancel" label="Cancel" onTouchTap={this.onClose.bind(this)} />, diff --git a/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx b/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx index 8f870b42f..1d90624ee 100644 --- a/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx +++ b/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {constants} from 'ts/utils/constants'; interface PortalDisclaimerDialogProps { @@ -16,6 +16,7 @@ export function PortalDisclaimerDialog(props: PortalDisclaimerDialogProps) { titleStyle={{fontWeight: 100}} actions={[ <FlatButton + key="portalAgree" label="I Agree" onTouchTap={props.onToggleDialog.bind(this)} />, diff --git a/packages/website/ts/components/dialogs/send_dialog.tsx b/packages/website/ts/components/dialogs/send_dialog.tsx index 10417a326..31afc3386 100644 --- a/packages/website/ts/components/dialogs/send_dialog.tsx +++ b/packages/website/ts/components/dialogs/send_dialog.tsx @@ -1,14 +1,14 @@ -import * as React from 'react'; +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; -import RadioButtonGroup from 'material-ui/RadioButton/RadioButtonGroup'; import RadioButton from 'material-ui/RadioButton'; -import {Side, Token, TokenState} from 'ts/types'; -import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; -import {EthAmountInput} from 'ts/components/inputs/eth_amount_input'; +import RadioButtonGroup from 'material-ui/RadioButton/RadioButtonGroup'; +import * as React from 'react'; import {AddressInput} from 'ts/components/inputs/address_input'; -import BigNumber from 'bignumber.js'; +import {EthAmountInput} from 'ts/components/inputs/eth_amount_input'; +import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; +import {Side, Token, TokenState} from 'ts/types'; interface SendDialogProps { onComplete: (recipient: string, value: BigNumber) => void; diff --git a/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx b/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx index 97c654656..70c7d1ab6 100644 --- a/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx +++ b/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx @@ -1,14 +1,14 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; -import {constants} from 'ts/utils/constants'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; -import {Dispatcher} from 'ts/redux/dispatcher'; import {TrackTokenConfirmation} from 'ts/components/track_token_confirmation'; import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; +import {Dispatcher} from 'ts/redux/dispatcher'; import {Token, TokenByAddress} from 'ts/types'; +import {constants} from 'ts/utils/constants'; interface TrackTokenConfirmationDialogProps { tokens: Token[]; @@ -41,10 +41,12 @@ export class TrackTokenConfirmationDialog extends titleStyle={{fontWeight: 100}} actions={[ <FlatButton + key="trackNo" label="No" onTouchTap={this.onTrackConfirmationRespondedAsync.bind(this, false)} />, <FlatButton + key="trackYes" label="Yes" onTouchTap={this.onTrackConfirmationRespondedAsync.bind(this, true)} />, diff --git a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx index 28c24cdbe..09c32c997 100644 --- a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx +++ b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {constants} from 'ts/utils/constants'; interface U2fNotSupportedDialogProps { @@ -16,6 +16,7 @@ export function U2fNotSupportedDialog(props: U2fNotSupportedDialogProps) { titleStyle={{fontWeight: 100}} actions={[ <FlatButton + key="u2fNo" label="Ok" onTouchTap={props.onToggleDialog.bind(this)} />, diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx index fd8b713f4..a83b1543f 100644 --- a/packages/website/ts/components/eth_weth_conversion_button.tsx +++ b/packages/website/ts/components/eth_weth_conversion_button.tsx @@ -1,16 +1,15 @@ -import * as _ from 'lodash'; import {ZeroEx} from '0x.js'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; -import {BlockchainCallErrs, TokenState} from 'ts/types'; +import * as React from 'react'; +import {Blockchain} from 'ts/blockchain'; import {EthWethConversionDialog} from 'ts/components/dialogs/eth_weth_conversion_dialog'; -import {Side, Token} from 'ts/types'; -import {constants} from 'ts/utils/constants'; -import {utils} from 'ts/utils/utils'; import {Dispatcher} from 'ts/redux/dispatcher'; +import {BlockchainCallErrs, Side, Token, TokenState} from 'ts/types'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; -import {Blockchain} from 'ts/blockchain'; +import {utils} from 'ts/utils/utils'; interface EthWethConversionButtonProps { ethToken: Token; diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index 0d652d33f..388c72d8e 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -1,44 +1,44 @@ -import * as _ from 'lodash'; -import * as React from 'react'; +import {Order as ZeroExOrder, ZeroEx} from '0x.js'; import * as accounting from 'accounting'; -import {Link} from 'react-router-dom'; -import {ZeroEx, Order as ZeroExOrder} from '0x.js'; -import * as moment from 'moment'; import BigNumber from 'bignumber.js'; -import Paper from 'material-ui/Paper'; -import {Card, CardText, CardHeader} from 'material-ui/Card'; +import * as _ from 'lodash'; +import {Card, CardHeader, CardText} from 'material-ui/Card'; import Divider from 'material-ui/Divider'; -import TextField from 'material-ui/TextField'; +import Paper from 'material-ui/Paper'; import RaisedButton from 'material-ui/RaisedButton'; -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; +import TextField from 'material-ui/TextField'; +import * as moment from 'moment'; +import * as React from 'react'; +import {Link} from 'react-router-dom'; +import {Blockchain} from 'ts/blockchain'; +import {TrackTokenConfirmationDialog} from 'ts/components/dialogs/track_token_confirmation_dialog'; +import {FillOrderJSON} from 'ts/components/fill_order_json'; +import {FillWarningDialog} from 'ts/components/fill_warning_dialog'; +import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; +import {Alert} from 'ts/components/ui/alert'; +import {EthereumAddress} from 'ts/components/ui/ethereum_address'; +import {Identicon} from 'ts/components/ui/identicon'; +import {VisualOrder} from 'ts/components/visual_order'; +import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {orderSchema} from 'ts/schemas/order_schema'; +import {SchemaValidator} from 'ts/schemas/validator'; import { - Side, - TokenByAddress, - TokenStateByAddress, - Order, + AlertTypes, BlockchainErrs, + ContractResponse, + ExchangeContractErrs, + Order, OrderToken, + Side, Token, - ExchangeContractErrs, - AlertTypes, - ContractResponse, + TokenByAddress, + TokenStateByAddress, WebsitePaths, } from 'ts/types'; -import {Alert} from 'ts/components/ui/alert'; -import {Identicon} from 'ts/components/ui/identicon'; -import {EthereumAddress} from 'ts/components/ui/ethereum_address'; -import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; -import {FillWarningDialog} from 'ts/components/fill_warning_dialog'; -import {FillOrderJSON} from 'ts/components/fill_order_json'; -import {VisualOrder} from 'ts/components/visual_order'; -import {SchemaValidator} from 'ts/schemas/validator'; -import {orderSchema} from 'ts/schemas/order_schema'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {Blockchain} from 'ts/blockchain'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; -import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; -import {TrackTokenConfirmationDialog} from 'ts/components/dialogs/track_token_confirmation_dialog'; +import {utils} from 'ts/utils/utils'; const CUSTOM_LIGHT_GRAY = '#BBBBBB'; @@ -100,6 +100,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { } public componentWillMount() { if (!_.isEmpty(this.state.orderJSON)) { + // tslint:disable-next-line:no-floating-promises this.validateFillOrderFireAndForgetAsync(this.state.orderJSON); } } @@ -351,6 +352,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { isFillWarningDialogOpen: true, }); } else { + // tslint:disable-next-line:no-floating-promises this.onFillOrderClickFireAndForgetAsync(); } } @@ -359,6 +361,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { isFillWarningDialogOpen: false, }); if (!didUserCancel) { + // tslint:disable-next-line:no-floating-promises this.onFillOrderClickFireAndForgetAsync(); } } @@ -371,6 +374,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { didOrderValidationRun: _.isEmpty(orderJSON) && _.isEmpty(this.state.orderJSONErrMsg), didFillOrderSucceed: false, }); + // tslint:disable-next-line:no-floating-promises this.validateFillOrderFireAndForgetAsync(orderJSON); } private async checkForUntrackedTokensAndAskToAdd() { @@ -563,7 +567,9 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { await this.props.blockchain.validateFillOrderThrowIfInvalidAsync( signedOrder, takerFillAmount, this.props.userAddress); } catch (err) { - globalErrMsg = this.props.blockchain.zeroExErrToHumanReadableErrMsg(err.message, parsedOrder.taker.address); + globalErrMsg = utils.zeroExErrToHumanReadableErrMsg( + err.message, parsedOrder.taker.address, + ); } } if (!_.isEmpty(globalErrMsg)) { @@ -652,7 +658,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { await this.props.blockchain.validateCancelOrderThrowIfInvalidAsync( signedOrder, availableTakerTokenAmount); } catch (err) { - globalErrMsg = this.props.blockchain.zeroExErrToHumanReadableErrMsg(err.message, parsedOrder.taker.address); + globalErrMsg = utils.zeroExErrToHumanReadableErrMsg(err.message, parsedOrder.taker.address); } if (!_.isEmpty(globalErrMsg)) { this.setState({ @@ -711,4 +717,4 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { tokensToTrack: [], }); } -} +} // tslint:disable:max-file-line-count diff --git a/packages/website/ts/components/fill_order_json.tsx b/packages/website/ts/components/fill_order_json.tsx index b355d910b..f4db1f74e 100644 --- a/packages/website/ts/components/fill_order_json.tsx +++ b/packages/website/ts/components/fill_order_json.tsx @@ -1,13 +1,13 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import BigNumber from 'bignumber.js'; import {ZeroEx} from '0x.js'; +import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import TextField from 'material-ui/TextField'; -import {Side, TokenByAddress} from 'ts/types'; -import {utils} from 'ts/utils/utils'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; +import {Side, TokenByAddress} from 'ts/types'; import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; interface FillOrderJSONProps { blockchain: Blockchain; diff --git a/packages/website/ts/components/fill_warning_dialog.tsx b/packages/website/ts/components/fill_warning_dialog.tsx index 029fa8b0c..83e46cc8f 100644 --- a/packages/website/ts/components/fill_warning_dialog.tsx +++ b/packages/website/ts/components/fill_warning_dialog.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; interface FillWarningDialogProps { isOpen: boolean; @@ -16,10 +16,12 @@ export function FillWarningDialog(props: FillWarningDialogProps) { titleStyle={{fontWeight: 100, color: colors.red500}} actions={[ <FlatButton + key="fillWarningCancel" label="Cancel" onTouchTap={props.onToggleDialog.bind(this, didCancel)} />, <FlatButton + key="fillWarningContinue" label="Fill Order" onTouchTap={props.onToggleDialog.bind(this, !didCancel)} />, diff --git a/packages/website/ts/components/flash_messages/token_send_completed.tsx b/packages/website/ts/components/flash_messages/token_send_completed.tsx index c4977d70b..fef7520f6 100644 --- a/packages/website/ts/components/flash_messages/token_send_completed.tsx +++ b/packages/website/ts/components/flash_messages/token_send_completed.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import * as _ from 'lodash'; -import BigNumber from 'bignumber.js'; import {ZeroEx} from '0x.js'; +import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; +import * as React from 'react'; import {Token} from 'ts/types'; import {utils} from 'ts/utils/utils'; diff --git a/packages/website/ts/components/flash_messages/transaction_submitted.tsx b/packages/website/ts/components/flash_messages/transaction_submitted.tsx index 7a3cc6e86..cef3e2b1e 100644 --- a/packages/website/ts/components/flash_messages/transaction_submitted.tsx +++ b/packages/website/ts/components/flash_messages/transaction_submitted.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import * as _ from 'lodash'; +import * as React from 'react'; interface TransactionSubmittedProps { etherScanLinkIfExists?: string; diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index 99f97292e..f7070e0f8 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -1,13 +1,13 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {HashLink} from 'react-router-hash-link'; -import {Styles, WebsitePaths} from 'ts/types'; import { Link, } from 'react-router-dom'; +import {HashLink} from 'react-router-hash-link'; import { Link as ScrollLink, } from 'react-scroll'; +import {Styles, WebsitePaths} from 'ts/types'; import {constants} from 'ts/utils/constants'; interface MenuItemsBySection { diff --git a/packages/website/ts/components/generate_order/asset_picker.tsx b/packages/website/ts/components/generate_order/asset_picker.tsx index 410b0440a..633d6a017 100644 --- a/packages/website/ts/components/generate_order/asset_picker.tsx +++ b/packages/website/ts/components/generate_order/asset_picker.tsx @@ -1,26 +1,26 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import {colors} from 'material-ui/styles'; import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; import GridList from 'material-ui/GridList/GridList'; import GridTile from 'material-ui/GridList/GridTile'; -import FlatButton from 'material-ui/FlatButton'; -import {utils} from 'ts/utils/utils'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; +import {NewTokenForm} from 'ts/components/generate_order/new_token_form'; +import {TrackTokenConfirmation} from 'ts/components/track_token_confirmation'; +import {TokenIcon} from 'ts/components/ui/token_icon'; +import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; import {Dispatcher} from 'ts/redux/dispatcher'; import { - Token, AssetToken, - TokenByAddress, + DialogConfigs, Styles, + Token, + TokenByAddress, TokenState, - DialogConfigs, TokenVisibility, } from 'ts/types'; -import {NewTokenForm} from 'ts/components/generate_order/new_token_form'; -import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; -import {TrackTokenConfirmation} from 'ts/components/track_token_confirmation'; -import {TokenIcon} from 'ts/components/ui/token_icon'; +import {utils} from 'ts/utils/utils'; const TOKEN_ICON_DIMENSION = 100; const TILE_DIMENSION = 146; diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx index e9026d9bc..72edf08cf 100644 --- a/packages/website/ts/components/generate_order/generate_order_form.tsx +++ b/packages/website/ts/components/generate_order/generate_order_form.tsx @@ -1,37 +1,37 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import {ZeroEx, Order} from '0x.js'; +import {Order, ZeroEx} from '0x.js'; import BigNumber from 'bignumber.js'; -import {Blockchain} from 'ts/blockchain'; -import Divider from 'material-ui/Divider'; +import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; +import Divider from 'material-ui/Divider'; import {colors} from 'material-ui/styles'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {utils} from 'ts/utils/utils'; -import {SchemaValidator} from 'ts/schemas/validator'; -import {orderSchema} from 'ts/schemas/order_schema'; -import {Alert} from 'ts/components/ui/alert'; -import {OrderJSON} from 'ts/components/order_json'; +import * as React from 'react'; +import {Blockchain} from 'ts/blockchain'; +import {ExpirationInput} from 'ts/components/inputs/expiration_input'; +import {HashInput} from 'ts/components/inputs/hash_input'; import {IdenticonAddressInput} from 'ts/components/inputs/identicon_address_input'; -import {TokenInput} from 'ts/components/inputs/token_input'; import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; -import {HashInput} from 'ts/components/inputs/hash_input'; -import {ExpirationInput} from 'ts/components/inputs/expiration_input'; -import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; -import {errorReporter} from 'ts/utils/error_reporter'; +import {TokenInput} from 'ts/components/inputs/token_input'; +import {OrderJSON} from 'ts/components/order_json'; +import {Alert} from 'ts/components/ui/alert'; import {HelpTooltip} from 'ts/components/ui/help_tooltip'; +import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; import {SwapIcon} from 'ts/components/ui/swap_icon'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {orderSchema} from 'ts/schemas/order_schema'; +import {SchemaValidator} from 'ts/schemas/validator'; import { + AlertTypes, + BlockchainErrs, + HashData, Side, SideToAssetToken, SignatureData, - HashData, + Token, TokenByAddress, TokenStateByAddress, - BlockchainErrs, - Token, - AlertTypes, } from 'ts/types'; +import {errorReporter} from 'ts/utils/error_reporter'; +import {utils} from 'ts/utils/utils'; enum SigningState { UNSIGNED, diff --git a/packages/website/ts/components/generate_order/new_token_form.tsx b/packages/website/ts/components/generate_order/new_token_form.tsx index 95c05f5bb..7e2c61ae8 100644 --- a/packages/website/ts/components/generate_order/new_token_form.tsx +++ b/packages/website/ts/components/generate_order/new_token_form.tsx @@ -1,15 +1,15 @@ +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; import TextField from 'material-ui/TextField'; -import {constants} from 'ts/utils/constants'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; -import {Token, TokenState, TokenByAddress, AlertTypes} from 'ts/types'; import {AddressInput} from 'ts/components/inputs/address_input'; import {Alert} from 'ts/components/ui/alert'; import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; import {RequiredLabel} from 'ts/components/ui/required_label'; -import BigNumber from 'bignumber.js'; +import {AlertTypes, Token, TokenByAddress, TokenState} from 'ts/types'; +import {constants} from 'ts/utils/constants'; interface NewTokenFormProps { blockchain: Blockchain; diff --git a/packages/website/ts/components/inputs/address_input.tsx b/packages/website/ts/components/inputs/address_input.tsx index 57ad7a5e2..8b03b8d12 100644 --- a/packages/website/ts/components/inputs/address_input.tsx +++ b/packages/website/ts/components/inputs/address_input.tsx @@ -1,8 +1,8 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import {isAddress} from 'ethereum-address'; -import TextField from 'material-ui/TextField'; +import * as _ from 'lodash'; import {colors} from 'material-ui/styles'; +import TextField from 'material-ui/TextField'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; import {RequiredLabel} from 'ts/components/ui/required_label'; diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx index f02112253..4c15ed4a0 100644 --- a/packages/website/ts/components/inputs/allowance_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_toggle.tsx @@ -1,12 +1,12 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import Toggle from 'material-ui/Toggle'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; import {Dispatcher} from 'ts/redux/dispatcher'; -import {Token, TokenState, BalanceErrs} from 'ts/types'; -import {utils} from 'ts/utils/utils'; +import {BalanceErrs, Token, TokenState} from 'ts/types'; import {errorReporter} from 'ts/utils/error_reporter'; +import {utils} from 'ts/utils/utils'; const DEFAULT_ALLOWANCE_AMOUNT_IN_BASE_UNITS = new BigNumber(2).pow(256).minus(1); diff --git a/packages/website/ts/components/inputs/balance_bounded_input.tsx b/packages/website/ts/components/inputs/balance_bounded_input.tsx index 1c8b410a4..7ddefc3b9 100644 --- a/packages/website/ts/components/inputs/balance_bounded_input.tsx +++ b/packages/website/ts/components/inputs/balance_bounded_input.tsx @@ -1,12 +1,12 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; -import {ValidatedBigNumberCallback, InputErrMsg, WebsitePaths} from 'ts/types'; +import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import TextField from 'material-ui/TextField'; +import * as React from 'react'; +import {Link} from 'react-router-dom'; import {RequiredLabel} from 'ts/components/ui/required_label'; -import {colors} from 'material-ui/styles'; +import {InputErrMsg, ValidatedBigNumberCallback, WebsitePaths} from 'ts/types'; import {utils} from 'ts/utils/utils'; -import {Link} from 'react-router-dom'; interface BalanceBoundedInputProps { label?: string; diff --git a/packages/website/ts/components/inputs/eth_amount_input.tsx b/packages/website/ts/components/inputs/eth_amount_input.tsx index ad551e125..5c5e23eef 100644 --- a/packages/website/ts/components/inputs/eth_amount_input.tsx +++ b/packages/website/ts/components/inputs/eth_amount_input.tsx @@ -1,9 +1,9 @@ +import {ZeroEx} from '0x.js'; import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import * as React from 'react'; -import {ZeroEx} from '0x.js'; -import {ValidatedBigNumberCallback} from 'ts/types'; import {BalanceBoundedInput} from 'ts/components/inputs/balance_bounded_input'; +import {ValidatedBigNumberCallback} from 'ts/types'; import {constants} from 'ts/utils/constants'; interface EthAmountInputProps { diff --git a/packages/website/ts/components/inputs/expiration_input.tsx b/packages/website/ts/components/inputs/expiration_input.tsx index 32dcad189..d3d3d258d 100644 --- a/packages/website/ts/components/inputs/expiration_input.tsx +++ b/packages/website/ts/components/inputs/expiration_input.tsx @@ -1,10 +1,10 @@ -import * as React from 'react'; +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import DatePicker from 'material-ui/DatePicker'; import TimePicker from 'material-ui/TimePicker'; -import {utils} from 'ts/utils/utils'; -import BigNumber from 'bignumber.js'; import * as moment from 'moment'; +import * as React from 'react'; +import {utils} from 'ts/utils/utils'; interface ExpirationInputProps { orderExpiryTimestamp: BigNumber; diff --git a/packages/website/ts/components/inputs/hash_input.tsx b/packages/website/ts/components/inputs/hash_input.tsx index 3e42f1d5f..7fadc3c15 100644 --- a/packages/website/ts/components/inputs/hash_input.tsx +++ b/packages/website/ts/components/inputs/hash_input.tsx @@ -1,8 +1,8 @@ +import {Order, ZeroEx} from '0x.js'; import * as React from 'react'; +import ReactTooltip = require('react-tooltip'); import {Blockchain} from 'ts/blockchain'; -import {ZeroEx, Order} from '0x.js'; import {FakeTextField} from 'ts/components/ui/fake_text_field'; -import ReactTooltip = require('react-tooltip'); import {HashData, Styles} from 'ts/types'; import {constants} from 'ts/utils/constants'; diff --git a/packages/website/ts/components/inputs/identicon_address_input.tsx b/packages/website/ts/components/inputs/identicon_address_input.tsx index 6452f5fe9..692a092d9 100644 --- a/packages/website/ts/components/inputs/identicon_address_input.tsx +++ b/packages/website/ts/components/inputs/identicon_address_input.tsx @@ -1,11 +1,11 @@ import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; -import {Identicon} from 'ts/components/ui/identicon'; -import {RequiredLabel} from 'ts/components/ui/required_label'; import {AddressInput} from 'ts/components/inputs/address_input'; +import {Identicon} from 'ts/components/ui/identicon'; import {InputLabel} from 'ts/components/ui/input_label'; +import {RequiredLabel} from 'ts/components/ui/required_label'; interface IdenticonAddressInputProps { initialAddress: string; diff --git a/packages/website/ts/components/inputs/token_amount_input.tsx b/packages/website/ts/components/inputs/token_amount_input.tsx index e19af8984..f39341a4f 100644 --- a/packages/website/ts/components/inputs/token_amount_input.tsx +++ b/packages/website/ts/components/inputs/token_amount_input.tsx @@ -1,11 +1,11 @@ -import * as React from 'react'; -import * as _ from 'lodash'; -import BigNumber from 'bignumber.js'; import {ZeroEx} from '0x.js'; -import {Link} from 'react-router-dom'; +import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import {colors} from 'material-ui/styles'; -import {Token, TokenState, InputErrMsg, ValidatedBigNumberCallback, WebsitePaths} from 'ts/types'; +import * as React from 'react'; +import {Link} from 'react-router-dom'; import {BalanceBoundedInput} from 'ts/components/inputs/balance_bounded_input'; +import {InputErrMsg, Token, TokenState, ValidatedBigNumberCallback, WebsitePaths} from 'ts/types'; interface TokenAmountInputProps { label: string; diff --git a/packages/website/ts/components/inputs/token_input.tsx b/packages/website/ts/components/inputs/token_input.tsx index 2be74d4fd..8daa84650 100644 --- a/packages/website/ts/components/inputs/token_input.tsx +++ b/packages/website/ts/components/inputs/token_input.tsx @@ -1,13 +1,13 @@ import * as _ from 'lodash'; -import * as React from 'react'; import Paper from 'material-ui/Paper'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {AssetToken, Side, TokenByAddress, BlockchainErrs, Token, TokenState} from 'ts/types'; import {AssetPicker} from 'ts/components/generate_order/asset_picker'; import {InputLabel} from 'ts/components/ui/input_label'; import {TokenIcon} from 'ts/components/ui/token_icon'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {AssetToken, BlockchainErrs, Side, Token, TokenByAddress, TokenState} from 'ts/types'; const TOKEN_ICON_DIMENSION = 80; diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx index 90e3543dd..073abe419 100644 --- a/packages/website/ts/components/order_json.tsx +++ b/packages/website/ts/components/order_json.tsx @@ -1,15 +1,15 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; -import {utils} from 'ts/utils/utils'; +import * as _ from 'lodash'; +import Paper from 'material-ui/Paper'; import {colors} from 'material-ui/styles'; -import {constants} from 'ts/utils/constants'; -import {configs} from 'ts/utils/configs'; import TextField from 'material-ui/TextField'; -import Paper from 'material-ui/Paper'; +import * as React from 'react'; import {CopyIcon} from 'ts/components/ui/copy_icon'; -import {SideToAssetToken, SignatureData, Order, TokenByAddress, WebsitePaths} from 'ts/types'; +import {Order, 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; @@ -36,6 +36,7 @@ export class OrderJSON extends React.Component<OrderJSONProps, OrderJSONState> { this.state = { shareLink: '', }; + // tslint:disable-next-line:no-floating-promises this.setShareLinkAsync(); } public render() { @@ -149,7 +150,7 @@ 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 as any).data.url; + return (bodyObj).data.url; } private getOrderUrl() { const order = utils.generateOrder(this.props.networkId, this.props.exchangeContractIfExists, diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx index 3591a347b..62a5d2eac 100644 --- a/packages/website/ts/components/portal.tsx +++ b/packages/website/ts/components/portal.tsx @@ -1,44 +1,44 @@ +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; -import * as React from 'react'; -import * as DocumentTitle from 'react-document-title'; -import {Switch, Route} from 'react-router-dom'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {State} from 'ts/redux/reducer'; -import {utils} from 'ts/utils/utils'; -import {configs} from 'ts/utils/configs'; -import {constants} from 'ts/utils/constants'; import Paper from 'material-ui/Paper'; import RaisedButton from 'material-ui/RaisedButton'; import {colors} from 'material-ui/styles'; -import {GenerateOrderForm} from 'ts/containers/generate_order_form'; -import {TokenBalances} from 'ts/components/token_balances'; +import * as React from 'react'; +import * as DocumentTitle from 'react-document-title'; +import {Route, Switch} from 'react-router-dom'; +import {Blockchain} from 'ts/blockchain'; +import {BlockchainErrDialog} from 'ts/components/dialogs/blockchain_err_dialog'; import {PortalDisclaimerDialog} from 'ts/components/dialogs/portal_disclaimer_dialog'; import {FillOrder} from 'ts/components/fill_order'; -import {Blockchain} from 'ts/blockchain'; -import {SchemaValidator} from 'ts/schemas/validator'; -import {orderSchema} from 'ts/schemas/order_schema'; -import {localStorage} from 'ts/local_storage/local_storage'; +import {Footer} from 'ts/components/footer'; +import {PortalMenu} from 'ts/components/portal_menu'; +import {TokenBalances} from 'ts/components/token_balances'; +import {TopBar} from 'ts/components/top_bar'; import {TradeHistory} from 'ts/components/trade_history/trade_history'; +import {FlashMessage} from 'ts/components/ui/flash_message'; +import {Loading} from 'ts/components/ui/loading'; +import {GenerateOrderForm} from 'ts/containers/generate_order_form'; +import {localStorage} from 'ts/local_storage/local_storage'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {State} from 'ts/redux/reducer'; +import {orderSchema} from 'ts/schemas/order_schema'; +import {SchemaValidator} from 'ts/schemas/validator'; import { - HashData, - TokenByAddress, BlockchainErrs, - Order, Fill, + HashData, + Order, + ScreenWidths, Side, Styles, - ScreenWidths, Token, + TokenByAddress, TokenStateByAddress, WebsitePaths, } from 'ts/types'; -import {TopBar} from 'ts/components/top_bar'; -import {Footer} from 'ts/components/footer'; -import {Loading} from 'ts/components/ui/loading'; -import {PortalMenu} from 'ts/components/portal_menu'; -import {BlockchainErrDialog} from 'ts/components/dialogs/blockchain_err_dialog'; -import BigNumber from 'bignumber.js'; -import {FlashMessage} from 'ts/components/ui/flash_message'; +import {configs} from 'ts/utils/configs'; +import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const THROTTLE_TIMEOUT = 100; @@ -131,16 +131,19 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> { } public componentWillReceiveProps(nextProps: PortalAllProps) { if (nextProps.networkId !== this.state.prevNetworkId) { + // tslint:disable-next-line:no-floating-promises this.blockchain.networkIdUpdatedFireAndForgetAsync(nextProps.networkId); this.setState({ prevNetworkId: nextProps.networkId, }); } if (nextProps.userAddress !== this.state.prevUserAddress) { + // tslint:disable-next-line:no-floating-promises this.blockchain.userAddressUpdatedFireAndForgetAsync(nextProps.userAddress); if (!_.isEmpty(nextProps.userAddress) && nextProps.blockchainIsLoaded) { const tokens = _.values(nextProps.tokenByAddress); + // tslint:disable-next-line:no-floating-promises this.updateBalanceAndAllowanceWithLoadingScreenAsync(tokens); } this.setState({ @@ -148,6 +151,7 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> { }); } if (nextProps.nodeVersion !== this.state.prevNodeVersion) { + // tslint:disable-next-line:no-floating-promises this.blockchain.nodeVersionUpdatedFireAndForgetAsync(nextProps.nodeVersion); } } diff --git a/packages/website/ts/components/portal_menu.tsx b/packages/website/ts/components/portal_menu.tsx index 3b3641729..869df3e71 100644 --- a/packages/website/ts/components/portal_menu.tsx +++ b/packages/website/ts/components/portal_menu.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {MenuItem} from 'ts/components/ui/menu_item'; import {Link} from 'react-router-dom'; +import {MenuItem} from 'ts/components/ui/menu_item'; import {WebsitePaths} from 'ts/types'; export interface PortalMenuProps { diff --git a/packages/website/ts/components/send_button.tsx b/packages/website/ts/components/send_button.tsx index 274ba96a7..da8dd2a9b 100644 --- a/packages/website/ts/components/send_button.tsx +++ b/packages/website/ts/components/send_button.tsx @@ -1,15 +1,15 @@ -import * as _ from 'lodash'; import {ZeroEx} from '0x.js'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; -import {BlockchainCallErrs, Token, TokenState} from 'ts/types'; +import * as React from 'react'; +import {Blockchain} from 'ts/blockchain'; import {SendDialog} from 'ts/components/dialogs/send_dialog'; -import {constants} from 'ts/utils/constants'; -import {utils} from 'ts/utils/utils'; import {Dispatcher} from 'ts/redux/dispatcher'; +import {BlockchainCallErrs, Token, TokenState} from 'ts/types'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; -import {Blockchain} from 'ts/blockchain'; +import {utils} from 'ts/utils/utils'; interface SendButtonProps { token: Token; diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index 2d533a9f2..ae5ef9222 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -1,53 +1,53 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import {ZeroEx} from '0x.js'; +import BigNumber from 'bignumber.js'; import DharmaLoanFrame from 'dharma-loan-frame'; -import {colors} from 'material-ui/styles'; +import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import Divider from 'material-ui/Divider'; import FlatButton from 'material-ui/FlatButton'; -import RaisedButton from 'material-ui/RaisedButton'; import FloatingActionButton from 'material-ui/FloatingActionButton'; +import RaisedButton from 'material-ui/RaisedButton'; +import {colors} from 'material-ui/styles'; import ContentAdd from 'material-ui/svg-icons/content/add'; import ContentRemove from 'material-ui/svg-icons/content/remove'; import { Table, TableBody, TableHeader, - TableRow, TableHeaderColumn, + TableRow, TableRowColumn, } from 'material-ui/Table'; +import QueryString = require('query-string'); +import * as React from 'react'; import ReactTooltip = require('react-tooltip'); -import BigNumber from 'bignumber.js'; import firstBy = require('thenby'); -import QueryString = require('query-string'); +import {Blockchain} from 'ts/blockchain'; +import {EthWethConversionButton} from 'ts/components/eth_weth_conversion_button'; +import {AssetPicker} from 'ts/components/generate_order/asset_picker'; +import {AllowanceToggle} from 'ts/components/inputs/allowance_toggle'; +import {SendButton} from 'ts/components/send_button'; +import {HelpTooltip} from 'ts/components/ui/help_tooltip'; +import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; +import {TokenIcon} from 'ts/components/ui/token_icon'; +import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; import {Dispatcher} from 'ts/redux/dispatcher'; import { - TokenByAddress, - TokenStateByAddress, - Token, - BlockchainErrs, BalanceErrs, - Styles, - ScreenWidths, - EtherscanLinkSuffixes, BlockchainCallErrs, + BlockchainErrs, + EtherscanLinkSuffixes, + ScreenWidths, + Styles, + Token, + TokenByAddress, + TokenStateByAddress, TokenVisibility, } from 'ts/types'; -import {Blockchain} from 'ts/blockchain'; -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; import {configs} from 'ts/utils/configs'; -import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; -import {HelpTooltip} from 'ts/components/ui/help_tooltip'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; -import {AllowanceToggle} from 'ts/components/inputs/allowance_toggle'; -import {EthWethConversionButton} from 'ts/components/eth_weth_conversion_button'; -import {SendButton} from 'ts/components/send_button'; -import {AssetPicker} from 'ts/components/generate_order/asset_picker'; -import {TokenIcon} from 'ts/components/ui/token_icon'; -import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; +import {utils} from 'ts/utils/utils'; const ETHER_ICON_PATH = '/images/ether.png'; const ETHER_TOKEN_SYMBOL = 'WETH'; @@ -665,6 +665,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala isZRXSpinnerVisible: true, currentZrxBalance: zrxTokenState.balance, }); + // tslint:disable-next-line:no-floating-promises this.props.blockchain.pollTokenBalanceAsync(zrxToken); } return true; @@ -696,4 +697,4 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala isAddingToken: false, }); } -} +} // tslint:disable:max-file-line-count diff --git a/packages/website/ts/components/top_bar.tsx b/packages/website/ts/components/top_bar.tsx index 6248095b3..a84f1324d 100644 --- a/packages/website/ts/components/top_bar.tsx +++ b/packages/website/ts/components/top_bar.tsx @@ -1,25 +1,25 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import { - Link as ScrollLink, - animateScroll, -} from 'react-scroll'; -import {Link} from 'react-router-dom'; -import {HashLink} from 'react-router-hash-link'; import AppBar from 'material-ui/AppBar'; import Drawer from 'material-ui/Drawer'; import MenuItem from 'material-ui/MenuItem'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; +import {Link} from 'react-router-dom'; +import {HashLink} from 'react-router-hash-link'; +import { + animateScroll, + Link as ScrollLink, +} from 'react-scroll'; import ReactTooltip = require('react-tooltip'); -import {configs} from 'ts/utils/configs'; -import {constants} from 'ts/utils/constants'; -import {Identicon} from 'ts/components/ui/identicon'; -import {NestedSidebarMenu} from 'ts/pages/shared/nested_sidebar_menu'; -import {typeDocUtils} from 'ts/utils/typedoc_utils'; import {PortalMenu} from 'ts/components/portal_menu'; -import {Styles, TypeDocNode, MenuSubsectionsBySection, WebsitePaths, Docs} from 'ts/types'; import {TopBarMenuItem} from 'ts/components/top_bar_menu_item'; import {DropDownMenuItem} from 'ts/components/ui/drop_down_menu_item'; +import {Identicon} from 'ts/components/ui/identicon'; +import {NestedSidebarMenu} from 'ts/pages/shared/nested_sidebar_menu'; +import {Docs, MenuSubsectionsBySection, Styles, TypeDocNode, WebsitePaths} from 'ts/types'; +import {configs} from 'ts/utils/configs'; +import {constants} from 'ts/utils/constants'; +import {typeDocUtils} from 'ts/utils/typedoc_utils'; const CUSTOM_DARK_GRAY = '#231F20'; const SECTION_HEADER_COLOR = 'rgb(234, 234, 234)'; @@ -135,8 +135,15 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { </a>, ]; const bottomBorderStyle = this.shouldDisplayBottomBar() ? styles.bottomBar : {}; - const fullWithClassNames = isFullWidthPage ? 'pr4' : ''; + const fullWidthClasses = isFullWidthPage ? 'pr4' : ''; const logoUrl = isNightVersion ? '/images/protocol_logo_white.png' : '/images/protocol_logo_black.png'; + const menuClasses = `col col-${isFullWidthPage ? '4' : '5'} ${fullWidthClasses} lg-pr0 md-pr2 sm-hide xs-hide`; + const menuIconStyle = { + fontSize: 25, + color: isNightVersion ? 'white' : 'black', + cursor: 'pointer', + paddingTop: 16, + }; return ( <div style={{...styles.topBar, ...bottomBorderStyle, ...this.props.style}} className="pb1"> <div className={parentClassNames}> @@ -148,7 +155,9 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { <div className={`col col-${isFullWidthPage ? '8' : '9'} lg-hide md-hide`} /> <div className={`col col-${isFullWidthPage ? '6' : '5'} sm-hide xs-hide`} /> {!this.isViewingPortal() && - <div className={`col col-${isFullWidthPage ? '4' : '5'} ${fullWithClassNames} lg-pr0 md-pr2 sm-hide xs-hide`}> + <div + className={menuClasses} + > <div className="flex justify-between"> <DropDownMenuItem title="Developers" @@ -188,9 +197,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { <div className={`col ${isFullWidthPage ? 'col-2 pl2' : 'col-1'} md-hide lg-hide`} > - <div - style={{fontSize: 25, color: isNightVersion ? 'white' : 'black', cursor: 'pointer', paddingTop: 16}} - > + <div style={menuIconStyle}> <i className="zmdi zmdi-menu" onClick={this.onMenuButtonClick.bind(this)} diff --git a/packages/website/ts/components/track_token_confirmation.tsx b/packages/website/ts/components/track_token_confirmation.tsx index bc036eae3..b9b2ef18a 100644 --- a/packages/website/ts/components/track_token_confirmation.tsx +++ b/packages/website/ts/components/track_token_confirmation.tsx @@ -1,11 +1,11 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; -import {utils} from 'ts/utils/utils'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Party} from 'ts/components/ui/party'; import {Token, TokenByAddress} from 'ts/types'; +import {utils} from 'ts/utils/utils'; interface TrackTokenConfirmationProps { tokens: Token[]; diff --git a/packages/website/ts/components/trade_history/trade_history.tsx b/packages/website/ts/components/trade_history/trade_history.tsx index 9deaf8fd8..59f85a03d 100644 --- a/packages/website/ts/components/trade_history/trade_history.tsx +++ b/packages/website/ts/components/trade_history/trade_history.tsx @@ -1,11 +1,11 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import Paper from 'material-ui/Paper'; import Divider from 'material-ui/Divider'; -import {utils} from 'ts/utils/utils'; -import {Fill, TokenByAddress} from 'ts/types'; +import Paper from 'material-ui/Paper'; +import * as React from 'react'; import {TradeHistoryItem} from 'ts/components/trade_history/trade_history_item'; import {tradeHistoryStorage} from 'ts/local_storage/trade_history_storage'; +import {Fill, TokenByAddress} from 'ts/types'; +import {utils} from 'ts/utils/utils'; const FILL_POLLING_INTERVAL = 1000; diff --git a/packages/website/ts/components/trade_history/trade_history_item.tsx b/packages/website/ts/components/trade_history/trade_history_item.tsx index 58bdf84ae..4dcceadb7 100644 --- a/packages/website/ts/components/trade_history/trade_history_item.tsx +++ b/packages/website/ts/components/trade_history/trade_history_item.tsx @@ -1,14 +1,14 @@ -import * as _ from 'lodash'; -import * as React from 'react'; +import {ZeroEx} from '0x.js'; import BigNumber from 'bignumber.js'; -import * as ReactTooltip from 'react-tooltip'; -import * as moment from 'moment'; +import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import {colors} from 'material-ui/styles'; -import {ZeroEx} from '0x.js'; -import {TokenByAddress, Fill, Token, EtherscanLinkSuffixes} from 'ts/types'; -import {Party} from 'ts/components/ui/party'; +import * as moment from 'moment'; +import * as React from 'react'; +import * as ReactTooltip from 'react-tooltip'; import {EtherScanIcon} from 'ts/components/ui/etherscan_icon'; +import {Party} from 'ts/components/ui/party'; +import {EtherscanLinkSuffixes, Fill, Token, TokenByAddress} from 'ts/types'; const PRECISION = 5; const IDENTICON_DIAMETER = 40; diff --git a/packages/website/ts/components/ui/alert.tsx b/packages/website/ts/components/ui/alert.tsx index bf2f0baf5..71d2388f2 100644 --- a/packages/website/ts/components/ui/alert.tsx +++ b/packages/website/ts/components/ui/alert.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {AlertTypes} from 'ts/types'; const CUSTOM_GREEN = 'rgb(137, 199, 116)'; diff --git a/packages/website/ts/components/ui/badge.tsx b/packages/website/ts/components/ui/badge.tsx index 1e3bbdb99..15d5ea227 100644 --- a/packages/website/ts/components/ui/badge.tsx +++ b/packages/website/ts/components/ui/badge.tsx @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Styles} from 'ts/types'; const styles: Styles = { diff --git a/packages/website/ts/components/ui/copy_icon.tsx b/packages/website/ts/components/ui/copy_icon.tsx index f8abaa59e..5f8e6a060 100644 --- a/packages/website/ts/components/ui/copy_icon.tsx +++ b/packages/website/ts/components/ui/copy_icon.tsx @@ -1,8 +1,8 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; -import * as ReactDOM from 'react-dom'; import * as CopyToClipboard from 'react-copy-to-clipboard'; -import {colors} from 'material-ui/styles'; +import * as ReactDOM from 'react-dom'; import ReactTooltip = require('react-tooltip'); interface CopyIconProps { diff --git a/packages/website/ts/components/ui/drop_down_menu_item.tsx b/packages/website/ts/components/ui/drop_down_menu_item.tsx index b8b7eb167..05b88f7ce 100644 --- a/packages/website/ts/components/ui/drop_down_menu_item.tsx +++ b/packages/website/ts/components/ui/drop_down_menu_item.tsx @@ -1,12 +1,12 @@ import * as _ from 'lodash'; +import Menu from 'material-ui/Menu'; +import MenuItem from 'material-ui/MenuItem'; +import Popover from 'material-ui/Popover'; import * as React from 'react'; +import {Link} from 'react-router-dom'; import { Link as ScrollLink, } from 'react-scroll'; -import {Link} from 'react-router-dom'; -import Popover from 'material-ui/Popover'; -import Menu from 'material-ui/Menu'; -import MenuItem from 'material-ui/MenuItem'; import {Styles, WebsitePaths} from 'ts/types'; const CHECK_CLOSE_POPOVER_INTERVAL_MS = 300; diff --git a/packages/website/ts/components/ui/ethereum_address.tsx b/packages/website/ts/components/ui/ethereum_address.tsx index c3d03b78c..b3bc0bc59 100644 --- a/packages/website/ts/components/ui/ethereum_address.tsx +++ b/packages/website/ts/components/ui/ethereum_address.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import {EtherScanIcon} from 'ts/components/ui/etherscan_icon'; import ReactTooltip = require('react-tooltip'); +import {EtherScanIcon} from 'ts/components/ui/etherscan_icon'; import {EtherscanLinkSuffixes} from 'ts/types'; import {utils} from 'ts/utils/utils'; diff --git a/packages/website/ts/components/ui/etherscan_icon.tsx b/packages/website/ts/components/ui/etherscan_icon.tsx index 12044f44b..9b4d172f1 100644 --- a/packages/website/ts/components/ui/etherscan_icon.tsx +++ b/packages/website/ts/components/ui/etherscan_icon.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import ReactTooltip = require('react-tooltip'); -import {colors} from 'material-ui/styles'; import {EtherscanLinkSuffixes} from 'ts/types'; import {utils} from 'ts/utils/utils'; diff --git a/packages/website/ts/components/ui/fake_text_field.tsx b/packages/website/ts/components/ui/fake_text_field.tsx index 372785c2f..90bc47f01 100644 --- a/packages/website/ts/components/ui/fake_text_field.tsx +++ b/packages/website/ts/components/ui/fake_text_field.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {InputLabel} from 'ts/components/ui/input_label'; import {Styles} from 'ts/types'; diff --git a/packages/website/ts/components/ui/flash_message.tsx b/packages/website/ts/components/ui/flash_message.tsx index 684aeef68..ab4edbbb0 100644 --- a/packages/website/ts/components/ui/flash_message.tsx +++ b/packages/website/ts/components/ui/flash_message.tsx @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import * as React from 'react'; import Snackbar from 'material-ui/Snackbar'; +import * as React from 'react'; import {Dispatcher} from 'ts/redux/dispatcher'; const SHOW_DURATION_MS = 4000; diff --git a/packages/website/ts/components/ui/identicon.tsx b/packages/website/ts/components/ui/identicon.tsx index 814548fb4..a741ae43b 100644 --- a/packages/website/ts/components/ui/identicon.tsx +++ b/packages/website/ts/components/ui/identicon.tsx @@ -1,7 +1,7 @@ +import blockies = require('blockies'); import * as _ from 'lodash'; import * as React from 'react'; import {constants} from 'ts/utils/constants'; -import blockies = require('blockies'); interface IdenticonProps { address: string; diff --git a/packages/website/ts/components/ui/input_label.tsx b/packages/website/ts/components/ui/input_label.tsx index 5866c70b6..852097519 100644 --- a/packages/website/ts/components/ui/input_label.tsx +++ b/packages/website/ts/components/ui/input_label.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; export interface InputLabelProps { text: string | Element | React.ReactNode; diff --git a/packages/website/ts/components/ui/labeled_switcher.tsx b/packages/website/ts/components/ui/labeled_switcher.tsx index 3ed8ba0a4..80a8fbe94 100644 --- a/packages/website/ts/components/ui/labeled_switcher.tsx +++ b/packages/website/ts/components/ui/labeled_switcher.tsx @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; const CUSTOM_BLUE = '#63A6F1'; @@ -61,12 +61,9 @@ export class LabeledSwitcher extends React.Component<LabeledSwitcherProps, Label this.setState({ isLeftSelected: isLeft, }); - let didSucceed; - if (isLeft) { - didSucceed = await this.props.onLeftLabelClickAsync(); - } else { - didSucceed = await this.props.onRightLabelClickAsync(); - } + const didSucceed = isLeft ? + await this.props.onLeftLabelClickAsync() : + await this.props.onRightLabelClickAsync(); if (!didSucceed) { this.setState({ isLeftSelected: !isLeft, diff --git a/packages/website/ts/components/ui/lifecycle_raised_button.tsx b/packages/website/ts/components/ui/lifecycle_raised_button.tsx index e93c80ba4..630f71545 100644 --- a/packages/website/ts/components/ui/lifecycle_raised_button.tsx +++ b/packages/website/ts/components/ui/lifecycle_raised_button.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; +import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; -import {utils} from 'ts/utils/utils'; -import {Token} from 'ts/types'; import {Blockchain} from 'ts/blockchain'; -import RaisedButton from 'material-ui/RaisedButton'; +import {Token} from 'ts/types'; +import {utils} from 'ts/utils/utils'; const COMPLETE_STATE_SHOW_LENGTH_MS = 2000; @@ -11,7 +11,7 @@ enum ButtonState { READY, LOADING, COMPLETE, -}; +} interface LifeCycleRaisedButtonProps { isHidden?: boolean; @@ -49,7 +49,7 @@ export class LifeCycleRaisedButton extends this.didUnmount = true; } public render() { - if (this.props.isHidden === true) { + if (this.props.isHidden) { return <span />; } @@ -83,7 +83,7 @@ export class LifeCycleRaisedButton extends this.setState({ buttonState: ButtonState.LOADING, }); - const didSucceed = await this.props.onClickAsyncFn(); + const didSucceed = this.props.onClickAsyncFn(); if (this.didUnmount) { return; // noop since unmount called before async callback returned. } diff --git a/packages/website/ts/components/ui/loading.tsx b/packages/website/ts/components/ui/loading.tsx index 39c119d8f..83636b5ff 100644 --- a/packages/website/ts/components/ui/loading.tsx +++ b/packages/website/ts/components/ui/loading.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; -import * as React from 'react'; import Paper from 'material-ui/Paper'; -import {utils} from 'ts/utils/utils'; +import * as React from 'react'; import {DefaultPlayer as Video} from 'react-html5video'; import 'react-html5video/dist/styles.css'; +import {utils} from 'ts/utils/utils'; interface LoadingProps {} diff --git a/packages/website/ts/components/ui/menu_item.tsx b/packages/website/ts/components/ui/menu_item.tsx index b9caa91fb..862f28457 100644 --- a/packages/website/ts/components/ui/menu_item.tsx +++ b/packages/website/ts/components/ui/menu_item.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import {Link} from 'react-router-dom'; import {Styles} from 'ts/types'; import {constants} from 'ts/utils/constants'; -import {colors} from 'material-ui/styles'; interface MenuItemProps { to: string; diff --git a/packages/website/ts/components/ui/party.tsx b/packages/website/ts/components/ui/party.tsx index b72e75181..2927d9d3d 100644 --- a/packages/website/ts/components/ui/party.tsx +++ b/packages/website/ts/components/ui/party.tsx @@ -1,11 +1,11 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import ReactTooltip = require('react-tooltip'); -import {colors} from 'material-ui/styles'; +import {EthereumAddress} from 'ts/components/ui/ethereum_address'; import {Identicon} from 'ts/components/ui/identicon'; import {EtherscanLinkSuffixes} from 'ts/types'; import {utils} from 'ts/utils/utils'; -import {EthereumAddress} from 'ts/components/ui/ethereum_address'; const MIN_ADDRESS_WIDTH = 60; const IMAGE_DIMENSION = 100; diff --git a/packages/website/ts/components/ui/required_label.tsx b/packages/website/ts/components/ui/required_label.tsx index f9c73157a..db69d7278 100644 --- a/packages/website/ts/components/ui/required_label.tsx +++ b/packages/website/ts/components/ui/required_label.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; export interface RequiredLabelProps { label: string|React.ReactNode; diff --git a/packages/website/ts/components/ui/simple_loading.tsx b/packages/website/ts/components/ui/simple_loading.tsx index 12d09ecc4..d55d7851d 100644 --- a/packages/website/ts/components/ui/simple_loading.tsx +++ b/packages/website/ts/components/ui/simple_loading.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {colors} from 'material-ui/styles'; import CircularProgress from 'material-ui/CircularProgress'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; export interface SimpleLoadingProps { message: string; diff --git a/packages/website/ts/components/ui/swap_icon.tsx b/packages/website/ts/components/ui/swap_icon.tsx index 89bb33d55..2e6ae89bb 100644 --- a/packages/website/ts/components/ui/swap_icon.tsx +++ b/packages/website/ts/components/ui/swap_icon.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import {constants} from 'ts/utils/constants'; -import {colors} from 'material-ui/styles'; interface SwapIconProps { swapTokensFn: () => void; diff --git a/packages/website/ts/components/ui/token_icon.tsx b/packages/website/ts/components/ui/token_icon.tsx index 168c09bd4..d3a7c9a8c 100644 --- a/packages/website/ts/components/ui/token_icon.tsx +++ b/packages/website/ts/components/ui/token_icon.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {Token} from 'ts/types'; import {Identicon} from 'ts/components/ui/identicon'; +import {Token} from 'ts/types'; interface TokenIconProps { token: Token; diff --git a/packages/website/ts/components/visual_order.tsx b/packages/website/ts/components/visual_order.tsx index a7d6d1a9e..037a321ff 100644 --- a/packages/website/ts/components/visual_order.tsx +++ b/packages/website/ts/components/visual_order.tsx @@ -1,10 +1,10 @@ +import {ZeroEx} from '0x.js'; import * as _ from 'lodash'; import * as React from 'react'; -import {ZeroEx} from '0x.js'; -import {AssetToken, Token, TokenByAddress} from 'ts/types'; -import {utils} from 'ts/utils/utils'; import {Party} from 'ts/components/ui/party'; +import {AssetToken, Token, TokenByAddress} from 'ts/types'; import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const PRECISION = 5; |