allow leverage sliding while not connected
This commit is contained in:
parent
1257c73662
commit
e36a88ddbd
|
@ -73,15 +73,20 @@ export const SwapLeverageSlider = ({
|
|||
amount: number
|
||||
onChange: (x: string) => void
|
||||
}) => {
|
||||
const mangoAccountNotLoaded = mangoStore((s) => s.mangoAccount.initialLoad)
|
||||
const { amountWithBorrow } = useTokenMax()
|
||||
|
||||
return (
|
||||
<>
|
||||
<LeverageSlider
|
||||
amount={amount}
|
||||
leverageMax={amountWithBorrow}
|
||||
onChange={onChange}
|
||||
/>
|
||||
{mangoAccountNotLoaded ? (
|
||||
<LeverageSlider amount={amount} leverageMax={100} onChange={onChange} />
|
||||
) : (
|
||||
<LeverageSlider
|
||||
amount={amount}
|
||||
leverageMax={amountWithBorrow}
|
||||
onChange={onChange}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -382,6 +382,7 @@ const MaxSwapAmount = ({
|
|||
setAmountIn: (x: any) => void
|
||||
useMargin: boolean
|
||||
}) => {
|
||||
const mangoAccountLoading = mangoStore((s) => s.mangoAccount.initialLoad)
|
||||
const { t } = useTranslation('common')
|
||||
const { amount: tokenMax, amountWithBorrow } = useTokenMax()
|
||||
|
||||
|
@ -390,6 +391,8 @@ const MaxSwapAmount = ({
|
|||
setAmountIn(amountIn)
|
||||
}
|
||||
|
||||
if (mangoAccountLoading) return null
|
||||
|
||||
return (
|
||||
<LinkButton className="no-underline" onClick={setMaxInputAmount}>
|
||||
<span className="font-normal text-th-fgd-4">{t('max')}:</span>
|
||||
|
|
Loading…
Reference in New Issue