update prop name

This commit is contained in:
tjs 2023-09-21 17:22:04 -04:00
parent 0c28f3c3c5
commit ba8504392a
6 changed files with 10 additions and 10 deletions

View File

@ -66,7 +66,7 @@ const BuyTokenInput = ({
outputBank || group?.banksMapByName.get(OUTPUT_TOKEN_DEFAULT)?.[0]
}
showTokenList={setShowTokenSelect}
type="output"
tokenType="output"
/>
</div>
<div className="relative col-span-1">

View File

@ -60,7 +60,7 @@ const ReduceInputTokenInput = ({
inputBank || group?.banksMapByName.get(INPUT_TOKEN_DEFAULT)?.[0] // default to a user position
}
showTokenList={setShowTokenSelect}
type="reduce-input"
tokenType="reduce-input"
/>
</div>
<div className="relative col-span-1">

View File

@ -53,7 +53,7 @@ const ReduceOutputTokenInput = ({
outputBank || group?.banksMapByName.get(OUTPUT_TOKEN_DEFAULT)?.[0]
}
showTokenList={setShowTokenSelect}
type="reduce-output"
tokenType="reduce-output"
/>
</div>
<div className="relative col-span-1">

View File

@ -60,7 +60,7 @@ const SellTokenInput = ({
inputBank || group?.banksMapByName.get(INPUT_TOKEN_DEFAULT)?.[0]
}
showTokenList={setShowTokenSelect}
type="input"
tokenType="input"
/>
</div>
<div className="relative col-span-1">

View File

@ -112,7 +112,7 @@ const SwapForm = () => {
}
})
},
[inputBank, outputBank, set],
[inputBank, outputBank],
)
const handleSetMargin = () => {

View File

@ -11,29 +11,29 @@ import { useTranslation } from 'react-i18next'
type TokenSelectProps = {
bank: Bank | undefined
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 { group } = useMangoGroup()
const { mangoAccount } = useMangoAccount()
const posType = useMemo(() => {
if (!bank || !mangoAccount || type !== 'reduce-input') return ''
if (!bank || !mangoAccount || tokenType !== 'reduce-input') return ''
const uiPos = mangoAccount.getTokenBalanceUi(bank)
if (uiPos > 0) {
return 'long'
} else if (uiPos < 0) {
return 'short'
}
}, [bank, mangoAccount, type])
}, [bank, mangoAccount, tokenType])
if (!group) return null
return bank ? (
<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"
>
<div className="mr-2.5 flex min-w-[24px] items-center">