Skip to content
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

migrate AccountType step to FormProvider #56464

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mkzie2
Copy link
Contributor

@mkzie2 mkzie2 commented Feb 6, 2025

Explanation of Change

migrate AccountType step to FormProvider

Fixed Issues

$ #55688
PROPOSAL: #55688 (comment)

Tests

Precondition: Enable newDotInternationalDepositBankAccount beta

  • Account type step
  1. Go to Account settings > Wallet
  2. Click Add bank account
  3. Select any country other than US
  4. Enter info and reach confirmation page
  5. On confirmation page, Select the terms checkbox
  6. Click the account type selector row
  7. Change the account type and Confirm
  • Test for ValuePicker
  1. Go FAB > Start chat > Room
  2. Click on the Workspace/Who can post/Visibility field
  3. Verify that a selector modal is displayed and the value is updated after we select a value
  4. Go FAB > Create expense > Per diem
  5. In the subRate step, click on the sub rate field
  6. Verify that a selector modal is displayed and the value is updated after we select a value

Offline tests

Same

QA Steps

Precondition: Enable newDotInternationalDepositBankAccount beta

  • Test for ValuePicker
  1. Go to Account settings > Wallet
  2. Click Add bank account
  3. Select any country other than US
  4. Enter info and reach confirmation page
  5. On confirmation page, Select the terms checkbox
  6. Click the account type selector row
  7. Change the account type and Confirm
  • Test for ValuePicker
  1. Go FAB > Start chat > Room
  2. Click on the Workspace/Who can post/Visibility field
  3. Verify that a selector modal is displayed and the value is updated after we select a value
  4. Go FAB > Create expense > Per diem
  5. In the subRate step, click on the sub rate field
  6. Verify that a selector modal is displayed and the value is updated after we select a value
  • 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
Screen.Recording.2025-02-18.at.17.31.02.mov
Android: mWeb Chrome
Screen.Recording.2025-02-18.at.17.26.00.mov
iOS: Native
Screen.Recording.2025-02-18.at.17.32.45.mov
iOS: mWeb Safari
Screen.Recording.2025-02-18.at.17.28.35.mov
MacOS: Chrome / Safari
Screen.Recording.2025-02-18.at.17.23.22.mov
Screen.Recording.2025-02-20.at.23.23.19.mov
Screen.Recording.2025-02-20.at.23.25.01.mov
MacOS: Desktop
Screen.Recording.2025-02-18.at.17.35.46.mov

@mkzie2 mkzie2 marked this pull request as ready for review February 6, 2025 14:04
@mkzie2 mkzie2 requested a review from a team as a code owner February 6, 2025 14:04
@melvin-bot melvin-bot bot requested review from dominictb and removed request for a team February 6, 2025 14:04
Copy link

melvin-bot bot commented Feb 6, 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]

@dominictb
Copy link
Contributor

@mkzie2 Seems like we have an extra step here:

Screenshot 2025-02-10 at 04 08 21

Can you think of any way to eliminate it?

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 10, 2025

@dominictb This is the same step like we did for the type business step in connect US bank account flow or some others that use FormProvider. cc @cead22 Can you check the comment above and verify if it's acceptable behavior.

@cead22
Copy link
Contributor

cead22 commented Feb 10, 2025

I'm not sure what you're asking, can you elaborate?

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 11, 2025

I'm not sure what you're asking, can you elaborate?

@cead22

  1. Here is the current behavior on the Account type step, the selector is displayed
Screenshot 2025-02-11 at 15 56 25
  1. Here is the behavior of the account type step that I implemented in this PR. It includes a menu item, which we click to select the account type. This behavior is the same as that of other steps, like TypeBusiness in the US bank account flow.
Screen.Recording.2025-02-11.at.15.57.27.mov

Do you agree with the behavior in this PR (Option 2)?

@dominictb
Copy link
Contributor

@cead22 Can you confirm the final expectation?

@dominictb
Copy link
Contributor

@cead22 Friendly bump

