Update handleCurrencyChange to not reset amount range on currency change in maker form (#692)

* Update handleCurrencyChange to not reset amount range on currency change

* Update MakerForm.tsx
This commit is contained in:
Felix 2023-07-09 23:18:22 +02:00 committed by GitHub
parent d13af1a1b1
commit c26e2f919a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,11 +140,17 @@ const MakerForm = ({
updateCurrentPrice(limits.list, newCurrency, maker.premium);
if (makerHasAmountRange) {
setMaker({
...maker,
minAmount: parseFloat(Number(limits.list[newCurrency].max_amount * 0.25).toPrecision(2)),
maxAmount: parseFloat(Number(limits.list[newCurrency].max_amount * 0.75).toPrecision(2)),
});
const minAmount = parseFloat(Number(limits.list[newCurrency].min_amount).toPrecision(2));
const maxAmount = parseFloat(Number(limits.list[newCurrency].max_amount).toPrecision(2));
if (parseFloat(maker.minAmount) < minAmount || parseFloat(maker.minAmount) > maxAmount
|| parseFloat(maker.maxAmount) > maxAmount || parseFloat(maker.maxAmount) < minAmount)
{
setMaker({
...maker,
minAmount: (maxAmount * 0.25).toPrecision(2),
maxAmount: (maxAmount * 0.75).toPrecision(2),
});
};
}
};