From 0e435a5b517eba38dcae3c6ab5972d9dc3f565d3 Mon Sep 17 00:00:00 2001 From: Chenjia Date: Fri, 29 Sep 2017 05:47:11 -0500 Subject: [PATCH] Fix #460 transfer qty validation issue (#466) * [460] fix transfer qty validation issue * [460] fix transfer toaccount validation issue * [460] refactor classnames instead of string superposition --- app/components/Transfer/Transfer.jsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/components/Transfer/Transfer.jsx b/app/components/Transfer/Transfer.jsx index c27a762728..1b841a573e 100644 --- a/app/components/Transfer/Transfer.jsx +++ b/app/components/Transfer/Transfer.jsx @@ -14,7 +14,8 @@ import Immutable from "immutable"; import {ChainStore} from "bitsharesjs/es"; import {connect} from "alt-react"; import { checkFeeStatusAsync, checkBalance } from "common/trxHelper"; -import { debounce } from "lodash"; +import { debounce, isNaN } from "lodash"; +import classnames from "classnames"; import { Asset } from "common/MarketClasses"; class Transfer extends React.Component { @@ -358,10 +359,10 @@ class Transfer extends React.Component { } let propose_incomplete = propose && ! propose_account; - let submitButtonClass = "button float-right no-margin"; - if(!from_account || !to_account || !amount || amount === "0"|| !asset || from_error || propose_incomplete || balanceError) - submitButtonClass += " disabled"; - + const amountValue = parseFloat(String.prototype.replace.call(amount, /,/g, "")); + const isAmountValid = amountValue && !isNaN(amountValue); + const isToAccountValid = to_account && to_account.get("name") === to_name; + const isSendNotValid = !from_account || !isToAccountValid || !isAmountValid || !asset || from_error || propose_incomplete || balanceError; let accountsList = Immutable.Set(); accountsList = accountsList.add(from_account); let tabIndex = 1; @@ -440,10 +441,10 @@ class Transfer extends React.Component { error={this.state.hasPoolBalance === false ? "transfer.errors.insufficient" : null} /> {propose ? - : - }