@cead22
Copy link
Contributor

cead22 commented Feb 13, 2025

Hmmm, I've seen list pages where you select an option and still have to click the green button to "accept" it. But if you say we're doing what you showed on the video above in other places, specially if those places are part of this flow, then I think that's fine

@shubham1206agra
Copy link
Contributor

@joekaufmanexpensify I don't think extra step is allowed here. cc @Expensify/design to confirm this.

cc @dominictb

@shawnborton
Copy link
Contributor

Hmm I feel like we've gone back and forth on this one... I don't know that we ever settled on an official rule for every single flow, cc @Expensify/design for thoughts

The original thinking for having a green confirm button at the bottom of these flows was that if you were inside of a stepper flow (with multiple steps...) it might feel nicer to always show a green button at the bottom so you had consistency between pages. But I think we've also kinda walked back on that and we've found examples of where it feels a little cumbersome (like the onboarding modal) where we would prefer not to need the green confirm button on list selections.

However, if you access a list selection via a push row, we never use a green confirmation button. That's something we've been consistent with for a long time I think.

I'm not sure if that is helpful or not, but that's the backstory AFAIK.

@dannymcclain
Copy link
Contributor

I agree with everything Shawn said, but I'm not sure that gets us closer to a decision haha.

However, if you access a list selection via a push row, we never use a green confirmation button. That's something we've been consistent with for a long time I think.

This pattern does kinda seem to apply here though?

@shawnborton
Copy link
Contributor

Yeah it's basically here that we're at a crossroads:
CleanShot 2025-02-14 at 09 06 12@2x

I think as long as you have a way to go back and change your decision, I would be fine removing the green button at the bottom. And I believe at the end of this flow you would see a confirmation screen that allows you to change the decision, so maybe we'd be good there.

We don't have that kind of confirmation for the onboarding modal though... but at the same time, I think we've had discussions about wanting to remove the extra click?

Curious what the other designers think though!

@dannymcclain
Copy link
Contributor

Yeah good point. I think the ability to change your decision after the fact makes it fine to remove this green button.

@joekaufmanexpensify
Copy link
Contributor

joekaufmanexpensify commented Feb 14, 2025

Hmm, based on this, it seems like we might be trying to add an additional push row for the account type. So you'd land on the page to select account type and then have another push row that brings you to where you actually make a selection (if I am understanding correctly). That seems redundant to me, and I agree with @shubham1206agra that we should have you select the account type from the top-level page, rather than forcing you down another level of navigation to select it.

How it works now is below. We added the Next/Confirm buttons at the bottom to maintain consistency in the entire flow. That's also how we've approached other flows I've worked on recently like assigning cards. I do kinda like having each step in the flow be consistent, but also not opposed to removing the next button in situations where you are just making one selection from a list.

But not a fan of adding an extra push row, like was being proposed here.

2025-02-14_10-20-54.mp4

@dannymcclain
Copy link
Contributor

Ah great context Joe. I'm on board with everything you said. Definitely agree about removing the unnecessary nested push row, and in a flow like this where most screens need a bottom button, it makes sense to me to just keep the whole form/flow using that pattern. And then if we do go that route, on the confirm screen, if you tap back into it, I'd be fine with keeping that screen the same as during the flow (and not removing the bottom button). Does that all make sense? Alternatively, we could keep the green button during the initial flow, but if you revisit from the confirm screen we could remove the bottom button and treat it like all our other push-row-to-select-list screens, just not sure that's entirely necessary.

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 14, 2025

Thank for all informations, I will give an update soon.

@shawnborton
Copy link
Contributor

Cool, yeah I can totally get on board with all of that too Joe & Danny. So it sounds like... just keep doing things the way we've been doing them 🤣

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 16, 2025

@dominictb Updated to remove the extra step.

@dubielzyk-expensify
Copy link
Contributor

Just chiming in to say that I think having the button at the bottom for consistency is the way to go here as well 👍

