update prop name
This commit is contained in:
parent
0c28f3c3c5
commit
ba8504392a
|
@ -66,7 +66,7 @@ const BuyTokenInput = ({
|
||||||
outputBank || group?.banksMapByName.get(OUTPUT_TOKEN_DEFAULT)?.[0]
|
outputBank || group?.banksMapByName.get(OUTPUT_TOKEN_DEFAULT)?.[0]
|
||||||
}
|
}
|
||||||
showTokenList={setShowTokenSelect}
|
showTokenList={setShowTokenSelect}
|
||||||
type="output"
|
tokenType="output"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative col-span-1">
|
<div className="relative col-span-1">
|
||||||
|
|
|
@ -60,7 +60,7 @@ const ReduceInputTokenInput = ({
|
||||||
inputBank || group?.banksMapByName.get(INPUT_TOKEN_DEFAULT)?.[0] // default to a user position
|
inputBank || group?.banksMapByName.get(INPUT_TOKEN_DEFAULT)?.[0] // default to a user position
|
||||||
}
|
}
|
||||||
showTokenList={setShowTokenSelect}
|
showTokenList={setShowTokenSelect}
|
||||||
type="reduce-input"
|
tokenType="reduce-input"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative col-span-1">
|
<div className="relative col-span-1">
|
||||||
|
|
|
@ -53,7 +53,7 @@ const ReduceOutputTokenInput = ({
|
||||||
outputBank || group?.banksMapByName.get(OUTPUT_TOKEN_DEFAULT)?.[0]
|
outputBank || group?.banksMapByName.get(OUTPUT_TOKEN_DEFAULT)?.[0]
|
||||||
}
|
}
|
||||||
showTokenList={setShowTokenSelect}
|
showTokenList={setShowTokenSelect}
|
||||||
type="reduce-output"
|
tokenType="reduce-output"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative col-span-1">
|
<div className="relative col-span-1">
|
||||||
|
|
|
@ -60,7 +60,7 @@ const SellTokenInput = ({
|
||||||
inputBank || group?.banksMapByName.get(INPUT_TOKEN_DEFAULT)?.[0]
|
inputBank || group?.banksMapByName.get(INPUT_TOKEN_DEFAULT)?.[0]
|
||||||
}
|
}
|
||||||
showTokenList={setShowTokenSelect}
|
showTokenList={setShowTokenSelect}
|
||||||
type="input"
|
tokenType="input"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative col-span-1">
|
<div className="relative col-span-1">
|
||||||
|
|
|
@ -112,7 +112,7 @@ const SwapForm = () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[inputBank, outputBank, set],
|
[inputBank, outputBank],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleSetMargin = () => {
|
const handleSetMargin = () => {
|
||||||
|
|
|
@ -11,29 +11,29 @@ import { useTranslation } from 'react-i18next'
|
||||||
type TokenSelectProps = {
|
type TokenSelectProps = {
|
||||||
bank: Bank | undefined
|
bank: Bank | undefined
|
||||||
showTokenList: Dispatch<SetStateAction<SwapFormTokenListType>>
|
showTokenList: Dispatch<SetStateAction<SwapFormTokenListType>>
|
||||||
type: SwapFormTokenListType
|
tokenType: SwapFormTokenListType
|
||||||
}
|
}
|
||||||
|
|
||||||
const TokenSelect = ({ bank, showTokenList, type }: TokenSelectProps) => {
|
const TokenSelect = ({ bank, showTokenList, tokenType }: TokenSelectProps) => {
|
||||||
const { t } = useTranslation('trade')
|
const { t } = useTranslation('trade')
|
||||||
const { group } = useMangoGroup()
|
const { group } = useMangoGroup()
|
||||||
const { mangoAccount } = useMangoAccount()
|
const { mangoAccount } = useMangoAccount()
|
||||||
|
|
||||||
const posType = useMemo(() => {
|
const posType = useMemo(() => {
|
||||||
if (!bank || !mangoAccount || type !== 'reduce-input') return ''
|
if (!bank || !mangoAccount || tokenType !== 'reduce-input') return ''
|
||||||
const uiPos = mangoAccount.getTokenBalanceUi(bank)
|
const uiPos = mangoAccount.getTokenBalanceUi(bank)
|
||||||
if (uiPos > 0) {
|
if (uiPos > 0) {
|
||||||
return 'long'
|
return 'long'
|
||||||
} else if (uiPos < 0) {
|
} else if (uiPos < 0) {
|
||||||
return 'short'
|
return 'short'
|
||||||
}
|
}
|
||||||
}, [bank, mangoAccount, type])
|
}, [bank, mangoAccount, tokenType])
|
||||||
|
|
||||||
if (!group) return null
|
if (!group) return null
|
||||||
|
|
||||||
return bank ? (
|
return bank ? (
|
||||||
<button
|
<button
|
||||||
onClick={() => showTokenList(type)}
|
onClick={() => showTokenList(tokenType)}
|
||||||
className="flex h-[56px] w-full items-center rounded-lg rounded-r-none bg-th-input-bkg px-3 py-2 text-th-fgd-2 focus-visible:bg-th-bkg-3 md:hover:cursor-pointer md:hover:bg-th-bkg-1 md:hover:text-th-fgd-1"
|
className="flex h-[56px] w-full items-center rounded-lg rounded-r-none bg-th-input-bkg px-3 py-2 text-th-fgd-2 focus-visible:bg-th-bkg-3 md:hover:cursor-pointer md:hover:bg-th-bkg-1 md:hover:text-th-fgd-1"
|
||||||
>
|
>
|
||||||
<div className="mr-2.5 flex min-w-[24px] items-center">
|
<div className="mr-2.5 flex min-w-[24px] items-center">
|
||||||
|
|
Loading…
Reference in New Issue