App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-11-05] Payments - add a fill background to "Add new payment method"

Open isagoico opened this issue 5 years ago • 22 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Navigate to payments
  2. Click on "add new payment method"

Expected Result:

There should be a grey background the the payment methods menu is open.

Actual Result:

Background stays white.

Workaround:

None needed, visual issue.

Platform:

Where is this issue occurring?

  • Web
  • Desktop App

Version Number: 1.1.8-0

Reproducible in staging?: Yes Reproducible in production?: Yes

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation image

Expensify/Expensify Issue URL:

Issue reported by: @Santhosh-Sellavel Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1634144802229400

View all open jobs on GitHub

isagoico avatar Oct 16 '21 20:10 isagoico

Triggered auto assignment to @Beamanator (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Oct 16 '21 20:10 MelvinBot

Triggered auto assignment to @sylveawong (Design), see these Stack Overflow questions for more details.

MelvinBot avatar Oct 16 '21 20:10 MelvinBot

Proposal

  1. Pass a new prop isAddPaymentMenuVisible={this.state.shouldShowAddPaymentMenu} to PaymentMethodList component after isLoadingPayments prop https://github.com/Expensify/App/blob/74b77a81d2c3fddee43b2c8b04802fed9251d96f/src/pages/settings/Payments/PaymentsPage.js#L127-L131

  2. Small modification in addPaymentMethod object

combinedPaymentMethods.push({
    type: MENU_ITEM,
    title: this.props.translate('paymentMethodList.addPaymentMethod'),
    icon: Plus,
    onPress: e => this.props.onPress(e),
    key: 'addPaymentMethodButton',
    disabled: this.props.isLoadingPayments,
    
    // ↓↓↓ THIS KEY ADDEDD
    wrapperStyle: this.props.isShowAddPaymentMenuVisible && styles.switchInactive,
});
  1. Finally add wrapperStyle={item.wrapperStyle} prop to MenuItem component in here: https://github.com/Expensify/App/blob/74b77a81d2c3fddee43b2c8b04802fed9251d96f/src/pages/settings/Payments/PaymentMethodList.js#L153-L162

And of course I'll add new props to propTypes.

Edit: styles.switchInactive is for demo purposes and it can be changed any background color.

kakajann avatar Oct 18 '21 04:10 kakajann

Hmm I'd like to get confirmation from @sylveawong that this is actually something we want to implement, before reviewing proposals. If it's something we'll fix / work on, I'll definitely mark this External.

@sylveawong it looks like this issue is proposing to give the "Add payment method" button a gray background when it is selected (a.k.a. when the user is choosing what type of payment method to add). A few questions for you:

  1. Do you think this is necessary / useful to add?
  2. If yes, what color gray would you recommend we make the background of the "Add payment method button"? Or would you recommend some other way to indicate that the button is "active"?

If you prefer, I can bring up this conversation in the Slack thread where this improvement was proposed 🤷 let me know!

Beamanator avatar Oct 18 '21 16:10 Beamanator

Correct @Beamanator. There are other parts of the app that follow this Design pattern. Add secondary login (add a phone number) on the profile page. If we want to change this here. We should Update that part as well.

parasharrajat avatar Oct 18 '21 16:10 parasharrajat

sorry! going to remove myself and @shawnborton / @michelle-thompson so they can get to this first!

sylveawong avatar Oct 18 '21 18:10 sylveawong

I think we can just have it maintain its :hover state when it's actively showing a dropdown. Let me know if that makes sense.

shawnborton avatar Oct 18 '21 20:10 shawnborton

Yeah that makes sense - the current styles we apply on hover, we'll now apply whenever it's "active" (when it gets clicked)

Beamanator avatar Oct 18 '21 20:10 Beamanator

@parasharrajat I see what you mean, the "Add secondary login" button is quite similar to "Add payment method", but the "Add secondary login" button opens a new route (/settings/addlogin/phone) while "Add payment method" just opens a dropdown. I think it's fine to keep these different for the moment, what do you think @shawnborton ?

Beamanator avatar Oct 18 '21 21:10 Beamanator

Proposal

This is the style method we use to set background in MenuItem https://github.com/Expensify/App/blob/dd9e492ab67710848c9343fc6a47867f2fedd00f/src/styles/styles.js#L2334-L2338

We can pass CONST.BUTTON_STATES.ACTIVE and get the style and need to pass it as add new property here https://github.com/Expensify/App/blob/dd9e492ab67710848c9343fc6a47867f2fedd00f/src/pages/settings/Payments/PaymentMethodList.js#L130-L136

wrapperStyle: this.props.isAddPaymentMenuActive ? [getButtonBackgroundColorStyle(CONST.BUTTON_STATES.ACTIVE)] : [],
iconFill: this.props.isAddPaymentMenuActive ?  getIconFillColor(CONST.BUTTON_STATES.ACTIVE)  : null,

And pass it along below, https://github.com/Expensify/App/blob/a142eb2fd137132a1f5278fca089c842c08cb243/src/pages/settings/Payments/PaymentMethodList.js#L153-L155

isAddPaymentMenuActive prop will added to PaymentMethodList component.

And pass prop,

isAddPaymentMenuActive={this.state.shouldShowAddPaymentMenu}

along with below lines https://github.com/Expensify/App/blob/e69f60377fb5ae0c486a0782680db7ad5b1d8c0e/src/pages/settings/Payments/PaymentsPage.js#L127-L129

For Button state: CONST.BUTTON_STATES.ACTIVE

Screenshot 2021-10-19 at 3 17 59 AM

For Button state: CONST.BUTTON_STATES.PRESSED

Screenshot 2021-10-19 at 3 17 31 AM

@shawnborton which looks good?

cc: @Beamanator

Santhosh-Sellavel avatar Oct 18 '21 21:10 Santhosh-Sellavel

Forgot to attach the result for my proposal Here is result:

https://user-images.githubusercontent.com/11542415/137832141-9333afa3-d540-45a8-b372-f87483c587dc.mov

kakajann avatar Oct 19 '21 02:10 kakajann

Triggered auto assignment to @bfitzexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Oct 19 '21 22:10 MelvinBot

Unassigning design team since decision was made here, removing n6-hold since the hold is over! Will review proposals soon

Beamanator avatar Oct 19 '21 22:10 Beamanator

@shawnborton I just noticed this button technically has 3 states:

  1. Sitting alone
  2. Hovered
  3. Active (when being clicked)

Here's a vid showing all 3 - which do you prefer keeping when the menu is active? Also do we care about the + icon remaining solid black when the menu is open?:

https://user-images.githubusercontent.com/3885503/138003010-9667efaa-6867-4eba-8805-83a4e0096323.mov

Beamanator avatar Oct 19 '21 23:10 Beamanator

Upwork posting

bfitzexpensify avatar Oct 20 '21 15:10 bfitzexpensify

Hmm good find @Beamanator I think the :active state probably makes the most sense since the row is kind of "active" while the dropdown is shown. Thoughts?

shawnborton avatar Oct 20 '21 19:10 shawnborton

Yeah I agree, I think "active" - also making sure the + sign is black, as it is when being clicked & hovered.

@Santhosh-Sellavel @kakajann can you both please update your proposals to include keeping the + icon black? I think in both of your solutions the background will be darker but the + icon changes back to gray

Beamanator avatar Oct 20 '21 20:10 Beamanator

@Beamanator updated now!

Santhosh-Sellavel avatar Oct 20 '21 20:10 Santhosh-Sellavel

That's how I would solve this anyway) as @Santhosh-Sellavel did. iconFill is simply enough. No advanced logic required

kakajann avatar Oct 20 '21 21:10 kakajann

Thanks for the swift responses guys!

@Santhosh-Sellavel I will give this job to you, i like your use of existing style methods like getButtonBackgroundColorStyle and getIconFillColor, I also like the prop names you suggested. Please move forward with submitting a PR when you have a chance 👍

Beamanator avatar Oct 21 '21 16:10 Beamanator