From 6ac984f32ab995aeecc3984b127d63bbe84a58d4 Mon Sep 17 00:00:00 2001 From: Janis E <55956583+Jxnis@users.noreply.github.com> Date: Mon, 4 Sep 2023 14:41:35 +0100 Subject: [PATCH] try to fix prefill amount and add to else case (#505) --- .../inputs/amount-account-input/AmountAccountInput.tsx | 3 ++- .../input-account/near-amount-account/NearAmountAccount.tsx | 3 ++- src/components/inputs/input-field/inputField.tsx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/inputs/amount-account-input/AmountAccountInput.tsx b/src/components/inputs/amount-account-input/AmountAccountInput.tsx index 44b603d8..5e0d9199 100644 --- a/src/components/inputs/amount-account-input/AmountAccountInput.tsx +++ b/src/components/inputs/amount-account-input/AmountAccountInput.tsx @@ -68,12 +68,13 @@ export const MbAmountAccountInput = ({ controlStatus={ isCleared || !amount ? EControlStatus.NORMAL - : isAmountValid + : isAmountValid || amount === '1' ? EControlStatus.VALID : EControlStatus.INVALID } onChange={handleAmountDebounceFor500} hasPercentageLabel={isPercentage} + disabled={amount === '1'} defaultValue={amount === '1' ? 1 : undefined} /> diff --git a/src/components/inputs/input-account/near-amount-account/NearAmountAccount.tsx b/src/components/inputs/input-account/near-amount-account/NearAmountAccount.tsx index 258e8ac2..20d44aea 100644 --- a/src/components/inputs/input-account/near-amount-account/NearAmountAccount.tsx +++ b/src/components/inputs/input-account/near-amount-account/NearAmountAccount.tsx @@ -378,7 +378,8 @@ export const MbNearAmountAccount = ({ controlStatus={defaultAmountStatus(amount.value)} disabled hasPercentageLabel={isPercentage} - value={amount.value} + value={totalAmount !== 1 ? amount.value : undefined} + defaultValue={totalAmount === 1 ? 1 : undefined} /> ( ref={ref} placeholder={placeholder} type={type} - value={value} + value={!defaultValue ? value : undefined} maxLength={maxChars} required={required} defaultValue={defaultValue}