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

refactor add payment dynamic #7847

Merged
merged 5 commits into from
Mar 2, 2022

Conversation

phivh
Copy link
Contributor

@phivh phivh commented Feb 20, 2022

Details

  • Added one window listener that observed resize event and re-set position of the menu, there is a reason that needs to migrate the listener into dimension method.

Fixed Issues

$ #7385

Tests

  • Tested by access to the payment page from the setting page.

QA Steps

  • Login on web / desktop app
  • Select profile > payments
  • Select add payment method
  • Change screen width
  • Verify

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

web.mp4

Mobile Web

NA

Desktop

desktop_app.mp4

iOS

NA

Android

NA

@phivh phivh requested a review from a team as a code owner February 20, 2022 15:54
@MelvinBot MelvinBot requested review from deetergp and rushatgabhane and removed request for a team February 20, 2022 15:54
@phivh phivh mentioned this pull request Feb 20, 2022
11 tasks
Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

@phivh small issue here - payment popover jumps down on resizing.

Screencast.from.22-02-22.03-12-30.AM.+03.mp4

@phivh phivh force-pushed the refactor-add-payment-dynamic branch from 4f33203 to 3f830ea Compare February 27, 2022 13:49
@phivh
Copy link
Contributor Author

phivh commented Feb 27, 2022

@rushatgabhane @deetergp updated!

@rushatgabhane
Copy link
Member

rushatgabhane commented Feb 28, 2022

@phivh could you please post a small explaination on what fixed the resizing bug? Thanks

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

@phivh really minor changes

if (!this.state.transferBalanceButton) {
return;
}
const btnPosition = getClickedElementLocation(this.state.transferBalanceButton);
Copy link
Member

Choose a reason for hiding this comment

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

rename it to buttonPosition please

@@ -20,26 +20,41 @@ class KYCWall extends React.Component {
super(props);

this.continue = this.continue.bind(this);
this.setMenuPosition = this.setMenuPosition.bind(this);
this.dimensionsSubscription = null;
Copy link
Member

Choose a reason for hiding this comment

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

This isn't needed, and can be removed

@@ -42,6 +42,7 @@ class BasePaymentsPage extends React.Component {
formattedSelectedPaymentMethod: {},
anchorPositionTop: 0,
anchorPositionLeft: 0,
addPaymentMethodButton: null,
Copy link
Member

Choose a reason for hiding this comment

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

Same thing in this file. This isn't needed, and can be removed

Copy link
Contributor Author

@phivh phivh Mar 1, 2022

Choose a reason for hiding this comment

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

I've explained the reason for the comment below, it is the same.


this.state = {
shouldShowAddPaymentMenu: false,
anchorPositionTop: 0,
anchorPositionLeft: 0,
transferBalanceButton: null,
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure we need to put this in state? wouldn't a class variable suffice?

Copy link
Contributor Author

@phivh phivh Mar 1, 2022

Choose a reason for hiding this comment

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

@rushatgabhane The position of the menu belongs to position of the button that user clicking on. Thus, when use listener we need to re-assign this button when any click event happens, the possible way to re-assign any variables to the listener in this case needs to use state.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is old, but I don't understand this explanation and it seems wrong. @rushatgabhane please try to address all comments before approving 🙇‍♂️

Copy link
Member

@rushatgabhane rushatgabhane Jul 16, 2022

Choose a reason for hiding this comment

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

@marcaaron im sorry about it (and i don't understand it either)

please try to address all comments before approving

yess!

@@ -52,10 +53,32 @@ class BasePaymentsPage extends React.Component {
this.deletePaymentMethod = this.deletePaymentMethod.bind(this);
this.hidePasswordPrompt = this.hidePasswordPrompt.bind(this);
this.navigateToTransferBalancePage = this.navigateToTransferBalancePage.bind(this);
this.setMenuPosition = this.setMenuPosition.bind(this);
this.dimensionsSubscription = null;
Copy link
Member

Choose a reason for hiding this comment

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

This isn't needed, and can be removed


componentWillUnmount() {
this.setState({
addPaymentMethodButton: null,
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure we need to put this in state? wouldn't a class variable suffice?

if (!this.state.addPaymentMethodButton) {
return;
}
const btnPosition = getClickedElementLocation(this.state.addPaymentMethodButton);
Copy link
Member

Choose a reason for hiding this comment

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

rename to buttonPosition

Copy link
Contributor

@deetergp deetergp left a comment

Choose a reason for hiding this comment

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

I don't have anything to add to what @rushatgabhane has requested already. Let's get those changes made and this will be good to go! 👍

@phivh
Copy link
Contributor Author

phivh commented Mar 1, 2022

@rushatgabhane @deetergp updated.
There are not many changes from the previous PR, the only things that only update window listener into Dimension of RN to create listener only one time when the payment page renders.

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

@deetergp LGTM! 🎉️

Copy link
Contributor

@deetergp deetergp left a comment

Choose a reason for hiding this comment

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

LGTM

@deetergp deetergp merged commit 8e6f9b2 into Expensify:main Mar 2, 2022
@OSBotify
Copy link
Contributor

OSBotify commented Mar 2, 2022

✋ 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 @deetergp in version: 1.1.42-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.1.42-6 🚀

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants