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

View File

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

View File

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