-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Update the Assigned Cards Section of the Wallet Page #38998
Merged
grgia
merged 26 commits into
Expensify:main
from
software-mansion-labs:@szymczak/update-cards-section
Apr 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0515ffb
make wallet page cards grouped by domain
SzymczakJ ecdcf48
Merge branch 'main' into @szymczak/update-cards-section
SzymczakJ 804005a
Merge branch 'main' into @szymczak/update-cards-section
SzymczakJ 71c86a2
fix navigation on lost/fraud/actvate card flows
SzymczakJ 13674cd
fix navigation on get physical card flow
SzymczakJ e5d8cc5
fix PR comments
SzymczakJ a26532f
Merge branch 'main' into @szymczak/update-cards-section
SzymczakJ ecd7c73
Merge branch 'main' into @szymczak/update-cards-section
SzymczakJ 6bf60e9
make card row title depend on cardTitle when card is admin assigned
SzymczakJ a10788e
adjust expensifyCardPage title
SzymczakJ bc9ce69
fix PR comments
SzymczakJ c19eb59
fix PR comments
SzymczakJ ae6f359
fix types
SzymczakJ 24321a9
Merge branch 'main' into @szymczak/update-cards-section
SzymczakJ 70d02e4
fix nameValuePairs bugs
SzymczakJ 55bed2d
fix PR comments
SzymczakJ 5b9ad8c
Merge branch 'main' into @szymczak/update-cards-section
SzymczakJ a8454dc
fix button margins
SzymczakJ 4f6ee19
add spanish translations
SzymczakJ 0486463
merge main
SzymczakJ f989cea
fix PR comments
SzymczakJ f114894
fix navigation bugs
SzymczakJ d542600
remove redundant types
SzymczakJ c7a0f12
fix ExpensifyCardPage bug
SzymczakJ 0458752
fix pr comments
SzymczakJ f915905
fix lint errors
SzymczakJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,22 +78,22 @@ function ExpensifyCardPage({ | |
privatePersonalDetails, | ||
loginList, | ||
route: { | ||
params: {domain = '', cardId = ''}, | ||
params: {domain = '', cardID = ''}, | ||
}, | ||
}: ExpensifyCardPageProps) { | ||
const styles = useThemeStyles(); | ||
const {isOffline} = useNetwork(); | ||
const {translate} = useLocalize(); | ||
const shouldDisplayCardDomain = !cardList?.[cardId].nameValuePairs?.issuedBy; | ||
const pageTitle = shouldDisplayCardDomain ? translate('cardPage.expensifyCard') : cardList?.[cardId].nameValuePairs?.cardTitle ?? translate('cardPage.expensifyCard'); | ||
const shouldDisplayCardDomain = !cardList?.[cardID].nameValuePairs?.issuedBy; | ||
const pageTitle = shouldDisplayCardDomain ? translate('cardPage.expensifyCard') : cardList?.[cardID].nameValuePairs?.cardTitle ?? translate('cardPage.expensifyCard'); | ||
|
||
const [isNotFound, setIsNotFound] = useState(false); | ||
const cardsToShow = useMemo(() => { | ||
if (shouldDisplayCardDomain) { | ||
return CardUtils.getDomainCards(cardList)[domain].filter((card) => !card.nameValuePairs?.issuedBy); | ||
} | ||
return [cardList?.[cardId]]; | ||
}, [shouldDisplayCardDomain, cardList, cardId, domain]); | ||
return [cardList?.[cardID]]; | ||
}, [shouldDisplayCardDomain, cardList, cardID, domain]); | ||
useEffect(() => { | ||
setIsNotFound(!cardsToShow); | ||
}, [cardList, cardsToShow]); | ||
|
@@ -104,30 +104,30 @@ function ExpensifyCardPage({ | |
const [isCardDetailsLoading, setIsCardDetailsLoading] = useState<Record<number, boolean>>({}); | ||
const [cardsDetailsErrors, setCardsDetailsErrors] = useState<Record<number, string>>({}); | ||
|
||
const handleRevealDetails = (revealedCardId: number) => { | ||
const handleRevealDetails = (revealedcardID: number) => { | ||
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.
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. (camel case) |
||
setIsCardDetailsLoading((prevState: Record<number, boolean>) => ({ | ||
...prevState, | ||
[revealedCardId]: true, | ||
[revealedcardID]: true, | ||
})); | ||
// We can't store the response in Onyx for security reasons. | ||
// That is why this action is handled manually and the response is stored in a local state | ||
// Hence eslint disable here. | ||
// eslint-disable-next-line rulesdir/no-thenable-actions-in-views | ||
Card.revealVirtualCardDetails(revealedCardId) | ||
Card.revealVirtualCardDetails(revealedcardID) | ||
.then((value) => { | ||
setCardsDetails((prevState: Record<number, TCardDetails | null>) => ({...prevState, [revealedCardId]: value as TCardDetails})); | ||
setCardsDetails((prevState: Record<number, TCardDetails | null>) => ({...prevState, [revealedcardID]: value as TCardDetails})); | ||
setCardsDetailsErrors((prevState) => ({ | ||
...prevState, | ||
[revealedCardId]: '', | ||
[revealedcardID]: '', | ||
})); | ||
}) | ||
.catch((error) => { | ||
setCardsDetailsErrors((prevState) => ({ | ||
...prevState, | ||
[revealedCardId]: error, | ||
[revealedcardID]: error, | ||
})); | ||
}) | ||
.finally(() => setIsCardDetailsLoading((prevState: Record<number, boolean>) => ({...prevState, [revealedCardId]: false}))); | ||
.finally(() => setIsCardDetailsLoading((prevState: Record<number, boolean>) => ({...prevState, [revealedcardID]: false}))); | ||
}; | ||
|
||
const hasDetectedDomainFraud = cardsToShow?.some((card) => card?.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.DOMAIN); | ||
|
@@ -249,7 +249,7 @@ function ExpensifyCardPage({ | |
titleStyle={styles.walletCardMenuItem} | ||
icon={Expensicons.Flag} | ||
shouldShowRightIcon | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_REPORT_FRAUD.getRoute(domain, cardId))} | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_REPORT_FRAUD.getRoute(domain, cardID))} | ||
/> | ||
</> | ||
))} | ||
|
@@ -269,7 +269,7 @@ function ExpensifyCardPage({ | |
title={translate('reportCardLostOrDamaged.report')} | ||
icon={Expensicons.Flag} | ||
shouldShowRightIcon | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED.getRoute(domain, cardId))} | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED.getRoute(domain, cardID))} | ||
/> | ||
</> | ||
); | ||
|
@@ -282,7 +282,7 @@ function ExpensifyCardPage({ | |
success | ||
large | ||
style={[styles.w100, styles.p5]} | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_WALLET_CARD_ACTIVATE.getRoute(domain, cardId))} | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_WALLET_CARD_ACTIVATE.getRoute(domain, cardID))} | ||
text={translate('activateCardPage.activatePhysicalCard')} | ||
/> | ||
)} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I am curious to know why we include
cardID
also in the route when a domain can have multiple cards (and hence multiplecardID
s). Shouldn’t it be without thecardID
just like how it was before i.e.settings/wallet/card/:domain
or am I missing something here? This also seems to introduce an issue where reporting ofVirtual card fraud
orloss of physical card
would show up the route with incorrectcardID
. Here is a test video to demonstrate this:38468-reporting-issue.mp4
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.
good point, dunno why I didn't think of that before