From 5bb7adf58c0b48752f4f1c3b76177463e31d5cae Mon Sep 17 00:00:00 2001 From: Reed <3893871+dharit-tan@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:40:23 -0500 Subject: [PATCH] [PAY-2270] Show vendor button only if more than 1 vendor (#6945) --- .../src/components/payment-method/PaymentMethod.tsx | 12 ++++++++++-- .../PremiumTrackPurchaseDrawer.tsx | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/mobile/src/components/payment-method/PaymentMethod.tsx b/packages/mobile/src/components/payment-method/PaymentMethod.tsx index 850099ca4f7..f5bab1d2280 100644 --- a/packages/mobile/src/components/payment-method/PaymentMethod.tsx +++ b/packages/mobile/src/components/payment-method/PaymentMethod.tsx @@ -7,7 +7,8 @@ import { formatCurrencyBalance, FeatureFlags, useFeatureFlag, - PurchaseVendor + PurchaseVendor, + removeNullable } from '@audius/common' import BN from 'bn.js' import { FlatList, View, TouchableOpacity } from 'react-native' @@ -87,6 +88,10 @@ export const PaymentMethod = ({ const purchaseVendor = useSelector(getPurchaseVendor) const { isEnabled: isCoinflowEnabled, isLoaded: isCoinflowEnabledLoaded } = useFeatureFlag(FeatureFlags.BUY_WITH_COINFLOW) + const vendorOptions = [ + isCoinflowEnabled ? PurchaseVendor.COINFLOW : null, + PurchaseVendor.STRIPE + ].filter(removeNullable) // Initial state is coinflow by default, but set to stripe if coinflow is disabled. useEffect(() => { @@ -105,7 +110,10 @@ export const PaymentMethod = ({ ), icon: IconCreditCard, - content: + content: + vendorOptions.length > 1 ? ( + + ) : null }, { id: PurchaseMethod.CRYPTO, diff --git a/packages/mobile/src/components/premium-track-purchase-drawer/PremiumTrackPurchaseDrawer.tsx b/packages/mobile/src/components/premium-track-purchase-drawer/PremiumTrackPurchaseDrawer.tsx index 4df4f2c3079..6d71bbbfb18 100644 --- a/packages/mobile/src/components/premium-track-purchase-drawer/PremiumTrackPurchaseDrawer.tsx +++ b/packages/mobile/src/components/premium-track-purchase-drawer/PremiumTrackPurchaseDrawer.tsx @@ -325,7 +325,7 @@ const RenderForm = ({ setSelectedMethod={setPurchaseMethod} balance={balance} isExistingBalanceDisabled={isExistingBalanceDisabled} - showExistingBalance={!balance?.isZero} + showExistingBalance={!balance?.isZero()} /> )}