Skip to content

[No QA] [Workspace Feeds] Create new Card List page - #44469

Merged
mountiny merged 37 commits into
Expensify:mainfrom
VickyStash:feature/expensify-card-list
Jul 2, 2024
Merged

mountiny merged 37 commits into
Expensify:mainfrom
VickyStash:feature/expensify-card-list

Conversation

@VickyStash

@VickyStash VickyStash commented Jun 26, 2024 •

Copy link
Copy Markdown
Contributor

Details

[Workspace Feeds] Create new Card List page

Fixed Issues

$ #44310
PROPOSAL: N/A

Tests

  • Verify that no errors appear in the JS console

Pre-steps:

Add a new menu item to a workspace menu to simplify testing.
Insert this part of code into WorkspaceInitialPage screen.

protectedCollectPolicyMenuItems.push({
    translationKey: 'workspace.common.expensifyCard',
    icon: Expensicons.CreditCard,
    action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policyID)))),
    routeName: SCREENS.WORKSPACE.EXPENSIFY_CARD,
});

You should see Expensify Card option in the workspace menu now.

Test steps:

  1. Open Expensify Card page.
  2. Make sure the page looks as expected.
  3. Tap on info icon of Current Balance/Remaining Limit/Cash Back info blocks. Make sure popup with additional info appears. Remaining Limit popup should also have button to Require limit increase.

NOTE: the data is mocked for now, API endpoints are in progress.

Offline tests

N/A

QA Steps

  • Verify that no errors appear in the JS console

N/A

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 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
      • If any non-english text was added/modified, I verified the translation was requested/reviewed 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.js 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.
  • 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
android1

Android: mWeb Chrome

android_web
android_web1

iOS: Native

ios
ios1

iOS: mWeb Safari

ios_web
ios_web1

MacOS: Chrome / Safari web web1
MacOS: Desktop

desktop
desktop1

Comment thread src/languages/es.ts Outdated
@VickyStash VickyStash changed the title [WIP] [Workspace Feeds] Create new Card List page [No QA] [Workspace Feeds] Create new Card List page Jun 27, 2024
@VickyStash
VickyStash marked this pull request as ready for review June 27, 2024 13:52
@VickyStash
VickyStash requested review from a team as code owners June 27, 2024 13:52
@melvin-bot
melvin-bot Bot requested review from DylanDylann and removed request for a team June 27, 2024 13:52
@melvin-bot

melvin-bot Bot commented Jun 27, 2024

Copy link
Copy Markdown

@DylanDylann 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]

@shawnborton

Copy link
Copy Markdown
Contributor

Looking good! For the limit column, can we use a currency symbol?
CleanShot 2024-06-27 at 18 47 30@2x

Comment thread src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx Outdated
Comment thread src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx Outdated
@shawnborton

Copy link
Copy Markdown
Contributor

Can you share a quick screen recording when you get a chance as well? Thanks!

@allgandalf

Copy link
Copy Markdown
Contributor

@VickyStash , I would be reviewing this PR instead of @DylanDylann , do let me know when you implement the latest suggestions from @shawnborton , I will start my review after the changes thanks

@trjExpensify
trjExpensify requested review from allgandalf and removed request for DylanDylann June 27, 2024 19:14

@allgandalf allgandalf left a comment

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.

left some comments, will review the page UI once the suggestions from shawn are implemented

