aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/inputs/balance_bounded_input.tsx
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-05 21:04:01 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-05 21:04:01 +0800
commit1ee2d6ed54b6159d1e8952692f4ddba0ebd65012 (patch)
tree1cebf47acf4fff2352a709035c141ec7ffdb8353 /packages/website/ts/components/inputs/balance_bounded_input.tsx
parent1eba78e20ac468d3b4d6ebe8fd91eb5277577e0a (diff)
parent5176d929fa6d3c6ce414448ea2441bd450f04e3c (diff)
downloaddexon-sol-tools-1ee2d6ed54b6159d1e8952692f4ddba0ebd65012.tar
dexon-sol-tools-1ee2d6ed54b6159d1e8952692f4ddba0ebd65012.tar.gz
dexon-sol-tools-1ee2d6ed54b6159d1e8952692f4ddba0ebd65012.tar.bz2
dexon-sol-tools-1ee2d6ed54b6159d1e8952692f4ddba0ebd65012.tar.lz
dexon-sol-tools-1ee2d6ed54b6159d1e8952692f4ddba0ebd65012.tar.xz
dexon-sol-tools-1ee2d6ed54b6159d1e8952692f4ddba0ebd65012.tar.zst
dexon-sol-tools-1ee2d6ed54b6159d1e8952692f4ddba0ebd65012.zip
Merge branch 'v2-prototype' into v2-contract-wrappers-WIP
Diffstat (limited to 'packages/website/ts/components/inputs/balance_bounded_input.tsx')
-rw-r--r--packages/website/ts/components/inputs/balance_bounded_input.tsx35
1 files changed, 2 insertions, 33 deletions
diff --git a/packages/website/ts/components/inputs/balance_bounded_input.tsx b/packages/website/ts/components/inputs/balance_bounded_input.tsx
index 968609030..f23beb436 100644
--- a/packages/website/ts/components/inputs/balance_bounded_input.tsx
+++ b/packages/website/ts/components/inputs/balance_bounded_input.tsx
@@ -3,9 +3,8 @@ import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
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 { ValidatedBigNumberCallback, WebsitePaths } from 'ts/types';
+import { ValidatedBigNumberCallback } from 'ts/types';
import { utils } from 'ts/utils/utils';
interface BalanceBoundedInputProps {
@@ -18,8 +17,6 @@ interface BalanceBoundedInputProps {
shouldShowIncompleteErrs?: boolean;
shouldCheckBalance: boolean;
validate?: (amount: BigNumber) => React.ReactNode;
- onVisitBalancesPageClick?: () => void;
- shouldHideVisitBalancesLink?: boolean;
isDisabled?: boolean;
shouldShowErrs?: boolean;
shouldShowUnderline?: boolean;
@@ -35,7 +32,6 @@ interface BalanceBoundedInputState {
export class BalanceBoundedInput extends React.Component<BalanceBoundedInputProps, BalanceBoundedInputState> {
public static defaultProps: Partial<BalanceBoundedInputProps> = {
shouldShowIncompleteErrs: false,
- shouldHideVisitBalancesLink: false,
isDisabled: false,
shouldShowErrs: true,
hintText: 'amount',
@@ -124,38 +120,11 @@ export class BalanceBoundedInput extends React.Component<BalanceBoundedInputProp
return 'Cannot be zero';
}
if (this.props.shouldCheckBalance && amount.gt(balance)) {
- return <span>Insufficient balance. {this._renderIncreaseBalanceLink()}</span>;
+ return <span>Insufficient balance.</span>;
}
const errMsg = _.isUndefined(this.props.validate) ? undefined : this.props.validate(amount);
return errMsg;
}
- private _renderIncreaseBalanceLink(): React.ReactNode {
- if (this.props.shouldHideVisitBalancesLink) {
- return null;
- }
-
- const increaseBalanceText = 'Increase balance';
- const linkStyle = {
- cursor: 'pointer',
- color: colors.darkestGrey,
- textDecoration: 'underline',
- display: 'inline',
- };
- if (_.isUndefined(this.props.onVisitBalancesPageClick)) {
- return (
- <Link to={`${WebsitePaths.Portal}/balances`} style={linkStyle}>
- {increaseBalanceText}
- </Link>
- );
- } else {
- return (
- <div onClick={this.props.onVisitBalancesPageClick} style={linkStyle}>
- {increaseBalanceText}
- </div>
- );
- }
- }
-
private _setAmountState(amount: string, balance: BigNumber, callback: () => void = _.noop): void {
const errorMsg = this._validate(amount, balance);
this.props.onErrorMsgChange(errorMsg);