Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Mintbase/mintbase-ui into fix/btn-v…
Browse files Browse the repository at this point in the history
…alidation
  • Loading branch information
Jxnis committed Sep 5, 2023
2 parents 4545cbc + 18382ae commit cfab3b1
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ export const MbAmountAccountInput = ({
const [isAmountValid, setIsAmountValid] = useState(false)

const [account, setAccount] = useState<string | null>(null)
const [amount, setAmount] = useState<string | null>(null)
const [amount, setAmount] = useState<string | null>(
prefillAmount !== null ? prefillAmount.toString() : null
)

useEffect(() => {
if (!isCleared) return
setIsAmountValid(false)
setIsAccountValid(false)
setAccount(null)
setAmount(null)
setAmount(prefillAmount !== null ? prefillAmount.toString() : null)
}, [isCleared])

const handleDebounceFor500 = debounce(async (e) => {
Expand All @@ -51,7 +53,7 @@ export const MbAmountAccountInput = ({
const value = e.target.value ?? null
const valid = validateAmount(id, Number(value))
setIsAmountValid(valid)
setAmount(value)
setAmount(prefillAmount !== null ? prefillAmount.toString() : value)
handleChangeAmount(id, Number(value))
}, 500)

Expand Down

0 comments on commit cfab3b1

Please sign in to comment.