show margin switch on swap form
This commit is contained in:
parent
ef1bdd11fe
commit
ba6799c202
|
@ -68,7 +68,9 @@ const AssetsBorrowsTable = () => {
|
||||||
}
|
}
|
||||||
const borrows = bank.uiBorrows()
|
const borrows = bank.uiBorrows()
|
||||||
|
|
||||||
const available = group ? getAvailableToBorrow(b, group) : 0
|
const available = group
|
||||||
|
? getAvailableToBorrow(b, group).toNumber()
|
||||||
|
: 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TrBody key={bank.name}>
|
<TrBody key={bank.name}>
|
||||||
|
@ -136,7 +138,9 @@ const AssetsBorrowsTable = () => {
|
||||||
)?.logoURI
|
)?.logoURI
|
||||||
}
|
}
|
||||||
|
|
||||||
const available = group ? getAvailableToBorrow(b, group) : 0
|
const available = group
|
||||||
|
? getAvailableToBorrow(b, group).toNumber()
|
||||||
|
: 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Disclosure key={bank.name}>
|
<Disclosure key={bank.name}>
|
||||||
|
|
|
@ -49,6 +49,7 @@ import InlineNotification from '@components/shared/InlineNotification'
|
||||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||||
import Tooltip from '@components/shared/Tooltip'
|
import Tooltip from '@components/shared/Tooltip'
|
||||||
import { formatCurrencyValue } from 'utils/numbers'
|
import { formatCurrencyValue } from 'utils/numbers'
|
||||||
|
import Switch from '@components/forms/Switch'
|
||||||
|
|
||||||
const MAX_DIGITS = 11
|
const MAX_DIGITS = 11
|
||||||
export const withValueLimit = (values: NumberFormatValues): boolean => {
|
export const withValueLimit = (values: NumberFormatValues): boolean => {
|
||||||
|
@ -275,6 +276,12 @@ const SwapForm = () => {
|
||||||
)
|
)
|
||||||
}, [amountInAsDecimal, amountOutAsDecimal, connected, selectedRoute])
|
}, [amountInAsDecimal, amountOutAsDecimal, connected, selectedRoute])
|
||||||
|
|
||||||
|
const handleSetMargin = () => {
|
||||||
|
set((s) => {
|
||||||
|
s.swap.margin = !s.swap.margin
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContentBox
|
<ContentBox
|
||||||
hidePadding
|
hidePadding
|
||||||
|
@ -507,12 +514,11 @@ const SwapForm = () => {
|
||||||
{t('swap:margin')}
|
{t('swap:margin')}
|
||||||
</p>
|
</p>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<LinkButton
|
<Switch
|
||||||
className="text-right text-sm font-normal text-th-fgd-2 underline underline-offset-2 md:hover:no-underline"
|
className="text-th-fgd-3"
|
||||||
onClick={() => setShowSettings(true)}
|
checked={useMargin}
|
||||||
>
|
onChange={handleSetMargin}
|
||||||
{useMargin ? t('swap:enabled') : t('swap:disabled')}
|
/>
|
||||||
</LinkButton>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<p className="text-sm text-th-fgd-3">{t('swap:max-slippage')}</p>
|
<p className="text-sm text-th-fgd-3">{t('swap:max-slippage')}</p>
|
||||||
|
|
Loading…
Reference in New Issue