@dominictb
Copy link
Contributor

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 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.ts 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • 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-02-18.at.16.45.29.mov
Android: mWeb Chrome
Screen.Recording.2025-02-18.at.16.39.36.mov
iOS: Native
Screen.Recording.2025-02-18.at.16.42.20.mov
iOS: mWeb Safari
Screen.Recording.2025-02-18.at.16.33.26.mov
MacOS: Chrome / Safari
Screen.Recording.2025-02-18.at.16.22.25.mov
MacOS: Desktop
Screen.Recording.2025-02-18.at.16.48.44.mov

@dominictb
Copy link
Contributor

@mkzie2 Please update the screenshots with the latest change.

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 18, 2025

@mkzie2 Please update the screenshots with the latest change.

@dominictb I updated.

@melvin-bot melvin-bot bot requested a review from cead22 February 19, 2025 02:54
@cead22
Copy link
Contributor

cead22 commented Feb 20, 2025

I have a few clarifying questions because these changes look different from what I expected after reading the proposal

  • Why did we have to implement a new component ValueSelectionList? I didn't see this in the proposal
  • When should we use ValueSelectionList vs SelectionList?
  • It looks like ValuePicker and ValueSelectionModal are used in other places. Can you add tests to make sure all the other places are working as they should?

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 20, 2025

@cead22

Why did we have to implement a new component ValueSelectionList? I didn't see this in the proposal

  • We go with my alternative solution to migrate the account step with FormProvider. And follow the TypeBusiness step and use ValuePicker as InputCompent. With this, the AccountStep will have a UI like this and we need to click on the menu item here to select the account type.

  • After the discussion that started from here, we decided to keep the current UI on the main for AccountStep that will not have the extra step

  • After that, I updated the ValuePicker with a new prop shouldShowModal with the default value is true. If it's false we simply return the selection list without menu item and modal.

  • I move the select list in ValueSelectorModal into a new component ValueSelectionList because I use it on both place ValuePicker and ValueSelectorModal

Screenshot 2025-02-20 at 23 09 16

When should we use ValueSelectionList vs SelectionList?

  • ValueSelectionList is just a component based on SelectionList and it's used for ValuePicker component

It looks like ValuePicker and ValueSelectionModal are used in other places. Can you add tests to make sure all the other places are working as they should?

Updated the test step and the video on the web for it.

@cead22
Copy link
Contributor

cead22 commented Feb 20, 2025

Thanks for the reply. I have some follow ups because I'm still confused, so I'll try asking a different way

  • We go with my alternative solution to migrate the account step with FormProvider. And follow the TypeBusiness step and use ValuePicker as InputCompent.

There's no other way to do this? We have to ValuePicker as the InputComponent to make this work with FormProvider behave and work like TypeBusiness?

With this, the AccountStep will have a UI like this and we need to click on the menu item here to select the account type.

As opposed to clicking on the menu item, and then having to click a button to confirm, right?

  • After that, I updated the ValuePicker with a new prop shouldShowModal with the default value is true. If it's false we simply return the selection list without menu item and modal.

What is "menu item" and what is "modal" here?

  • ValueSelectionList is just a component based on SelectionList and it's used for ValuePicker component

Why can't we use SelectionList in ValuePicker?

);

