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

Add Push-to-Page support for IOUConfirmationList #16919

Merged
merged 26 commits into from
Apr 14, 2023

Conversation

yuwenmemon
Copy link
Contributor

@yuwenmemon yuwenmemon commented Apr 4, 2023

cc @luacmartins @vitHoracek

Details

Change the IOUConfirmationList form to use push to page components and spruce up the look of it a bit.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/270489

Tests / QA

  1. Start a Send money flow.
  2. Select an amount, and recipient and get to the final confirmation page
  3. Edit the "amount" field. Make sure you are taken back to the first step
  4. Click next after editing the amount, make sure you are taken back to the confirmation page
  5. Click the "back" button, make sure you are taken to the page where you select a recipient.
  6. Select another recipient, make sure you are taken back to the confirmation page.
  7. Click "What's it for" - add a description
  8. Click the "Pay with Expensify" button at the bottom. make sure the amount and description show up on the corresponding IOU expense.

Screenshot 2023-04-13 at 9 15 26 PM


  1. Start a Request money flow.
  2. Select an amount, and recipient and get to the final confirmation page
  3. Edit the "amount" field. Make sure you are taken back to the first step
  4. Click next after editing the amount, make sure you are taken back to the confirmation page
  5. Click the "back" button, make sure you are taken to the page where you select a recipient.
  6. Select another recipient, make sure you are taken back to the confirmation page.
  7. Click "What's it for" - add a description
  8. Click the Request $XX.XX button at the bottom. make sure the amount and description show up on the corresponding IOU expense.

Screenshot 2023-04-13 at 9 15 48 PM


  1. Start a Split Bill flow.
  2. Select an amount, and recipient and get to the final confirmation page
  3. Edit the "amount" field. Make sure you are taken back to the first step
  4. Click next after editing the amount, make sure you are taken back to the confirmation page
  5. Click the "back" button, make sure you are taken to the page where you select a recipient.
  6. Select another recipient, make sure you are taken back to the confirmation page.
  7. Click "What's it for" - add a description
  8. Click the button at the bottom. make sure the amount and description show up on the corresponding IOU expense.

Screenshot 2023-04-13 at 9 16 10 PM

  • Verify that no errors appear in the JS console in any of the above tests

Offline tests

Do the request money and split bill flows but offline. Make sure they work the same except with a pending transaction created.

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 / Chrome
    • iOS / native
    • iOS / 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 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 correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • 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 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(themeColors.componentBG)
  • 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 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 author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Kapture.2023-04-14.at.00.11.51.mp4
Mobile Web - Chrome
Kapture.2023-04-10.at.18.29.53.mp4
Mobile Web - Safari
Kapture.2023-04-10.at.18.19.48.mp4
Desktop
Kapture.2023-04-10.at.17.53.22.mp4
iOS
Kapture.2023-04-10.at.18.32.55.mp4
Android
Kapture.2023-04-10.at.18.20.58.mp4

@yuwenmemon yuwenmemon self-assigned this Apr 4, 2023
@yuwenmemon yuwenmemon changed the title [WIP] Add Push-to-Page [WIP] Add Push-to-Page support for IOUConfirmationList Apr 4, 2023
@mountiny mountiny self-requested a review April 4, 2023 16:11
Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

The styling looks good so far. Will run through the full tests once complete.

(not sure why I pulled this branch for review given that it's WIP, but I'm here now anyway)

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

There was a recent change to the design where also the description will be push to page for consistency https://expensify.slack.com/archives/C02HWMSMZEC/p1680719627779599

@yuwenmemon yuwenmemon marked this pull request as ready for review April 10, 2023 21:52
@yuwenmemon yuwenmemon requested a review from a team as a code owner April 10, 2023 21:52
@melvin-bot melvin-bot bot requested review from MonilBhavsar and thesahindia and removed request for a team April 10, 2023 21:53
@MelvinBot
Copy link

@thesahindia @MonilBhavsar One of you needs to 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]

@yuwenmemon yuwenmemon changed the title [WIP] Add Push-to-Page support for IOUConfirmationList Add Push-to-Page support for IOUConfirmationList Apr 10, 2023
@yuwenmemon
Copy link
Contributor Author

This is ready for review!

@luacmartins luacmartins self-requested a review April 11, 2023 09:55
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

@yuwenmemon Great job! The main thing here is to update the What's it for? to Description to align with the doc

image

<View style={styles.mb4}>
<TextInput
inputID="iouComment"
name="ioucomment"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this lowercase on purpose?

Suggested change
name="ioucomment"
name="iouComment"

return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
<HeaderWithCloseButton
title={this.props.translate('iOUConfirmationList.whatsItFor')}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be Description

Suggested change
title={this.props.translate('iOUConfirmationList.whatsItFor')}
title={this.props.translate('IOUConfirmationList.description')}

@@ -636,6 +636,15 @@ function setIOUSelectedCurrency(selectedCurrencyCode) {
Onyx.merge(ONYXKEYS.IOU, {selectedCurrencyCode});
}