@@ -0,0 +1,6 @@
type OpenPolicyExpensifyCardsPageParams = {
policyID: string;
authToken: string | null | undefined;

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 don't think we should have a auth token ever as undefined, null case is okay but i highly doubt that we should keep it's type as undefined, what's your take on this @VickyStash ?

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.

That's the return type of the getAuthToken function

function getAuthToken(): string | null | undefined {
return authToken;
}

But I agree that undefined can be removed, but I'm not sure that I should do it in this PR.

@@ -0,0 +1,6 @@
type RequestExpensifyCardLimitIncreaseParams = {
authToken: string | null | undefined;

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.

Same as ^

// const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARDS_LIST}${policyID}_Expensify Card`);
const cardsList = mockedCards;

const fetchExpensifyCards = useCallback(() => {

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.

Isn't useMemo more appropriate here? , well there must be a reason for useCallback can you explain please

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.

I wanted to keep it aligned with other places in the code:

const fetchTags = useCallback(() => {
Tag.openPolicyTagsPage(policyID);
}, [policyID]);

const fetchPolicyData = useCallback(() => {
Policy.openPolicyInitialPage(route.params.policyID);
}, [route.params.policyID]);

Comment thread src/types/onyx/ExpensifyCard.ts Outdated

@allgandalf allgandalf left a comment

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.

Tested the latest changes, Look good to merge !

Comment thread src/ONYXKEYS.ts Outdated
Comment on lines +434 to +435
/** Expensify cards list */
EXPENSIFY_CARDS_LIST: 'card_',

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.

Suggested change
/** Expensify cards list */
EXPENSIFY_CARDS_LIST: 'card_',
/**
* Stores the card list for a given fundID and feed in the format: card_<fundID>_<bankName>
* So for example: card_12345_ExpensifyCard
*/
EXPENSIFY_CARDS_LIST: 'card_',

@MariaHCD MariaHCD left a comment

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.

Just have a question on removing the ExpensifyCard.ts in favor of Card.ts

https://github.com/Expensify/App/pull/44469/files#r1662157151

@koko57

koko57 commented Jul 2, 2024 •

Copy link
Copy Markdown
Contributor

@MariaHCD yes in a sec, totally haven't thought about it 😅

Comment thread src/ONYXKEYS.ts Outdated

/**
* Stores the card list for a given fundID and feed in the format: card_<fundID>_<bankName>
* So for example: card_12345_ExpensifyCard

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.

Sorry, apparently its with a space

Suggested change
* So for example: card_12345_ExpensifyCard
* So for example: card_12345_Expensify Card

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.

That is the card name right? <bankName> would be different here 🤔

@MariaHCD MariaHCD Jul 2, 2024 •

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.

@allgandalf it's not the name of the card, it's the name of the card feed which is referred to as bankName internally. For this project, the feed / bankName is Expensify Card - we will have more feeds introduced in the future.

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.

ahh, now that makes more sense to me 👍

Comment thread src/ONYXKEYS.ts Outdated
* Stores the card list for a given fundID and feed in the format: card_<fundID>_<bankName>
* So for example: card_12345_ExpensifyCard
*/
EXPENSIFY_CARDS_LIST: 'card_',

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.

Not sure what is the best const name here so it doe snot intervene with the cardsList key

I dont think we should use Expensify_cards list as this will be reused for other feeds that are not necessarily Expensify cards cc @MariaHCD

I feel like Workspace might be ok, but also it might be be that clear with the domain feeds that are not strictly tied to a workspace

Suggested change
EXPENSIFY_CARDS_LIST: 'card_',
WORKSPACE_CARDS_LIST: 'card_',

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.

Fair point. I'm thinking EXPENISFY_CARDS_LIST still makes the most sense.

Alternatively, we can go with WORKSPACE_CARDS_LIST and then for domain feeds it could a new const called DOMAIN_CARDS_LIST

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.

But having just one makes the most sense, I think so I'm still fine with EXPENISFY_CARDS_LIST

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.

Okay, looks like we're going with WORKSPACE_CARDS_LIST. I'm fine with that since it is more clear. We can change it down the line without much difficulty if we find it's not suitable for domain feeds.

@mountiny mountiny left a comment

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.

@koko57 couple comments

Comment thread src/pages/workspace/WorkspaceMoreFeaturesPage.tsx Outdated
Comment thread src/pages/workspace/WorkspaceMoreFeaturesPage.tsx Outdated
Comment thread src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPage.tsx Outdated
Comment thread src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPage.tsx Outdated
Comment thread src/types/onyx/Card.ts Outdated
Comment thread src/types/onyx/ExpensifyCard.ts Outdated
import type PersonalDetails from './PersonalDetails';

/** Model of an Expensify card */
type ExpensifyCard = OnyxCommon.OnyxValueWithOfflineFeedback<{

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.

+1, I assume we could reuse the same model

@koko57

koko57 commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

@mountiny addressed

@allgandalf

Copy link
Copy Markdown
Contributor

are all the comments addressed @koko57 ? I will test once again on all platforms just to be sure

@koko57

koko57 commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

@allgandalf yep, all addressed

@allgandalf allgandalf left a comment

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.

Initial checklist is here, Tested again on all platforms after latest changes. Tests well on all platforms:

Screenshots/Videos

Android: Native
Screen.Recording.2024-07-02.at.6.15.28.PM.mov
Android: mWeb Chrome Screenshot 2024-07-02 at 6 19 31 PM
iOS: Native Screenshot 2024-07-02 at 6 14 18 PM
iOS: mWeb Safari Screenshot 2024-07-02 at 6 16 49 PM
MacOS: Chrome / Safari Screenshot 2024-07-02 at 6 13 45 PM
MacOS: Desktop Screenshot 2024-07-02 at 6 17 39 PM

@melvin-bot
melvin-bot Bot requested a review from mountiny July 2, 2024 12:50

@mountiny mountiny left a comment

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.

Thank you for addressing the feedback

@mountiny

mountiny commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

Seems like design also liked the changes so I am going to go ahead and merge this

@mountiny
mountiny merged commit 5c71954 into Expensify:main Jul 2, 2024
@OSBotify

OSBotify commented Jul 2, 2024

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.

@OSBotify

OSBotify commented Jul 3, 2024

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.4-0 🚀

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

@OSBotify

OSBotify commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/tgolen in version: 9.0.4-5 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/Julesssss in version: 9.0.5-13 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.6-8 🚀

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants