Add CurrencySelectionList component and use it in IOU and WS currency settings
Details
Fixed Issues
$ https://github.com/Expensify/App/issues/29618 PROPOSAL: https://github.com/Expensify/App/issues/29618#issuecomment-1785638160
Tests
- Go to workspace settings and select default currency
- The currency selection list will appears and type "euro"
- The euro currency must be available in the list
- Select the euro currency, then notice the default currency is changed into euro
- Repeat step 2-4 for other search text like "rupee", "pound", "Australia" then notice the Indian rupee , England pounds, Australia dollar is available in the list for the respected search text
- Go to
+fab button -> select money request -> go to manual tab -> click the currency - Repeat the step 2-5
- Go to IOU request money address like:
https://dev.new.expensify.com:8082/request/new/currency/?currency=HUF&backTo=%2Frequest%2Fnew%2Fmanualthen notice the selected currency code isHUF - Change the HUF text of the address into JPY and notice the selected currency in the list is JPY
- [x] Verify that no errors appear in the JS console
Offline tests
QA Steps
- Go to workspace settings and select default currency
- The currency selection list will appears and type "euro"
- The euro currency must be available in the list
- Select the euro currency, then notice the default currency is changed into euro
- Repeat step 2-4 for other search text like "rupee", "pound", "Australia" then notice the Indian rupee , England pounds, Australia dollar is available in the list for the respected search text
- Go to
+fab button -> select money request -> go to manual tab -> click the currency - Repeat the step 2-5
- Go to IOU request money address like:
https://dev.new.expensify.com:8082/request/new/currency/?currency=HUF&backTo=%2Frequest%2Fnew%2Fmanualthen notice the selected currency code isHUF - Change the HUF text of the address into JPY and notice the selected currency in the list is JPY
- [x] Verify that no errors appear in the JS console
PR Author Checklist
- [x] I linked the correct issue in the
### Fixed Issuessection above - [x] I wrote clear testing steps that cover the changes made in this PR
- [x] I added steps for local testing in the
Testssection - [x] I added steps for the expected offline behavior in the
Offline stepssection - [x] I added steps for Staging and/or Production testing in the
QA stepssection - [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- [x] 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)
- [x] 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).
- [x] I added steps for local testing in the
- [x] I included screenshots or videos for tests on all platforms
- [x] I ran the tests on all platforms & verified they passed on:
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
- [x] 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)
- [x] I followed proper code patterns (see Reviewing the code)
- [x] 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.
toggleReportand notonIconClick) - [x] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g.
myBool && <MyComponent />. - [x] I verified that comments were added to code that is not self explanatory
- [x] 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.
- [x] I verified any copy / text shown in the product is localized by adding it to
src/languages/*files and using the translation method- [x] 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:
- [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
- [x] 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 approved by marketing by adding the
Waiting for Copylabel for a copy review on the original GH to get the correct copy. - [x] 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.
- [x] I verified the JSDocs style guidelines (in
STYLE.md) were followed
- [x] 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.
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I followed the guidelines as stated in the Review Guidelines
- [x] 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 usingAvatarare working as expected) - [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [x] 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
- [x] I verified that if a function's arguments changed that all usages have also been updated correctly
- [x] If a new component is created I verified that:
- [x] A similar component doesn't exist in the codebase
- [x] All props are defined accurately and each prop has a
/** comment above it */ - [x] The file is named correctly
- [x] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- [x] The only data being stored in the state is data necessary for rendering and nothing else
- [x] If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
- [x] Any internal methods bound to
thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)
- [x] Any internal methods bound to
- [x] All JSX used for rendering exists in the render method
- [x] 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
- [x] If any new file was added I verified that:
- [x] 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
- [x] If a new CSS style is added I verified that:
- [x] A similar style doesn't already exist
- [x] The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
- [x] 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.
- [x] 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
Avataris modified, I verified thatAvataris working as expected in all cases) - [x] 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.
- [x] 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.
- [x] If a new page is added, I verified it's using the
ScrollViewcomponent to make it scrollable when more elements are added to the page. - [x] If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps. - [x] I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.
Screenshots/Videos
Android: Native
https://github.com/Expensify/App/assets/114975543/e6cd1499-e4c9-4d37-8967-2e426a22f3f0
Android: mWeb Chrome
https://github.com/Expensify/App/assets/114975543/0177cf20-ce12-4308-a8ac-3133da495bfd
iOS: Native
https://github.com/Expensify/App/assets/114975543/3db32afd-53b5-4dcc-b31a-70749a60372a
iOS: mWeb Safari
https://github.com/Expensify/App/assets/114975543/171000dd-0a27-4d3c-933b-969533aa6ac0
MacOS: Chrome / Safari
https://github.com/Expensify/App/assets/114975543/d91c143a-c7fe-4016-948b-4ee6c4d73a04
MacOS: Desktop
https://github.com/Expensify/App/assets/114975543/e5ddbf15-dc57-483f-a492-ffe7b279edb9
@parasharrajat 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]
@parasharrajat Currently the behavior of the workspace default currency setting is still the same. and I have some doubts before applying the url currency parameter for the workspace currency settings:
ss:
If the url parameter of currency is different than current policy currency stored in onyx, should we change the selected currency based on the url parameter?
Only on Currency Selection page, the URL parameter will manage the selection. Then it should be removed when going back to workspace settings page.
@parasharrajat I have add the URL parameter for workspace currency settings page and update the route accordingly. In my latest commit the focused currency is based on URL parameter and the selected currency is based on currency of the policy stored in onyx. The result is something like this:
If it is weird, I will revert back to make the focused and selected currency based on URL parameter.
Friendly bump @parasharrajat , Could you review my pr when you have a chance? thank you...
@parasharrajat are you ready to review this PR? I will merge main
Apologies for the delay here. I had build issues last week so couldn't focus on it. Unfortunately, I will be AFK till the weekend. But I am sure I can get this reviewed on Monday.
https://github.com/Expensify/App/pull/30889#issuecomment-1801896290
This is a weird situation. I currently don't have a direct answer here but I can dig into that. I would suggest that we follow similar patterns that are already being used in the App. May be try finding a similar page in the app and see what is done there.
There is another variant of such a pattern in the APP used around CountrySelectionPage. Things to check would be comparing and seeing what is different between both. And can we stick to one?
@parasharrajat done. The behavior will be like country selection page and will also fix https://github.com/Expensify/App/issues/31650
@tsa321 will it fix https://github.com/Expensify/App/issues/29822?
@cead22 yes, this will also fix that issue. I will follow the displayed text of the workspace currency setting, which is agreed in here.
Started review.
I am currently OOO. I plan to continue this in 2 days. There are no urgent PRs/issues on my side so I would be able to fully focus here.
@parasharrajat if there is navigation problem here, I suggest to solve the issue separately in here: https://github.com/Expensify/App/issues/31650 to get the best solution to fix the issue about Default Currency Updated Without Clicking "Save" Button.
Thanks for waiting here. It's been long but I was somewhat waiting on request flow migration done by Tgolen which would update IOUCurrencySelection. But it seems that we are completely removing that component https://github.com/Expensify/App/issues/34607.
More details https://github.com/Expensify/App/issues/29107.
This affects this PR as we are trying to update IOUCurrencySelection.
What should we do?
- Revert all the changes done on
IOUCurrencySelection. - If a better solution has been implemented in
IOURequestStepCurrency, analyze this. - Revisit the solution.
I will start analyzing the changes myself to speed up the process.
We might want to hold on https://github.com/Expensify/App/issues/34607 as it could help us with the migration of this PR to the new component without conflicts.
cc @tgolen ^
pinged Tim 1:1
Yes, I agree that we should only move forward with IOURequestStepCurrency. I don't think it needs to be held on the old component being removed though.
@parasharrajat Should we hold this PR for https://github.com/Expensify/App/issues/34607 to be merged? because IOUCurrencySelection will be removed by that PR, but if this PR is more important then should I continue with this PR and make change in IOUCurrencySelection or/and IOURequestStepCurrency? but it will disturb that PR.
My PR won't change navigation logic of IOU, it will only adds a CurrencySelectionList component. Should we continue on this PR or Should we wait for https://github.com/Expensify/App/issues/34607 to be merged?
Or Should I add CurrencySelectionList and use it in WorkspaceSettingsCurrency first and will add the component in IOU when https://github.com/Expensify/App/issues/34607 has been merged? Thank you...
I think it's fine. let's hold on https://github.com/Expensify/App/issues/34607.
We should be good here @tsa321 to move ahead.
@tsa321 Please ping me when this is ready for review.
@parasharrajat for the task of creating CurrencySelectionList component and use it in IOU request and Workspace setting currency it is already done in my latest commit and ready for a review.
But for adding currency parameter in url for workspace setting by following the country selector page there are some problem... The navigation isn't working properly in country selector page. For example:
Navgiaton problem in country selector:
https://github.com/Expensify/App/assets/114975543/380f10fe-7bff-4497-a6b7-43b464c84107
So I am not sure if I must follow the country selector page. I have tried it before and there are some problems, like my previous comments...
@parasharrajat for now it is ready for review...
So the issue you mentioned is unrelated. @tsa321 Could you please merge main? Testing it now.
We need to merge main to be able to test it properly. Please merge main when possible and I will finish my testing immediately before another conflict.
@parasharrajat main merged
Screenshots
:black_square_button: iOS / native
https://github.com/Expensify/App/assets/24370807/43424cd5-d5c9-4c80-bca5-8c5cebbbbcaa
:black_square_button: iOS / Safari
https://github.com/Expensify/App/assets/24370807/7d7adcda-2071-4ec9-b922-71cbd3bbf286
:black_square_button: MacOS / Desktop
https://github.com/Expensify/App/assets/24370807/e0826974-4ae3-4fdb-96d3-c15e37c0cb54
:black_square_button: MacOS / Chrome
https://github.com/Expensify/App/assets/24370807/73259fd1-9f90-42f6-81ed-1c8dd758ee24
:black_square_button: Android / Chrome
https://github.com/Expensify/App/assets/24370807/eb0c6536-a6d9-4587-a410-a6c356528cf0
:black_square_button: Android / native
https://github.com/Expensify/App/assets/24370807/33dd5b90-5668-4dd8-a495-335cd35cf69b
@cead22 Bump for review.