aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/dialogs
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-12-22 04:24:54 +0800
committerFabio Berger <me@fabioberger.com>2017-12-22 04:24:54 +0800
commite01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9 (patch)
tree241b630db5044974cc17130f149ca64728d9c619 /packages/website/ts/components/dialogs
parentd725de72861c6a6218c7f4822a339175a2da7403 (diff)
parentcb3582289ff94857d5956bbd71dbf68ee3f42ecf (diff)
downloaddexon-sol-tools-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.tar
dexon-sol-tools-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.tar.gz
dexon-sol-tools-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.tar.bz2
dexon-sol-tools-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.tar.lz
dexon-sol-tools-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.tar.xz
dexon-sol-tools-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.tar.zst
dexon-sol-tools-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.zip
Merge branch 'development' into fix/docLinks
* development: Update and standardize contracts README Add to CHANGELOG Refactor toBaseUnitAmount so that it throws if user supplies unitAmount with too many decimals Make assertion stricter so that one cannot submit invalid baseUnit amounts to `toUnitAmount` Add some missed underscores, update changelog and comments Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors # Conflicts: # packages/website/ts/pages/documentation/documentation.tsx # packages/website/ts/pages/shared/nested_sidebar_menu.tsx
Diffstat (limited to 'packages/website/ts/components/dialogs')
-rw-r--r--packages/website/ts/components/dialogs/blockchain_err_dialog.tsx24
-rw-r--r--packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx28
-rw-r--r--packages/website/ts/components/dialogs/ledger_config_dialog.tsx44
-rw-r--r--packages/website/ts/components/dialogs/send_dialog.tsx26
-rw-r--r--packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx6
5 files changed, 64 insertions, 64 deletions
diff --git a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx
index 9a5cd90d7..900d0e193 100644
--- a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx
+++ b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx
@@ -31,7 +31,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp
const hasWalletAddress = this.props.userAddress !== '';
return (
<Dialog
- title={this.getTitle(hasWalletAddress)}
+ title={this._getTitle(hasWalletAddress)}
titleStyle={{fontWeight: 100}}
actions={dialogActions}
open={this.props.isOpen}
@@ -40,12 +40,12 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp
autoScrollBodyContent={true}
>
<div className="pt2" style={{color: colors.grey700}}>
- {this.renderExplanation(hasWalletAddress)}
+ {this._renderExplanation(hasWalletAddress)}
</div>
</Dialog>
);
}
- private getTitle(hasWalletAddress: boolean) {
+ private _getTitle(hasWalletAddress: boolean) {
if (this.props.blockchainErr === BlockchainErrs.AContractNotDeployedOnNetwork) {
return '0x smart contracts not found';
} else if (!hasWalletAddress) {
@@ -56,18 +56,18 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp
return 'Unexpected error';
}
}
- private renderExplanation(hasWalletAddress: boolean) {
+ private _renderExplanation(hasWalletAddress: boolean) {
if (this.props.blockchainErr === BlockchainErrs.AContractNotDeployedOnNetwork) {
- return this.renderContractsNotDeployedExplanation();
+ return this._renderContractsNotDeployedExplanation();
} else if (!hasWalletAddress) {
- return this.renderNoWalletFoundExplanation();
+ return this._renderNoWalletFoundExplanation();
} else if (this.props.blockchainErr === BlockchainErrs.DisconnectedFromEthereumNode) {
- return this.renderDisconnectedFromNode();
+ return this._renderDisconnectedFromNode();
} else {
- return this.renderUnexpectedErrorExplanation();
+ return this._renderUnexpectedErrorExplanation();
}
}
- private renderDisconnectedFromNode() {
+ private _renderDisconnectedFromNode() {
return (
<div>
You were disconnected from the backing Ethereum node.
@@ -78,14 +78,14 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp
</div>
);
}
- private renderUnexpectedErrorExplanation() {
+ private _renderUnexpectedErrorExplanation() {
return (
<div>
We encountered an unexpected error. Please try refreshing the page.
</div>
);
}
- private renderNoWalletFoundExplanation() {
+ private _renderNoWalletFoundExplanation() {
return (
<div>
<div>
@@ -122,7 +122,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp
</div>
);
}
- private renderContractsNotDeployedExplanation() {
+ private _renderContractsNotDeployedExplanation() {
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 c65db1d4a..d78cbdc29 100644
--- a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx
+++ b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx
@@ -37,13 +37,13 @@ export class EthWethConversionDialog extends
<FlatButton
key="cancel"
label="Cancel"
- onTouchTap={this.onCancel.bind(this)}
+ onTouchTap={this._onCancel.bind(this)}
/>,
<FlatButton
key="convert"
label="Convert"
primary={true}
- onTouchTap={this.onConvertClick.bind(this)}
+ onTouchTap={this._onConvertClick.bind(this)}
/>,
];
const title = this.props.direction === Side.Deposit ? 'Wrap ETH' : 'Unwrap WETH';
@@ -55,11 +55,11 @@ export class EthWethConversionDialog extends
contentStyle={{width: 448}}
open={this.props.isOpen}
>
- {this.renderConversionDialogBody()}
+ {this._renderConversionDialogBody()}
</Dialog>
);
}
- private renderConversionDialogBody() {
+ private _renderConversionDialogBody() {
const explanation = this.props.direction === Side.Deposit ?
'Convert your Ether into a tokenized, tradable form.' :
'Convert your Wrapped Ether back into it\'s native form.';
@@ -71,14 +71,14 @@ export class EthWethConversionDialog extends
</div>
<div className="mx-auto" style={{maxWidth: 312}}>
<div className="flex">
- {this.renderCurrency(isWrappedVersion)}
+ {this._renderCurrency(isWrappedVersion)}
<div style={{paddingTop: 68}}>
<i
style={{fontSize: 28, color: colors.darkBlue}}
className="zmdi zmdi-arrow-right"
/>
</div>
- {this.renderCurrency(!isWrappedVersion)}
+ {this._renderCurrency(!isWrappedVersion)}
</div>
<div
className="pt2 mx-auto"
@@ -91,14 +91,14 @@ export class EthWethConversionDialog extends
shouldShowIncompleteErrs={this.state.shouldShowIncompleteErrs}
shouldCheckBalance={true}
shouldCheckAllowance={false}
- onChange={this.onValueChange.bind(this)}
+ onChange={this._onValueChange.bind(this)}
amount={this.state.value}
onVisitBalancesPageClick={this.props.onCancelled}
/> :
<EthAmountInput
balance={this.props.etherBalance}
amount={this.state.value}
- onChange={this.onValueChange.bind(this)}
+ onChange={this._onValueChange.bind(this)}
shouldCheckBalance={true}
shouldShowIncompleteErrs={this.state.shouldShowIncompleteErrs}
onVisitBalancesPageClick={this.props.onCancelled}
@@ -112,7 +112,7 @@ export class EthWethConversionDialog extends
{this.props.direction === Side.Receive &&
<div
className="right"
- onClick={this.onMaxClick.bind(this)}
+ onClick={this._onMaxClick.bind(this)}
style={{color: colors.darkBlue, textDecoration: 'underline', cursor: 'pointer'}}
>
Max
@@ -124,7 +124,7 @@ export class EthWethConversionDialog extends
</div>
);
}
- private renderCurrency(isWrappedVersion: boolean) {
+ private _renderCurrency(isWrappedVersion: boolean) {
const name = isWrappedVersion ? 'Wrapped Ether' : 'Ether';
const iconUrl = isWrappedVersion ? '/images/token_icons/ether_erc20.png' : '/images/ether.png';
const symbol = isWrappedVersion ? 'WETH' : 'ETH';
@@ -145,18 +145,18 @@ export class EthWethConversionDialog extends
</div>
);
}
- private onMaxClick() {
+ private _onMaxClick() {
this.setState({
value: this.props.tokenState.balance,
});
}
- private onValueChange(isValid: boolean, amount?: BigNumber) {
+ private _onValueChange(isValid: boolean, amount?: BigNumber) {
this.setState({
value: amount,
hasErrors: !isValid,
});
}
- private onConvertClick() {
+ private _onConvertClick() {
if (this.state.hasErrors) {
this.setState({
shouldShowIncompleteErrs: true,
@@ -169,7 +169,7 @@ export class EthWethConversionDialog extends
this.props.onComplete(this.props.direction, value);
}
}
- private onCancel() {
+ private _onCancel() {
this.setState({
value: undefined,
});
diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
index ddd1f2cf2..cc68ef2df 100644
--- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
+++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
@@ -62,7 +62,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
<FlatButton
key="ledgerConnectCancel"
label="Cancel"
- onTouchTap={this.onClose.bind(this)}
+ onTouchTap={this._onClose.bind(this)}
/>,
];
const dialogTitle = this.state.stepIndex === LedgerSteps.CONNECT ?
@@ -74,22 +74,22 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
titleStyle={{fontWeight: 100}}
actions={dialogActions}
open={this.props.isOpen}
- onRequestClose={this.onClose.bind(this)}
+ onRequestClose={this._onClose.bind(this)}
autoScrollBodyContent={true}
bodyStyle={{paddingBottom: 0}}
>
<div style={{color: colors.grey700, paddingTop: 1}}>
{this.state.stepIndex === LedgerSteps.CONNECT &&
- this.renderConnectStep()
+ this._renderConnectStep()
}
{this.state.stepIndex === LedgerSteps.SELECT_ADDRESS &&
- this.renderSelectAddressStep()
+ this._renderSelectAddressStep()
}
</div>
</Dialog>
);
}
- private renderConnectStep() {
+ private _renderConnectStep() {
return (
<div>
<div className="h4 pt3">
@@ -113,7 +113,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
labelReady="Connect to Ledger"
labelLoading="Connecting..."
labelComplete="Connected!"
- onClickAsyncFn={this.onConnectLedgerClickAsync.bind(this, true)}
+ onClickAsyncFn={this._onConnectLedgerClickAsync.bind(this, true)}
/>
{this.state.didConnectFail &&
<div className="pt2 left-align" style={{color: colors.red200}}>
@@ -124,13 +124,13 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
</div>
);
}
- private renderSelectAddressStep() {
+ private _renderSelectAddressStep() {
return (
<div>
<div>
<Table
bodyStyle={{height: 300}}
- onRowSelection={this.onAddressSelected.bind(this)}
+ onRowSelection={this._onAddressSelected.bind(this)}
>
<TableHeader displaySelectAll={false}>
<TableRow>
@@ -139,7 +139,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
</TableRow>
</TableHeader>
<TableBody>
- {this.renderAddressTableRows()}
+ {this._renderAddressTableRows()}
</TableBody>
</Table>
</div>
@@ -151,7 +151,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
floatingLabelText="Update path derivation (advanced)"
value={this.state.derivationPath}
errorText={this.state.derivationErrMsg}
- onChange={this.onDerivationPathChanged.bind(this)}
+ onChange={this._onDerivationPathChanged.bind(this)}
/>
</div>
<div className="pl2" style={{paddingTop: 28}}>
@@ -159,14 +159,14 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
labelReady="Update"
labelLoading="Updating..."
labelComplete="Updated!"
- onClickAsyncFn={this.onFetchAddressesForDerivationPathAsync.bind(this, true)}
+ onClickAsyncFn={this._onFetchAddressesForDerivationPathAsync.bind(this, true)}
/>
</div>
</div>
</div>
);
}
- private renderAddressTableRows() {
+ private _renderAddressTableRows() {
const rows = _.map(this.state.userAddresses, (userAddress: string, i: number) => {
const balance = this.state.addressBalances[i];
const addressTooltipId = `address-${userAddress}`;
@@ -201,14 +201,14 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
});
return rows;
}
- private onClose() {
+ private _onClose() {
this.setState({
didConnectFail: false,
});
const isOpen = false;
this.props.toggleDialogFn(isOpen);
}
- private onAddressSelected(selectedRowIndexes: number[]) {
+ private _onAddressSelected(selectedRowIndexes: number[]) {
const selectedRowIndex = selectedRowIndexes[0];
this.props.blockchain.updateLedgerDerivationIndex(selectedRowIndex);
const selectedAddress = this.state.userAddresses[selectedRowIndex];
@@ -222,13 +222,13 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
const isOpen = false;
this.props.toggleDialogFn(isOpen);
}
- private async onFetchAddressesForDerivationPathAsync() {
+ private async _onFetchAddressesForDerivationPathAsync() {
const currentlySetPath = this.props.blockchain.getLedgerDerivationPathIfExists();
if (currentlySetPath === this.state.derivationPath) {
return;
}
this.props.blockchain.updateLedgerDerivationPathIfExists(this.state.derivationPath);
- const didSucceed = await this.fetchAddressesAndBalancesAsync();
+ const didSucceed = await this._fetchAddressesAndBalancesAsync();
if (!didSucceed) {
this.setState({
derivationErrMsg: 'Failed to connect to Ledger.',
@@ -236,11 +236,11 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
}
return didSucceed;
}
- private async fetchAddressesAndBalancesAsync() {
+ private async _fetchAddressesAndBalancesAsync() {
let userAddresses: string[];
const addressBalances: BigNumber[] = [];
try {
- userAddresses = await this.getUserAddressesAsync();
+ userAddresses = await this._getUserAddressesAsync();
for (const address of userAddresses) {
const balance = await this.props.blockchain.getBalanceInEthAsync(address);
addressBalances.push(balance);
@@ -258,7 +258,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
});
return true;
}
- private onDerivationPathChanged(e: any, derivationPath: string) {
+ private _onDerivationPathChanged(e: any, derivationPath: string) {
let derivationErrMsg = '';
if (!_.startsWith(derivationPath, VALID_ETHEREUM_DERIVATION_PATH_PREFIX)) {
derivationErrMsg = 'Must be valid Ethereum path.';
@@ -269,8 +269,8 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
derivationErrMsg,
});
}
- private async onConnectLedgerClickAsync() {
- const didSucceed = await this.fetchAddressesAndBalancesAsync();
+ private async _onConnectLedgerClickAsync() {
+ const didSucceed = await this._fetchAddressesAndBalancesAsync();
if (didSucceed) {
this.setState({
stepIndex: LedgerSteps.SELECT_ADDRESS,
@@ -278,7 +278,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
}
return didSucceed;
}
- private async getUserAddressesAsync(): Promise<string[]> {
+ private async _getUserAddressesAsync(): Promise<string[]> {
let userAddresses: string[];
userAddresses = await this.props.blockchain.getUserAccountsAsync();
diff --git a/packages/website/ts/components/dialogs/send_dialog.tsx b/packages/website/ts/components/dialogs/send_dialog.tsx
index 0f3516993..9a85ea8b1 100644
--- a/packages/website/ts/components/dialogs/send_dialog.tsx
+++ b/packages/website/ts/components/dialogs/send_dialog.tsx
@@ -36,14 +36,14 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState
<FlatButton
key="cancelTransfer"
label="Cancel"
- onTouchTap={this.onCancel.bind(this)}
+ onTouchTap={this._onCancel.bind(this)}
/>,
<FlatButton
key="sendTransfer"
- disabled={this.hasErrors()}
+ disabled={this._hasErrors()}
label="Send"
primary={true}
- onTouchTap={this.onSendClick.bind(this)}
+ onTouchTap={this._onSendClick.bind(this)}
/>,
];
return (
@@ -53,17 +53,17 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState
actions={transferDialogActions}
open={this.props.isOpen}
>
- {this.renderSendDialogBody()}
+ {this._renderSendDialogBody()}
</Dialog>
);
}
- private renderSendDialogBody() {
+ private _renderSendDialogBody() {
return (
<div className="mx-auto" style={{maxWidth: 300}}>
<div style={{height: 80}}>
<AddressInput
initialAddress={this.state.recipient}
- updateAddress={this.onRecipientChange.bind(this)}
+ updateAddress={this._onRecipientChange.bind(this)}
isRequired={true}
label={'Recipient address'}
hintText={'Address'}
@@ -76,27 +76,27 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState
shouldShowIncompleteErrs={this.state.shouldShowIncompleteErrs}
shouldCheckBalance={true}
shouldCheckAllowance={false}
- onChange={this.onValueChange.bind(this)}
+ onChange={this._onValueChange.bind(this)}
amount={this.state.value}
onVisitBalancesPageClick={this.props.onCancelled}
/>
</div>
);
}
- private onRecipientChange(recipient?: string) {
+ private _onRecipientChange(recipient?: string) {
this.setState({
shouldShowIncompleteErrs: false,
recipient,
});
}
- private onValueChange(isValid: boolean, amount?: BigNumber) {
+ private _onValueChange(isValid: boolean, amount?: BigNumber) {
this.setState({
isAmountValid: isValid,
value: amount,
});
}
- private onSendClick() {
- if (this.hasErrors()) {
+ private _onSendClick() {
+ if (this._hasErrors()) {
this.setState({
shouldShowIncompleteErrs: true,
});
@@ -109,13 +109,13 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState
this.props.onComplete(this.state.recipient, value);
}
}
- private onCancel() {
+ private _onCancel() {
this.setState({
value: undefined,
});
this.props.onCancelled();
}
- private hasErrors() {
+ private _hasErrors() {
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 f17893a83..9e00b4110 100644
--- a/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx
+++ b/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx
@@ -41,12 +41,12 @@ export class TrackTokenConfirmationDialog extends
<FlatButton
key="trackNo"
label="No"
- onTouchTap={this.onTrackConfirmationRespondedAsync.bind(this, false)}
+ onTouchTap={this._onTrackConfirmationRespondedAsync.bind(this, false)}
/>,
<FlatButton
key="trackYes"
label="Yes"
- onTouchTap={this.onTrackConfirmationRespondedAsync.bind(this, true)}
+ onTouchTap={this._onTrackConfirmationRespondedAsync.bind(this, true)}
/>,
]}
open={this.props.isOpen}
@@ -64,7 +64,7 @@ export class TrackTokenConfirmationDialog extends
</Dialog>
);
}
- private async onTrackConfirmationRespondedAsync(didUserAcceptTracking: boolean) {
+ private async _onTrackConfirmationRespondedAsync(didUserAcceptTracking: boolean) {
if (!didUserAcceptTracking) {
this.props.onToggleDialog(didUserAcceptTracking);
return;