-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add inactive pill to cardlist, show frozen card #82961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5814f30
a2dc5b4
85bc487
b7ea5be
562c816
bd366bc
3ea95c5
3839352
37540c6
1405a10
cf6d3da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -309,6 +309,7 @@ function PaymentMethodList({ | |
| iconWidth: variables.cardIconWidth, | ||
| iconHeight: variables.cardIconHeight, | ||
| isMethodActive: activePaymentMethodID === card.cardID, | ||
| isSuspended: card.state === CONST.EXPENSIFY_CARD.STATE.STATE_SUSPENDED && !card.nameValuePairs?.frozen, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ CONSISTENCY-3 (docs)The expression Extract a utility function in function isCardInactive(card?: OnyxEntry<Card>): boolean {
return card?.state === CONST.EXPENSIFY_CARD.STATE.STATE_SUSPENDED && !card?.nameValuePairs?.frozen;
}Then use it in both locations: isSuspended: isCardInactive(card),Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency. |
||
| onPress: cardOnPress, | ||
| }); | ||
| continue; | ||
|
|
@@ -372,6 +373,7 @@ function PaymentMethodList({ | |
| iconStyles: [styles.cardIcon], | ||
| iconWidth: variables.cardIconWidth, | ||
| iconHeight: variables.cardIconHeight, | ||
| isSuspended: card.state === CONST.EXPENSIFY_CARD.STATE.STATE_SUSPENDED && !card.nameValuePairs?.frozen, | ||
| isCardFrozen: isCardFrozen(card), | ||
| }); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ CLEAN-REACT-PATTERNS-1 (docs)
Adding a new optional
ReactNodeprop (descriptionAddon) toMenuItemis a Case 2 violation -- its sole purpose is conditional rendering ({!!descriptionAddon && (...)}) and gating another block ({!descriptionAddon && !!description && (...)}). This continues the configuration-heavy pattern of MenuItem rather than moving toward composition.MenuItem already has a large prop interface with many optional content/slot props (
rightComponent,furtherDetailsComponent, etc.). Each new slot prop increases the component's surface area and makes it harder to refactor toward composition in the future.Consider rendering the badge inline at the call site in
PaymentMethodListItemrather than threading it through MenuItem as a new prop. Alternatively, if MenuItem needs to support this pattern, a compound component approach (e.g.,<MenuItem.DescriptionAddon>) would keep the component's prop interface stable.Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.