Skip to content

Commit

Permalink
fix: remove duplicate cashoutAllowed check variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nezz0746 committed Oct 4, 2024
1 parent a9fc5e6 commit 7ff72fd
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions src/components/Cashout/Components/Initial.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,13 @@ export const InitialCashoutView = ({
usdValue,
setUsdValue,
setTokenValue,
setRecipient,
recipient,
setPreparedCreateLinkWrapperResponse,
setInitialKYCStep,
setOfframpForm,
crossChainDetails,
}: _consts.ICashoutScreenProps) => {
const { selectedTokenPrice, inputDenomination, selectedChainID } = useContext(context.tokenSelectorContext)

const cannotCashoutOnSelectedChain =
!Boolean(crossChainDetails.find((chain: any) => chain.chainId.toString() === selectedChainID.toString())) ||
selectedChainID === '1'

const { balances, hasFetchedBalances } = useBalance()
const { user, fetchUser, isFetchingUser } = useAuth()
const [, setUserType] = useState<'NEW' | 'EXISTING' | undefined>(undefined)
Expand Down Expand Up @@ -277,10 +271,10 @@ export const InitialCashoutView = ({
selectedBankAccount === account.account_identifier
? 'bg-purple-1'
: 'hover:bg-gray-100',
cannotCashoutOnSelectedChain && 'opacity-60'
!xchainAllowed && 'opacity-60'
)}
onClick={() => {
if (cannotCashoutOnSelectedChain) return
if (!xchainAllowed) return
if (selectedBankAccount === account.account_identifier) {
setSelectedBankAccount(undefined)
} else {
Expand Down Expand Up @@ -327,14 +321,14 @@ export const InitialCashoutView = ({
<div
className={twMerge(
'flex w-full cursor-pointer border border-black p-2',
cannotCashoutOnSelectedChain && 'opacity-60'
!xchainAllowed && 'opacity-60'
)}
>
<label className="ml-2 text-right">To:</label>
<input
type="text"
className={twMerge(
cannotCashoutOnSelectedChain && 'bg-transparent',
!xchainAllowed && 'bg-transparent',
'ml-2 w-full border-none outline-none'
)}
placeholder="IBAN / US account number"
Expand All @@ -343,7 +337,7 @@ export const InitialCashoutView = ({
onFocus={() => setActiveInput('newBankAccount')}
spellCheck="false"
autoComplete="iban"
disabled={cannotCashoutOnSelectedChain}
disabled={!xchainAllowed}
/>
</div>
</motion.div>
Expand All @@ -356,14 +350,14 @@ export const InitialCashoutView = ({
<div
className={twMerge(
'flex w-full cursor-pointer border border-black p-2',
cannotCashoutOnSelectedChain && 'cursor-not-allowed opacity-60'
!xchainAllowed && 'cursor-not-allowed opacity-60'
)}
>
<label className="ml-2 text-right">To:</label>
<input
type="text"
className={twMerge(
cannotCashoutOnSelectedChain && 'cursor-not-allowed bg-transparent',
!xchainAllowed && 'cursor-not-allowed bg-transparent',
'ml-2 w-full border-none outline-none'
)}
placeholder="IBAN / US account number"
Expand All @@ -372,7 +366,7 @@ export const InitialCashoutView = ({
onFocus={() => setActiveInput('newBankAccount')}
spellCheck="false"
autoComplete="iban"
disabled={cannotCashoutOnSelectedChain}
disabled={!xchainAllowed}
/>
</div>
</div>
Expand All @@ -392,8 +386,7 @@ export const InitialCashoutView = ({
(!selectedBankAccount && !newBankAccount) ||
!xchainAllowed ||
!!isBelowMinLimit ||
!!isExceedingMaxLimit ||
cannotCashoutOnSelectedChain
!!isExceedingMaxLimit
}
>
{!isConnected ? (
Expand Down Expand Up @@ -422,7 +415,7 @@ export const InitialCashoutView = ({
{MAX_CASHOUT_LIMIT.toLocaleString()}.
</span>
)}
{cannotCashoutOnSelectedChain && (
{!xchainAllowed && (
<span className=" text-h8 font-normal ">
<ChakraIcon name="warning" className="-mt-0.5" /> You cannot cashout on this chain.
</span>
Expand Down

0 comments on commit 7ff72fd

Please sign in to comment.