Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/FeedSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import {View} from 'react-native';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -32,6 +33,7 @@ type Props = {
function FeedSelector({onFeedSelect, CardFeedIcon, feedName, supportingText, shouldShowRBR = false, isLoading = false}: Props) {
const styles = useThemeStyles();
const theme = useTheme();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const expensifyIcons = useMemoizedLazyExpensifyIcons(['DotIndicator'] as const);

if (isLoading) {
Expand All @@ -49,7 +51,7 @@ function FeedSelector({onFeedSelect, CardFeedIcon, feedName, supportingText, sho

<View style={styles.flex1}>
<View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
<CaretWrapper>
<CaretWrapper style={[shouldUseNarrowLayout && styles.flex1]}>
<Text
numberOfLines={1}
style={[styles.textStrong, styles.flexShrink1]}
Expand Down
5 changes: 5 additions & 0 deletions src/libs/CardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,10 @@ function getCompanyCardFeed(feedWithDomainID: string | undefined): CompanyCardFe
return feed as CompanyCardFeed;
}

function isCardWithBrokenConnection(card: Card): boolean {
return !!card.lastScrapeResult && !CONST.COMPANY_CARDS.BROKEN_CONNECTION_IGNORED_STATUSES.includes(card.lastScrapeResult);
}

type SplitMaskedCardNumberResult = {
firstDigits?: string;
lastDigits?: string;
Expand Down Expand Up @@ -944,6 +948,7 @@ export {
isCardPendingIssue,
isCardPendingActivate,
hasPendingExpensifyCardAction,
isCardWithBrokenConnection,
isExpensifyCardPendingAction,
getFundIdFromSettingsKey,
isCardPendingReplace,
Expand Down
4 changes: 3 additions & 1 deletion src/pages/settings/Wallet/PaymentMethodList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getAssignedCardSortKey,
getCardFeedIcon,
getPlaidInstitutionIconUrl,
isCardWithBrokenConnection,
isExpensifyCard,
isExpensifyCardPendingAction,
lastFourNumbersFromCardName,
Expand Down Expand Up @@ -209,6 +210,7 @@ function PaymentMethodList({
const pressHandler = onPress as CardPressHandler;
const lastFourPAN = lastFourNumbersFromCardName(card.cardName);
const plaidUrl = getPlaidInstitutionIconUrl(card.bank);
const isCardBroken = isCardWithBrokenConnection(card);
assignedCardsGrouped.push({
key: card.cardID.toString(),
plaidUrl,
Expand All @@ -223,7 +225,7 @@ function PaymentMethodList({
errors: card.errors,
pendingAction: card.pendingAction,
brickRoadIndicator:
card.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.DOMAIN || card.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.INDIVIDUAL || !!card.errors
!isCardBroken && (card.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.DOMAIN || card.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.INDIVIDUAL || !!card.errors)
? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR
: undefined,
icon,
Expand Down
20 changes: 9 additions & 11 deletions src/pages/settings/Wallet/PaymentMethodListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useCallback, useRef} from 'react';
import React, {useRef} from 'react';
import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import type {ValueOf} from 'type-fest';
Expand Down Expand Up @@ -101,23 +101,21 @@
}
};

const getBadgeText = useCallback(
(listItem: PaymentMethodItem) => {
if (isAccountInSetupState(listItem)) {
return translate('common.actionRequired');
}
return shouldShowDefaultBadge ? translate('paymentMethodList.defaultPaymentMethod') : undefined;
},
[shouldShowDefaultBadge, translate],
);
const getBadgeText = (listItem: PaymentMethodItem) => {
if (isAccountInSetupState(listItem)) {
return translate('common.actionRequired');
}
return shouldShowDefaultBadge ? translate('paymentMethodList.defaultPaymentMethod') : undefined;
};

return (
<OfflineWithFeedback
onClose={item.canDismissError ? () => dismissError(item) : undefined}
pendingAction={item.pendingAction}
errors={item.errors}
errorRowStyles={styles.ph6}
shouldShowErrorMessages={false}
canDismissError={item.canDismissError}

Check failure on line 117 in src/pages/settings/Wallet/PaymentMethodListItem.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Type '{ children: Element; onClose: (() => void) | undefined; pendingAction: PendingAction | undefined; errors: Errors | undefined; errorRowStyles: { paddingHorizontal: number; }; canDismissError: boolean | undefined; shouldShowErrorMessages: boolean; }' is not assignable to type 'IntrinsicAttributes & Partial<ChildrenProps> & { pendingAction?: PendingAction | undefined; shouldHideOnDelete?: boolean | undefined; ... 12 more ...; dismissError?: (() => void) | undefined; }'.
shouldShowErrorMessages={!!item.errors}
>
<MenuItem
onPress={handleRowPress}
Expand Down
Loading