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

[PWA-272] [Feature]: "Edit Item" From Cart Page Kebab Menu #2191

Merged
merged 21 commits into from
Mar 3, 2020

Conversation

tjwiebell
Copy link
Contributor

Description

As a shopper, I want to edit my product from within the cart page workflow in order to change configurable options (size, color, quantity, etc.) prior to purchasing.

Today, edit exists within the mini-cart experience but during the build out of the new Cart page we realized that reusing this same experience requires additional design. This is a follow up story to PWA-238.

Need to decide on design treatment for edit item experience within the full cart.

Related Issue

  • [PWA-272] [Feature]: "Edit Item" From Cart Page Kebab Menu

Acceptance

Verification Stakeholders

Specification

Verification Steps

  1. Add Simple and Configurable Product to cart and go to /cart page
  2. Verify no edit option available for simple product
  3. Edit Config Product, verify that all selected options are correct
  4. Change some configurable options and quantity and update
  5. Verify cart is updated with selections and totals are updated

Screenshots / Screen Captures (if appropriate)

Checklist

  • I have updated the documentation accordingly, if necessary.
  • I have added tests to cover my changes, if necessary.

@tjwiebell tjwiebell added the version: Minor This changeset includes functionality added in a backwards compatible manner. label Feb 25, 2020
@m2-community-project m2-community-project bot added this to Ready for Review in Pull Request Progress Feb 25, 2020
style={finalStyle}
title={label}
type="button"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Swatch and tile were missing type="button" prop, and were triggering form submission on selection.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering why you re-ordered the props, now I get it Alphabetical order.

Is that OCD or our standard? I ask because, I have OCD too 😆

@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Feb 25, 2020

Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Associated JIRA tickets: PWA-238.

Generated by 🚫 dangerJS against aef4e4e

Copy link
Contributor

@revanth0212 revanth0212 left a comment

Choose a reason for hiding this comment

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

I did not review the changes completely. Heard you are refactoring the code. Try to think about my comments while doing that.

['OUT_OF_STOCK', 'Out of stock']
]);

export const useProductDetail = props => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this needs to be a talon? It looks like a props mapper instead.

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 would still consider destructuring or flattening of the graph logic, which I do want to contain in a talon. Open to extracting somewhere if you have a proposal.

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have anything formally defined for such use cases but it looks like the mapStateToProps we used to have in the olden golden days. Let's ask @jimbo

Copy link
Contributor

Choose a reason for hiding this comment

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

I found a place where we have done something similar but it is in a peregine talon. Not sure if we can just have the flatten/mapper functions in the component file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't look at the git blame 😉 that was also me. The intention was once we started to see overlap, that could be broken out into a utility; but these components differ slightly.


if (isLoading) {
return (
<LoadingIndicator
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we can achieve some optimization by moving the loading indicator component instance to a useMemo and returning the result if isLoading. Since only 2 states exist for the component either loading or not potentially only creating 2 instances.

....

const loadingIndicator = useMemo(() => {
  if (isLoading) {
     return (
          <LoadingIndicator
               classes={{ root: classes.loading }}
          >{`Fetching Product Options...`}</LoadingIndicator>
     );
  } else {
   return null;
  }
}, [isLoading, classes.loading]);

if (isLoading) { return loadingIndicator }

....

Copy link
Contributor

Choose a reason for hiding this comment

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

I remember @jimbo left some comments on my PR about useMemo. Don't do this yet. Let me check with Jimmy first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very interested in this discussion. I have not been a huge fan of our overuse of useMemo and useCallback, so would be nice to define some usage criteria. Relevant article:

https://kentcdodds.com/blog/usememo-and-usecallback

style={finalStyle}
title={label}
type="button"
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering why you re-ordered the props, now I get it Alphabetical order.

Is that OCD or our standard? I ask because, I have OCD too 😆

useAppContext: jest.fn()
}));

describe('return correct open status', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally like using describe but I remember I was asked not to use it unless there is no way and you want to mock/perform something for only certain tests. Check with @jimbo or other files.

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 did find other usages that use it to group tests, so I'm going to leave this for now.

Copy link
Contributor

@revanth0212 revanth0212 left a comment

Choose a reason for hiding this comment

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

Just a couple of minor things. Let me know what you think about those.

return <i talonProps={talonProps} />;
};

const configItemResponse = {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about moving this to __fixtures__/configResponses.js?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved in ec2be48

loading: false
};

const cartItem = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Even this guy to a __fixtures__ file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved in ec2be48

});

test('renders open drawer with active item', () => {
const mockItem = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since thig guy is small, it can stay here.

revanth0212
revanth0212 previously approved these changes Feb 28, 2020
revanth0212
revanth0212 previously approved these changes Feb 28, 2020
schensley
schensley previously approved these changes Feb 28, 2020
Copy link

@schensley schensley left a comment

Choose a reason for hiding this comment

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

UX approved.

NOTE: there is some buggy-ness in that the option selection should reset (to the original config) if the edit drawer is closed without tapping the "Update" button.

@fooman
Copy link
Contributor

fooman commented Mar 2, 2020

Noted a minor issue with this PR on the new cart page. When trying to update the quantity when on the Cart page via the Mini Cart, the items are removed from the Cart page but not updated:

image

image

image

Totals are also still the old value.

@dpatil-magento
Copy link
Contributor

@schensley Please check below observations related to UX.

  1. Update button is enabled by default on Edit Cart Panel.
  2. On Edit Cart Panel - Whats the reason of having product image when it does not get updated after changing configurations, also it consumes lots of space in mobile pushing buttons down .

@schensley
Copy link

Thank you @dpatil-magento for posting the comment.
I am providing some UX opinions below...

@schensley Please check below observations related to UX.

  1. Update button is enabled by default on Edit Cart Panel.
  2. On Edit Cart Panel - Whats the reason of having product image when it does not get updated after changing configurations, also it consumes lots of space in mobile pushing buttons down .
  1. Yes. Disabled buttons can be confusing for shoppers and reduce confidence in the integrity of the system. In a case where a shopper were to open the edit panel, but make no edits and tapped the "Update" button, (ideally) the edit panel would close and nothing would change in the cart (essentially equivalent to tapping the close control).
  2. The image should change to match the color selected - this is being looked into. But, the image is included in the edit panel to provide context for the edit, and the real estate is being taken advantage of to allow a more detailed view to the shopper, but this image area can be modified or not included if that is a decision the Merchant arrives at.

Thnx. Scott

- Ensure that item state is being cleared when the modal is closed
@dpatil-magento
Copy link
Contributor

QA Pass, good to merge.

@fooman Thanks for checking but Cart/Mini-Cart sync work is not done yet, so that issue is not addressed in scope of this PR.

@dpatil-magento dpatil-magento merged commit 847878f into develop Mar 3, 2020
@m2-community-project m2-community-project bot moved this from Reviewer Approved to Done in Pull Request Progress Mar 3, 2020
@dpatil-magento dpatil-magento deleted the tommy/cart-page-edit-item branch March 3, 2020 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:peregrine pkg:venia-ui version: Minor This changeset includes functionality added in a backwards compatible manner.
Development

Successfully merging this pull request may close these issues.

None yet

7 participants