From 9774abc39efba2d913d50e2a8c996f075e18230d Mon Sep 17 00:00:00 2001 From: cby3149 Date: Sat, 1 May 2021 12:23:01 -0700 Subject: [PATCH] Fixed input error --- .../src/components/walletpicker/WalletPicker.js | 3 --- .../containers/modals/exit/steps/DoExitStep.js | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/wallet/src/components/walletpicker/WalletPicker.js b/wallet/src/components/walletpicker/WalletPicker.js index 08180649a989..25bd1b645b2f 100644 --- a/wallet/src/components/walletpicker/WalletPicker.js +++ b/wallet/src/components/walletpicker/WalletPicker.js @@ -32,9 +32,6 @@ import { setWalletMethod, setNetwork } from 'actions/setupAction'; import { getAllNetworks } from 'util/networkName'; import logo from 'images/omgx.png'; -import vp1 from 'images/vp_1.svg'; -import vp2 from 'images/vp_2.svg'; -import vp3 from 'images/vp_3.svg'; import chevron from 'images/chevron.svg'; import * as styles from './WalletPicker.module.scss'; diff --git a/wallet/src/containers/modals/exit/steps/DoExitStep.js b/wallet/src/containers/modals/exit/steps/DoExitStep.js index dfa9815f3b63..1b7eb883ef0f 100644 --- a/wallet/src/containers/modals/exit/steps/DoExitStep.js +++ b/wallet/src/containers/modals/exit/steps/DoExitStep.js @@ -41,6 +41,7 @@ function DoExitStep ({ const [ value, setValue ] = useState(''); const [ LPBalance, setLPBalance ] = useState(0); const [ feeRate, setFeeRate ] = useState(0); + const [ disabledSubmit, setDisabledSubmit ] = useState(true); const balances = useSelector(selectChildchainBalance, isEqual); @@ -100,7 +101,6 @@ function DoExitStep ({ } function getMaxTransferValue () { - const transferingBalanceObject = balances.find(i => i.currency === currency); if (!transferingBalanceObject) { return; @@ -108,6 +108,17 @@ function DoExitStep ({ return logAmount(transferingBalanceObject.amount, transferingBalanceObject.decimals); } + function setExitAmount(value) { + const transferingBalanceObject = balances.find(i => i.currency === currency); + const maxTransferValue = Number(logAmount(transferingBalanceObject.amount, transferingBalanceObject.decimals)); + if (value > 0 && (fast ? value < LPBalance : true) && value < maxTransferValue) { + setDisabledSubmit(false); + } else { + setDisabledSubmit(true); + } + setValue(value); + } + return ( <> @@ -123,7 +134,7 @@ function DoExitStep ({ placeholder={0} value={value} onChange={i => { - setValue(i.target.value); + setExitAmount(i.target.value); }} selectOptions={selectOptions} onSelect={i => { @@ -175,6 +186,7 @@ function DoExitStep ({ loading={submitLoading} className={styles.button} tooltip='Your exit is still pending. Please wait for confirmation.' + disabled={disabledSubmit} > EXIT