Skip to content

[Internal QA] Expensify Card feed selector#59887

Merged
puneetlath merged 21 commits intoExpensify:mainfrom
callstack-internal:feat/59364-expensify-feed-selector
Apr 15, 2025
Merged

[Internal QA] Expensify Card feed selector#59887
puneetlath merged 21 commits intoExpensify:mainfrom
callstack-internal:feat/59364-expensify-feed-selector

Conversation

@koko57
Copy link
Copy Markdown
Contributor

@koko57 koko57 commented Apr 9, 2025

Explanation of Change

Fixed Issues

$ #59364
PROPOSAL:

Tests

PREREQUISITES: an account with a domain card set up in the OD, ideally with 2 workspaces in the ND - one with Expensify Card set up, one with no Expensify Card setup

Has an Expensify Card set up

  1. In the OD set this workspace as preferred policy in the domain cards settings
  2. Go to the ND to the workspace that was set as a preferred policy
  3. Verify that the workspace cards are displayed
  4. Verify that you see the feed selector
  5. Verify that after clicking the feed selector the selection page is opened
  6. Verify that you see both workspace and domain options - the workspace cards would have workspace name
  7. After clicking the domain feed, the selector page should close and the domain feed cards should be displayed.
  8. Verify that the settings button is displayed and changing the settings work like for the workspace Expensify Card
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

n/a

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

https://github.com/user-attachments/assets/80d5f64f-5e14-4f3b-ac25-858f1cd54ce4
Screenshot 2025-04-09 at 10 32 49
Screenshot 2025-04-09 at 10 32 41
Screenshot 2025-04-09 at 10 24 18

MacOS: Desktop

@koko57 koko57 marked this pull request as ready for review April 9, 2025 10:58
@koko57 koko57 requested a review from a team as a code owner April 9, 2025 10:58
@melvin-bot melvin-bot Bot requested review from dominictb and removed request for a team April 9, 2025 10:58
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented Apr 9, 2025

@dominictb Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@DylanDylann
Copy link
Copy Markdown
Contributor

@koko57 Please align the vertical center two buttons

Screenshot 2025-04-14 at 11 14 15

Comment thread src/components/FeedSelector.tsx Outdated
<CaretWrapper style={styles.flex1}>
<Text style={[styles.textStrong, styles.flexShrink1]}>{feedName}</Text>
</CaretWrapper>
{children}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For displaying RBR, let's introduce a new prop called shouldShowRBR. And at this time I think we can remove children element

@DylanDylann
Copy link
Copy Markdown
Contributor

Should we initialize COLLECTION.LAST_SELECTED_EXPENSIFY_FEED value? Currently, this value will be null until users select another Expensify Feed. I think we need to set a default value for LAST_SELECTED_EXPENSIFY_FEED to workspaceAccountID

@koko57
Copy link
Copy Markdown
Contributor Author

koko57 commented Apr 14, 2025

@DylanDylann

Should we initialize COLLECTION.LAST_SELECTED_EXPENSIFY_FEED value? Currently, this value will be null until users select another Expensify Feed. I think we need to set a default value for LAST_SELECTED_EXPENSIFY_FEED to workspaceAccountID

no, I don't think it's necessary - we always fallback to the workspaceID or fundID when available

Comment thread src/libs/actions/Card.ts
}

