Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
Fixed input error
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuan-chen committed May 1, 2021
1 parent 39fe034 commit 9774abc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 0 additions & 3 deletions wallet/src/components/walletpicker/WalletPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
16 changes: 14 additions & 2 deletions wallet/src/containers/modals/exit/steps/DoExitStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -100,14 +101,24 @@ function DoExitStep ({
}

function getMaxTransferValue () {

const transferingBalanceObject = balances.find(i => i.currency === currency);
if (!transferingBalanceObject) {
return;
}
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 (
<>

Expand All @@ -123,7 +134,7 @@ function DoExitStep ({
placeholder={0}
value={value}
onChange={i => {
setValue(i.target.value);
setExitAmount(i.target.value);
}}
selectOptions={selectOptions}
onSelect={i => {
Expand Down Expand Up @@ -175,6 +186,7 @@ function DoExitStep ({
loading={submitLoading}
className={styles.button}
tooltip='Your exit is still pending. Please wait for confirmation.'
disabled={disabledSubmit}
>
EXIT
</Button>
Expand Down

0 comments on commit 9774abc

Please sign in to comment.