diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-11 23:38:51 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-14 16:35:13 +0800 |
commit | b74957acdfc8d67d154bcb4698acd7575db7cc47 (patch) | |
tree | 3f33c2faac3b55e52098ab0b5b9883a9b62f5aee /packages/website/ts/components/dialogs | |
parent | 6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b (diff) | |
download | dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.gz dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.bz2 dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.lz dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.xz dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.zst dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.zip |
Add missing type definitions
Diffstat (limited to 'packages/website/ts/components/dialogs')
8 files changed, 43 insertions, 43 deletions
diff --git a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx index 1c3b7458d..7156e700b 100644 --- a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx +++ b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx @@ -18,7 +18,7 @@ interface BlockchainErrDialogProps { } export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProps, undefined> { - public render() { + public render(): React.ReactNode { const dialogActions = [ <FlatButton key="blockchainErrOk" @@ -45,7 +45,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp </Dialog> ); } - private _getTitle(hasWalletAddress: boolean) { + private _getTitle(hasWalletAddress: boolean): string { if (this.props.blockchainErr === BlockchainErrs.AContractNotDeployedOnNetwork) { return '0x smart contracts not found'; } else if (!hasWalletAddress) { @@ -58,7 +58,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp return 'Unexpected error'; } } - private _renderExplanation(hasWalletAddress: boolean) { + private _renderExplanation(hasWalletAddress: boolean): React.ReactNode { if (this.props.blockchainErr === BlockchainErrs.AContractNotDeployedOnNetwork) { return this._renderContractsNotDeployedExplanation(); } else if (!hasWalletAddress) { @@ -71,7 +71,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp return this._renderUnexpectedErrorExplanation(); } } - private _renderDisconnectedFromNode() { + private _renderDisconnectedFromNode(): React.ReactNode { return ( <div> You were disconnected from the backing Ethereum node. If using{' '} @@ -86,7 +86,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp </div> ); } - private _renderDefaultTokenNotInTokenRegistry() { + private _renderDefaultTokenNotInTokenRegistry(): React.ReactNode { return ( <div> The TokenRegistry deployed on your network does not contain the needed default tokens for 0x Portal to @@ -96,10 +96,10 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp </div> ); } - private _renderUnexpectedErrorExplanation() { + private _renderUnexpectedErrorExplanation(): React.ReactNode { return <div>We encountered an unexpected error. Please try refreshing the page.</div>; } - private _renderNoWalletFoundExplanation() { + private _renderNoWalletFoundExplanation(): React.ReactNode { return ( <div> <div> @@ -137,7 +137,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp </div> ); } - private _renderContractsNotDeployedExplanation() { + private _renderContractsNotDeployedExplanation(): React.ReactNode { return ( <div> <div> 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 42ca1713d..069a75560 100644 --- a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx +++ b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx @@ -47,14 +47,14 @@ export class EthWethConversionDialog extends React.Component< ethTokenBalance: new BigNumber(0), }; } - public componentWillMount() { + public componentWillMount(): void { // tslint:disable-next-line:no-floating-promises this._fetchEthTokenBalanceAsync(); } - public componentWillUnmount() { + public componentWillUnmount(): void { this._isUnmounted = true; } - public render() { + public render(): React.ReactNode { const convertDialogActions = [ <FlatButton key="cancel" label="Cancel" onTouchTap={this._onCancel.bind(this)} />, <FlatButton key="convert" label="Convert" primary={true} onTouchTap={this._onConvertClick.bind(this)} />, @@ -72,7 +72,7 @@ export class EthWethConversionDialog extends React.Component< </Dialog> ); } - private _renderConversionDialogBody() { + private _renderConversionDialogBody(): React.ReactNode { const explanation = this.props.direction === Side.Deposit ? 'Convert your Ether into a tokenized, tradable form.' @@ -137,7 +137,7 @@ export class EthWethConversionDialog extends React.Component< </div> ); } - private _renderCurrency(isWrappedVersion: boolean) { + private _renderCurrency(isWrappedVersion: boolean): React.ReactNode { const name = isWrappedVersion ? 'Wrapped Ether' : 'Ether'; const iconUrl = isWrappedVersion ? '/images/token_icons/ether_erc20.png' : '/images/ether.png'; const symbol = isWrappedVersion ? 'WETH' : 'ETH'; @@ -155,18 +155,18 @@ export class EthWethConversionDialog extends React.Component< </div> ); } - private _onMaxClick() { + private _onMaxClick(): void { this.setState({ value: this.state.ethTokenBalance, }); } - private _onValueChange(isValid: boolean, amount?: BigNumber) { + private _onValueChange(isValid: boolean, amount?: BigNumber): void { this.setState({ value: amount, hasErrors: !isValid, }); } - private _onConvertClick() { + private _onConvertClick(): void { if (this.state.hasErrors) { this.setState({ shouldShowIncompleteErrs: true, @@ -179,13 +179,13 @@ export class EthWethConversionDialog extends React.Component< this.props.onComplete(this.props.direction, value); } } - private _onCancel() { + private _onCancel(): void { this.setState({ value: undefined, }); this.props.onCancelled(); } - private async _fetchEthTokenBalanceAsync() { + private async _fetchEthTokenBalanceAsync(): Promise<void> { const userAddressIfExists = _.isEmpty(this.props.userAddress) ? undefined : this.props.userAddress; const [balance] = await this.props.blockchain.getTokenBalanceAndAllowanceAsync( userAddressIfExists, diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index a72d33183..3c839d6f5 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -59,7 +59,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, preferredNetworkId: props.networkId, }; } - public render() { + public render(): React.ReactNode { const dialogActions = [ <FlatButton key="ledgerConnectCancel" label="Cancel" onTouchTap={this._onClose.bind(this)} />, ]; @@ -82,7 +82,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, </Dialog> ); } - private _renderConnectStep() { + private _renderConnectStep(): React.ReactNode { const networkIds = _.values(sharedConstants.NETWORK_ID_BY_NAME); return ( <div> @@ -122,7 +122,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, </div> ); } - private _renderSelectAddressStep() { + private _renderSelectAddressStep(): React.ReactNode { return ( <div> <div> @@ -159,7 +159,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, </div> ); } - private _renderAddressTableRows() { + private _renderAddressTableRows(): React.ReactNode { const rows = _.map(this.state.userAddresses, (userAddress: string, i: number) => { const balanceInWei = this.state.addressBalances[i]; const addressTooltipId = `address-${userAddress}`; @@ -189,7 +189,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, }); return rows; } - private _onClose() { + private _onClose(): void { this.setState({ connectionErrMsg: '', stepIndex: LedgerSteps.CONNECT, @@ -197,7 +197,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, const isOpen = false; this.props.toggleDialogFn(isOpen); } - private _onAddressSelected(selectedRowIndexes: number[]) { + private _onAddressSelected(selectedRowIndexes: number[]): void { const selectedRowIndex = selectedRowIndexes[0]; const selectedAddress = this.state.userAddresses[selectedRowIndex]; const selectAddressBalance = this.state.addressBalances[selectedRowIndex]; @@ -228,7 +228,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, } return didSucceed; } - private async _fetchAddressesAndBalancesAsync() { + private async _fetchAddressesAndBalancesAsync(): Promise<boolean> { let userAddresses: string[]; const addressBalances: BigNumber[] = []; try { @@ -250,7 +250,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, }); return true; } - private _onDerivationPathChanged(e: any, derivationPath: string) { + private _onDerivationPathChanged(e: any, derivationPath: string): void { let derivationErrMsg = ''; if (!_.startsWith(derivationPath, VALID_ETHEREUM_DERIVATION_PATH_PREFIX)) { derivationErrMsg = 'Must be valid Ethereum path.'; @@ -261,7 +261,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, derivationErrMsg, }); } - private async _onConnectLedgerClickAsync() { + private async _onConnectLedgerClickAsync(): Promise<boolean> { const isU2FSupported = await utils.isU2FSupportedAsync(); if (!isU2FSupported) { logUtils.log(`U2F not supported in this browser`); @@ -295,7 +295,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, } return userAddresses; } - private _onSelectedNetworkUpdated(e: any, index: number, networkId: number) { + private _onSelectedNetworkUpdated(e: any, index: number, networkId: number): void { this.setState({ preferredNetworkId: networkId, }); diff --git a/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx b/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx index b31667121..41a17fe96 100644 --- a/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx +++ b/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx @@ -8,7 +8,7 @@ interface PortalDisclaimerDialogProps { onToggleDialog: () => void; } -export function PortalDisclaimerDialog(props: PortalDisclaimerDialogProps) { +export const PortalDisclaimerDialog = (props: PortalDisclaimerDialogProps) => { return ( <Dialog title="0x Portal Disclaimer" @@ -33,4 +33,4 @@ export function PortalDisclaimerDialog(props: PortalDisclaimerDialogProps) { </div> </Dialog> ); -} +}; diff --git a/packages/website/ts/components/dialogs/send_dialog.tsx b/packages/website/ts/components/dialogs/send_dialog.tsx index 2af7fd7ac..421f18b4f 100644 --- a/packages/website/ts/components/dialogs/send_dialog.tsx +++ b/packages/website/ts/components/dialogs/send_dialog.tsx @@ -35,7 +35,7 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState isAmountValid: false, }; } - public render() { + public render(): React.ReactNode { const transferDialogActions = [ <FlatButton key="cancelTransfer" label="Cancel" onTouchTap={this._onCancel.bind(this)} />, <FlatButton @@ -57,7 +57,7 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState </Dialog> ); } - private _renderSendDialogBody() { + private _renderSendDialogBody(): React.ReactNode { return ( <div className="mx-auto" style={{ maxWidth: 300 }}> <div style={{ height: 80 }}> @@ -86,19 +86,19 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState </div> ); } - private _onRecipientChange(recipient?: string) { + private _onRecipientChange(recipient?: string): void { this.setState({ shouldShowIncompleteErrs: false, recipient, }); } - private _onValueChange(isValid: boolean, amount?: BigNumber) { + private _onValueChange(isValid: boolean, amount?: BigNumber): void { this.setState({ isAmountValid: isValid, value: amount, }); } - private _onSendClick() { + private _onSendClick(): void { if (this._hasErrors()) { this.setState({ shouldShowIncompleteErrs: true, @@ -112,13 +112,13 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState this.props.onComplete(this.state.recipient, value); } } - private _onCancel() { + private _onCancel(): void { this.setState({ value: undefined, }); this.props.onCancelled(); } - private _hasErrors() { + private _hasErrors(): boolean { return _.isUndefined(this.state.recipient) || _.isUndefined(this.state.value) || !this.state.isAmountValid; } } 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 bb7e3ed1a..ac0b27cdc 100644 --- a/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx +++ b/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx @@ -33,7 +33,7 @@ export class TrackTokenConfirmationDialog extends React.Component< isAddingTokenToTracked: false, }; } - public render() { + public render(): React.ReactNode { const tokens = this.props.tokens; return ( <Dialog @@ -66,7 +66,7 @@ export class TrackTokenConfirmationDialog extends React.Component< </Dialog> ); } - private async _onTrackConfirmationRespondedAsync(didUserAcceptTracking: boolean) { + private async _onTrackConfirmationRespondedAsync(didUserAcceptTracking: boolean): Promise<void> { if (!didUserAcceptTracking) { this.props.onToggleDialog(didUserAcceptTracking); return; 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 6ac9cf917..ce86df856 100644 --- a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx +++ b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx @@ -9,7 +9,7 @@ interface U2fNotSupportedDialogProps { onToggleDialog: () => void; } -export function U2fNotSupportedDialog(props: U2fNotSupportedDialogProps) { +export const U2fNotSupportedDialog = (props: U2fNotSupportedDialogProps) => { return ( <Dialog title="U2F Not Supported" @@ -43,4 +43,4 @@ export function U2fNotSupportedDialog(props: U2fNotSupportedDialogProps) { </div> </Dialog> ); -} +}; diff --git a/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx b/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx index 9e91ff12d..78b270c1e 100644 --- a/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx +++ b/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx @@ -8,7 +8,7 @@ interface WrappedEthSectionNoticeDialogProps { onToggleDialog: () => void; } -export function WrappedEthSectionNoticeDialog(props: WrappedEthSectionNoticeDialogProps) { +export const WrappedEthSectionNoticeDialog = (props: WrappedEthSectionNoticeDialogProps) => { return ( <Dialog title="Dedicated Wrapped Ether Section" @@ -30,4 +30,4 @@ export function WrappedEthSectionNoticeDialog(props: WrappedEthSectionNoticeDial </div> </Dialog> ); -} +}; |