function updateSettlementAccount(workspaceAccountID: number, policyID: string, settlementBankAccountID?: number, currentSettlementBankAccountID?: number) {
function updateSettlementAccount(domainName: string, workspaceAccountID: number, policyID: string, settlementBankAccountID?: number, currentSettlementBankAccountID?: number) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to change this function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because prevously we generated the domainName inside function from the policy - now we cannot get it from the policyID like previously
Screenshot 2025-04-14 at 09 40 09

onBackButtonPress={() => Navigation.goBack()}
>
{!shouldUseNarrowLayout && isBankAccountVerified && getHeaderButtons()}
{!shouldShowSelector && !shouldUseNarrowLayout && isBankAccountVerified && getHeaderButtons()}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move isBankAccountVerified check to getHeaderButtons function to avoid duplicated code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, if we move it this View wrapper will be displayed <View style={styles.ph5}>{getHeaderButtons()}</View>

@DylanDylann
Copy link
Copy Markdown
Contributor

no, I don't think it's necessary - we always fallback to the workspaceID or fundID when available

@koko57

  1. Let's clear the cache
  2. Going to Expensify Feed selector page
  3. Notice that there are no tick to indicate the selected option

@koko57
Copy link
Copy Markdown
Contributor Author

koko57 commented Apr 14, 2025

@DylanDylann we don't initiate the laste selected feed with value for company feeds - we fallback to the default feed instead, so I did it similarly for Exfy Card feed

@DylanDylann
Copy link
Copy Markdown
Contributor

@koko57 Prettier check failed

@DylanDylann
Copy link
Copy Markdown
Contributor

DylanDylann commented Apr 14, 2025

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
Screen.Recording.2025-04-14.at.15.39.31.mov
Android: mWeb Chrome
Screen.Recording.2025-04-14.at.15.25.04.mov
iOS: Native
Screen.Recording.2025-04-14.at.15.27.44.mov
iOS: mWeb Safari
Screen.Recording.2025-04-14.at.15.24.48.mov
MacOS: Chrome / Safari
Screen.Recording.2025-04-14.at.15.22.05.mov
MacOS: Desktop
Screen.Recording.2025-04-14.at.15.23.09.mov

@koko57
Copy link
Copy Markdown
Contributor Author

koko57 commented Apr 14, 2025

@DylanDylann prettier fixed

@koko57 koko57 requested a review from DylanDylann April 14, 2025 08:56
@melvin-bot melvin-bot Bot requested a review from puneetlath April 14, 2025 09:11
Copy link
Copy Markdown
Contributor

@puneetlath puneetlath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly some minor comments from me. Should we add some UI tests for this functionality?

Also, does this selector show up if there is a workspace feed and a domain feed? Or only if there are domain feeds? I was trying to test locally

Comment thread src/ONYXKEYS.ts Outdated
Comment thread src/ONYXKEYS.ts Outdated
Comment thread src/hooks/useDefaultFundID.ts
Comment thread src/types/onyx/ExpensifyCardSettings.ts Outdated
Comment thread src/libs/actions/Card.ts Outdated
@koko57
Copy link
Copy Markdown
Contributor Author

koko57 commented Apr 15, 2025

@puneetlath All changes applied! What UI tests do you mean?

The feed selector is always shown when is more than one feed - no matter if there are 2+ domain feeds or a workspace and a domain feed

Copy link
Copy Markdown
Contributor

@puneetlath puneetlath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment.

Comment thread src/hooks/useDefaultFundID.ts Outdated
@puneetlath
Copy link
Copy Markdown
Contributor

What UI tests do you mean?

I didn't have anything specific in mind. Just wondering if there is anything here that we can add tests for. All good if not.

Co-authored-by: Puneet Lath <puneet@expensify.com>
@koko57
Copy link
Copy Markdown
Contributor Author

koko57 commented Apr 15, 2025

I didn't have anything specific in mind. Just wondering if there is anything here that we can add tests for. All good if not.

@puneetlath no, I don't think they are necessary here
commited the change you requested

@puneetlath puneetlath merged commit ee9ae8b into Expensify:main Apr 15, 2025
16 checks passed
@OSBotify
Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 9.1.29-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.1.29-10 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅


const getHeaderButtons = () => (
<View style={[styles.w100, styles.flexRow, styles.gap2, shouldUseNarrowLayout && styles.mb3]}>
<View style={[styles.flexRow, styles.gap2, shouldChangeLayout && styles.mb3, shouldShowSelector && shouldChangeLayout && styles.mt3]}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldChangeLayout && styles.mb3 caused the button to misalign on medium screens (issue #65652).

Fixed in PR #66250 by adding the margin only on narrow layouts.

},
});

if (lastSelectedExpensifyCardFeed) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also consider lastSelectedCardSettings availability here because if the lastSelectedExpensifyCardFeed value workspace is deleted then it doesn't make sense to return that feed number. Issue #65592


const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [cardsList, cardsListResult] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${fundID}_${CONST.EXPENSIFY_CARD.BANK}`, {selector: filterInactiveCards});
const [cardsList, cardsListResult] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${defaultFundID}_${CONST.EXPENSIFY_CARD.BANK}`, {selector: filterInactiveCards});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming from #67491, this change will introduce an issue where App displays the "Not here" page when opening a card from another feed. More details on RC & solution: #67491 (comment)

<View style={styles.flex1}>
<View style={[styles.flexRow, styles.gap1]}>
<CaretWrapper style={styles.flex1}>
<Text style={[styles.textStrong, styles.flexShrink1]}>{feedName}</Text>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Came from this issue
We had an issue where the Card feed name is displayed partially with a blank space on Android 16
More context here

@koko57 koko57 deleted the feat/59364-expensify-feed-selector branch March 30, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants