fix: fixed the UI not being disabled on transaction (#356)

* fix: fixed the UI not being disabled on transaction

* fix: borrow modal repay toggle
This commit is contained in:
Linkie Link 2023-08-09 15:29:28 +02:00 committed by GitHub
parent 85bdb4b267
commit e6926dbd17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 17 deletions

View File

@ -130,6 +130,7 @@ export default function AccountFund() {
max={BN(balance)}
balances={walletBalances}
maxText='Max'
disabled={isFunding}
/>
</div>
)
@ -142,6 +143,7 @@ export default function AccountFund() {
rightIcon={<Plus />}
iconClassName='w-3'
onClick={handleSelectAssetsClick}
disabled={isFunding}
/>
<SwitchAutoLend
className='pt-4 mt-4 border border-transparent border-t-white/10'

View File

@ -185,21 +185,25 @@ function BorrowModal(props: Props) {
maxText='Max'
disabled={isConfirming}
/>
<Divider className='my-6' />
<div className='flex flex-wrap flex-1'>
<Text className='w-full mb-1'>Receive funds to Wallet</Text>
<Text size='xs' className='text-white/50'>
Your borrowed funds will directly go to your wallet
</Text>
</div>
<div className='flex flex-wrap items-center justify-end'>
<Switch
name='borrow-to-wallet'
checked={borrowToWallet}
onChange={setBorrowToWallet}
disabled={isConfirming}
/>
</div>
{!isRepay && (
<>
<Divider className='my-6' />
<div className='flex flex-wrap flex-1'>
<Text className='w-full mb-1'>Receive funds to Wallet</Text>
<Text size='xs' className='text-white/50'>
Your borrowed funds will directly go to your wallet
</Text>
</div>
<div className='flex flex-wrap items-center justify-end'>
<Switch
name='borrow-to-wallet'
checked={borrowToWallet}
onChange={setBorrowToWallet}
disabled={isConfirming}
/>
</div>
</>
)}
</div>
<Button
onClick={onConfirmClick}

View File

@ -13,8 +13,8 @@ import useStore from 'store'
import { BNCoin } from 'types/classes/BNCoin'
import { byDenom } from 'utils/array'
import { getAssetByDenom, getBaseAsset } from 'utils/assets'
import { BN } from 'utils/helpers'
import { defaultFee } from 'utils/constants'
import { BN } from 'utils/helpers'
interface Props {
account: Account
@ -52,7 +52,7 @@ export default function FundAccount(props: Props) {
coins: fundingAssets,
})
setIsFunding(false)
if (result) useStore.setState({ focusComponent: null, walletAssetsModal: null })
if (result) useStore.setState({ fundAndWithdrawModal: null, walletAssetsModal: null })
}, [fundingAssets, accountId, setIsFunding, deposit])
const handleSelectAssetsClick = useCallback(() => {
@ -115,6 +115,7 @@ export default function FundAccount(props: Props) {
max={BN(balance)}
balances={walletBalances}
maxText='Max'
disabled={isFunding}
className='w-full mb-4'
/>
)
@ -126,6 +127,7 @@ export default function FundAccount(props: Props) {
rightIcon={<Plus />}
iconClassName='w-3'
onClick={handleSelectAssetsClick}
disabled={isFunding}
/>
<SwitchAutoLend
className='pt-4 mt-4 border border-transparent border-t-white/10'