return (
<SelectionList
Copy link
Contributor Author

@mkzie2 mkzie2 Feb 21, 2025

Choose a reason for hiding this comment

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

@cead22 Thanks for your feedback, let me clarify it again.

There's no other way to do this? We have to ValuePicker as the InputComponent to make this work with FormProvider behave and work like TypeBusiness?

ValuePicker is an existing component; we can reuse this in the AccountType step when migrating to FormProvider.

As opposed to clicking on the menu item, and then having to click a button to confirm, right?
What is "menu item" and what is "modal" here?

Yes, here is the result of my first implementation

Screen.Recording.2025-02-11.at.15.57.27.mov
  • And this is the menu item
Screenshot 2025-02-21 at 14 23 52
  • This is the modal
Screenshot 2025-02-21 at 14 24 39

The main idea of the last implementation is creating a way to only show the selection list without the extra step of opening the modal. Then I implement it in ValuePicker with a new prop so we can use this in the feature if we want. And the result will be like this

Screenshot 2025-02-21 at 14 34 56

Why can't we use SelectionList in ValuePicker?

As the idea above, we only need to reuse the SelectionList part on ValueSelectorModal and render it in ValuePicker if shouldShowModal props is false

You can see here ValueSelectionList used the SelectionList. The purpose of this component is prevent the duplicate code when I add both SelectionList in ValuePicker and ValueSelectorModal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cead22 Any thoughts on my comment above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the delay, it's been a busy few days.

There's no other way to do this? We have to ValuePicker as the InputComponent to make this work with FormProvider behave and work like TypeBusiness?
ValuePicker is an existing component; we can reuse this in the AccountType step when migrating to FormProvider.

To clarify, are there alternative ways to implement this? If so, can you share why they're not as good as this one? If there aren't, can you explain why?

Sorry if this is all known to others, but I'm not super well versed on all the components that exists and how they work together

The main idea of the last implementation is creating a way to only show the selection list without the extra step of opening the modal.

Just to make sure I understand, the selection list looks very similar to the modal, and the main difference is that the modal has a green button you need to click after making the selection?

Then I implement it in ValuePicker with a new prop so we can use this in the feature if we want. And the result will be like this

Again just so I learn, if we didn't want to do this in anticipation of using it in the future, how would the code be different? Not saying we should change it, I just want to understand exactly what's needed for now, vs what we're doing to set this up to be re-used

Why can't we use SelectionList in ValuePicker?
As the idea above, we only need to reuse the SelectionList part on ValueSelectorModal and render it in ValuePicker if shouldShowModal props is false

I didn't quite follow this. Can we use SelectionList in ValuePicker? Does that question make sense?

The purpose of this component is prevent the duplicate code when I add both SelectionList in ValuePicker and ValueSelectorModal.

👍 thanks, I get this now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cead22

To clarify, are there alternative ways to implement this? If so, can you share why they're not as good as this one? If there aren't, can you explain why?
Sorry if this is all known to others, but I'm not super well versed on all the components that exists and how they work together

We can create a new component and use it as InputWrapper of the FormProvider in the AccountType step. But we're good to use the ValuePicker because we can see the SelectionList inside AccountType (the code on the latest main) is the same with the selection list inside ValueSelectorModal of ValuePicker

<SelectionList
sections={[{data: options}]}
onSelectRow={onSelectionChange}
ListItem={RadioListItem}
initiallyFocusedOptionKey={currentAccountType}
footerContent={button}
shouldSingleExecuteRowSelect
shouldStopPropagation
shouldUseDynamicMaxToRenderPerBatch
shouldUpdateFocusedIndex

The main idea of the last implementation is creating a way to only show the selection list without the extra step of opening the modal.

Just to make sure I understand, the selection list looks very similar to the modal, and the main difference is that the modal has a green button you need to click after making the selection?

The main idea is to keep the current UI and behavior in the AccountType step, but using FormProvier with ValuePicker instead of the current code here. And then when using the ValuePicker, we need a way only to display the SelectionList, then the behavior is the same as we have on the main, making a selection and clicking on the confirm button to go to the next step.

<SelectionList
sections={[{data: options}]}
onSelectRow={onSelectionChange}
ListItem={RadioListItem}
initiallyFocusedOptionKey={currentAccountType}
footerContent={button}
shouldSingleExecuteRowSelect
shouldStopPropagation
shouldUseDynamicMaxToRenderPerBatch
shouldUpdateFocusedIndex

Again just so I learn, if we didn't want to do this in anticipation of using it in the future, how would the code be different? Not saying we should change it, I just want to understand exactly what's needed for now, vs what we're doing to set this up to be re-used

In the feature, if we have a substep with a single field and we need to make a selection, we can reuse the ValuePicker with shouldShowModal as false to remove the extra step.

  • what's needed for now: Now we need an InputWrapper component that is only a selection list like the current selection in here. And because ValuePicker already had the same list like this, we can use this component with introducing a new prop to simply return the selection list if this prop is false

<SelectionList
sections={[{data: options}]}
onSelectRow={onSelectionChange}
ListItem={RadioListItem}
initiallyFocusedOptionKey={currentAccountType}
footerContent={button}
shouldSingleExecuteRowSelect
shouldStopPropagation
shouldUseDynamicMaxToRenderPerBatch
shouldUpdateFocusedIndex

  • what we're doing to set this up to be re-used: I set this up to be re-used by introducing the shouldShowModal. If we have a substep that has the same UI and behavior like this AccountType step, we can re-use like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify, are there alternative ways to implement this? If so, can you share why they're not as good as this one? If there aren't, can you explain why?
We can create a new component and use it as InputWrapper of the FormProvider in the AccountType step. But we're good to use the ValuePicker because we can see the SelectionList inside AccountType (the code on the latest main) is the same with the selection list inside ValueSelectorModal of ValuePicker

Sorry, I still don't understand this. When I asked about whether there's another way, I meant with existing logic/components. I don't think this addresses why the current solution is better (apologies if it does)

The main idea is to keep the current UI and behavior in the AccountType step, but using FormProvier with ValuePicker instead of the current code here. And then when using the ValuePicker, we need a way only to display the SelectionList, then the behavior is the same as we have on the main, making a selection and clicking on the confirm button to go to the next step.

Sorry about this one too, but I'm not sure if/how this answers my question. What does "the extra step of opening the modal" mean in "The main idea of the last implementation is creating a way to only show the selection list without the extra step of opening the modal."?

  • what we're doing to set this up to be re-used: I set this up to be re-used by introducing the shouldShowModal. If we have a substep that has the same UI and behavior like this AccountType step, we can re-use like this.

Thanks for this explanation. Is this something we anticipate using right away, or should we add it when we need it?

I'm gonna find a better reviewer for this PR. I don't want to keep delaying it, but I also don't want to merge code I don't understand

@luacmartins
Copy link
Contributor

@mkzie2 what I got from the discussions is that we're trying to go for this kind of behavior. If so, can we just follow the same pattern we have in WorkspaceNewRoomPage.tsx

Screen.Recording.2025-03-05.at.9.31.34.AM.mov

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 5, 2025

@mkzie2 what I got from the discussions is that we're trying to go for this kind of behavior. If so, can we just follow the same pattern we have in WorkspaceNewRoomPage.tsx

That is my initial implementation

410488570-6755f844-af00-4ca8-a715-19b359592ae7.mov

@luacmartins The expected we want here still keeps the current behavior (remove the extra step) but will use the FormProvier in the AccountType step to fix this issue. This started from this comment. And here is the result with this

Screen.Recording.2025-02-18.at.17.23.22.mov

@cead22
Copy link
Contributor

cead22 commented Mar 5, 2025

I think it should be like below, and once you tap on savings and current we go back to the other page, without having to tap the confirm button. That aligns with @shawnborton 's comment here

However, if you access a list selection via a push row, we never use a green confirmation button. That's something we've been consistent with for a long time I think.

image

@luacmartins
Copy link
Contributor

I agree with @cead22. It'd be great to get @Expensify/design's confirmation on that too

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 6, 2025

Ah great context Joe. I'm on board with everything you said. Definitely agree about removing the unnecessary nested push row, and in a flow like this where most screens need a bottom button, it makes sense to me to just keep the whole form/flow using that pattern. And then if we do go that route, on the confirm screen, if you tap back into it, I'd be fine with keeping that screen the same as during the flow (and not removing the bottom button). Does that all make sense? Alternatively, we could keep the green button during the initial flow, but if you revisit from the confirm screen we could remove the bottom button and treat it like all our other push-row-to-select-list screens, just not sure that's entirely necessary.

@cead22 @luacmartins We confirmed here that still keep the confirm button

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.

9 participants