/**
* Sets IOU'S comment
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Sets IOU'S comment
* Sets IOU's comment

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change this comment to Sets Money Request description instead?

<MenuItemWithTopDescription
shouldShowRightIcon
title={this.props.iou.comment}
description={this.props.translate('iOUConfirmationList.whatsItFor')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets update the key if its indeed with the typo and small i at start. We need to use Description here.

Suggested change
description={this.props.translate('iOUConfirmationList.whatsItFor')}
description={this.props.translate('IOUConfirmationList.description')}

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggested that we rename these keys to moneyRequestConfirmationList in this PR

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to changing it to Description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. What do you guys think about using "What's it for" in the hint for the text input?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise, it looks pretty bare:
Screenshot 2023-04-11 at 2 07 52 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think we can keep that in there, good point

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

src/pages/iou/steps/IOUConfirmPage.js Outdated Show resolved Hide resolved
@mountiny
Copy link
Contributor

I am wondering here @luacmartins @Julesssss the Amount edit is now navigating to a different step in the IOU creation flow so it oes not have its route same as other push-to-page edits in forms. I feel like its inconsistent, but I am not fully sure either if we should create a new edit mount page same as for the description field. It makes sense we should do it, any reason why not?

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

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

Looking good. Left a few comments, let's keep up the momentum here!

src/pages/iou/IOUDescriptionPage.js Outdated Show resolved Hide resolved
src/components/OptionsSelector/BaseOptionsSelector.js Outdated Show resolved Hide resolved
src/components/OptionsSelector/BaseOptionsSelector.js Outdated Show resolved Hide resolved
src/libs/Navigation/AppNavigator/ModalStackNavigators.js Outdated Show resolved Hide resolved
src/libs/Navigation/AppNavigator/ModalStackNavigators.js Outdated Show resolved Hide resolved
src/styles/styles.js Outdated Show resolved Hide resolved
src/components/IOUConfirmationList.js Outdated Show resolved Hide resolved
<MenuItemWithTopDescription
shouldShowRightIcon
title={this.props.iou.comment}
description={this.props.translate('iOUConfirmationList.whatsItFor')}
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to changing it to Description

src/pages/iou/IOUDescriptionPage.js Outdated Show resolved Hide resolved
},
};

class IOUDescriptionPage extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB should we create this as a functional component and use hooks already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not up to speed on hooks fully so I didn't go for it just for the sake of time. What do you think? Maybe a follow-up?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems fine, but I'm still not sure why this is a class component since we don't have any state or lifecycle methods. Seems like we could refactor to a functional component without the need for hooks.

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Great, let's ship it!

Yuwen is definitely not standing behind me, looking over my shoulder making sure it gets merged.

@mountiny mountiny merged commit 6ee5e7a into main Apr 14, 2023
@mountiny mountiny deleted the yuwen-pushToPageIOUConfirmationList branch April 14, 2023 23:50
@OSBotify
Copy link
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
Copy link
Contributor

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

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

1 similar comment
@OSBotify
Copy link
Contributor

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

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 1.3.1-3 🚀

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

@eVoloshchak
Copy link
Contributor

This PR has caused a regression in #17656

I this commit titleTextStyle is calculated with props.titleStyle instead of props.style. OfflineWithFeedback has a limitation on mobile, where it would apply strikethrough styling only to the first child, not recursively, which in this case means it was previously applied to props.style, but wasn't applied to props.titleStyle

* @param {String} comment
*/
function setMoneyRequestDescription(comment) {
Onyx.merge(ONYXKEYS.IOU, {comment});
Copy link
Collaborator

Choose a reason for hiding this comment

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

we forgot to trim white spaces in the Description comment and it lead to this issue

@sobitneupane
Copy link
Contributor

While implementing MoneyRequestDescriptionPage, we didn't autofocus the text input though there is only single input in the page.

Related Issue: #17579

@Santhosh-Sellavel
Copy link
Collaborator

This PR caused a regression here. We update other things but missed to include IOUCurrencySelection to flow more details on the issue/PR

@marcaaron
Copy link
Contributor

Are we adding validation to this form? I feel like we added this for a good reason...

App/src/components/Form.js

Lines 132 to 134 in bd5db76

if (!_.isObject(validationErrors)) {
throw new Error('Validate callback must return an empty object or an object with shape {inputID: error}');
}

and then did this...

😂

@marcaaron
Copy link
Contributor

Should we add a polish item for that? @mountiny @luacmartins

@luacmartins
Copy link
Contributor

That field is not required, so I'm not sure what we'd validate. The validate callback is returning an empty object in that case.

@marcaaron
Copy link
Contributor

We can update Form so that people don't have to pass a function that returns an empty object ?

@luacmartins
Copy link
Contributor

Done - #20525

@Santhosh-Sellavel
Copy link
Collaborator

I think this PR caused this #19450 bug, or should been caught here.

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.