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

TITAN-315 - empty state cartTable + cartQuickView #35

Merged
merged 13 commits into from
Apr 21, 2023
Merged

Conversation

kleczynski
Copy link
Member

@kleczynski kleczynski commented Apr 19, 2023

Description

My task was to reflect the components of the store card based on the bigcommerce blueprint. I dealt with the card section as well as a quick preview of what's in it from the home page. Based on the mock data, I had to write a logical equivalent for an empty shopping cart. In addition, slight changes were made to the UI for styling ( example: Adjusting the font of the text informing about the empty card, etc )

https://wpengine.atlassian.net/browse/titan-315

Testing

Basically, the site is set up to test the lack of items in the card, just like other stores where we have nothing in the shopping cart when we first enter. Basically, the site is set up to test the lack of items in the card, just like other stores where we have nothing in the shopping cart when we first enter. If there would be visible items in the card for some reason then in the useCart.jsfile change const CART_STATE_KEY = "single/multiple"; to any text that ( e.g. "cart-state")

Screenshots

Screenshot 2023-04-19 at 14 29 56

Screenshot 2023-04-19 at 14 29 46

Documentation Changes

Dependent PRs

@kleczynski kleczynski requested a review from a team as a code owner April 19, 2023 10:19
components/Cart/CartTable.tsx Show resolved Hide resolved
components/Cart/CartTotals.module.scss Show resolved Hide resolved
components/Cart/CartTotals.tsx Show resolved Hide resolved
pages/cart.js Show resolved Hide resolved
pages/cart.js Show resolved Hide resolved
pages/cart.js Outdated
import CartTable from '../components/Cart/CartTable';
import CartTotals from '../components/Cart/CartTotals';
import empty from "../data/stubs/cart/empty";
import single from "../data/stubs/cart/single";
Copy link
Contributor

Choose a reason for hiding this comment

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

single isn't being used here so we can comment it out while testing empty

pages/cart.js Outdated
</>
)}
{isCartEmpty && !isCartLoading && <p>You have no items in cart</p>}
{isCartLoading && <Loader />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Loader is missing an import

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm taking care of it in my PR

Copy link
Contributor

Choose a reason for hiding this comment

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

good call, lets remove it

@@ -0,0 +1,30 @@
import React from "react"
import useAtlasShopify from "../../hooks/useAtlasShopify";
import { AiOutlineCloseCircle} from "react-icons/ai"
Copy link
Contributor

@RossoMaguire RossoMaguire Apr 19, 2023

Choose a reason for hiding this comment

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

These aren't being used. If you run npm run lint you should get warnings about unused imports as you are working

return acc + item.quantity;
}, 0);
}
const cart = empty.cart;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm tackling this part in my PR as well

Copy link
Member

@alvarocavalcanti alvarocavalcanti left a comment

Choose a reason for hiding this comment

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

Please:

  • Add a description to the PR, highlighting why some decisions were made
  • Add steps on how to test this PR
  • Be mindful of blank lines missing from the end of some files, I suggestion I have is to use GitHub's own Pull Request UI. Before creating the PR, make sure to scroll down and scan all the files to be included, you will notice a crossed red circle when the line is missing
  • The code duplication is a code smell, it adds risk to the maintainability of the Cart page and quick view. Suggestion: CartService or an adaptable component

components/Cart/CartTable.module.scss Outdated Show resolved Hide resolved
components/Cart/CartTable.tsx Outdated Show resolved Hide resolved
components/Cart/CartTotals.module.scss Outdated Show resolved Hide resolved
components/Cart/CartTotals.module.scss Outdated Show resolved Hide resolved
components/Cart/CartTotals.tsx Outdated Show resolved Hide resolved
pages/cart.js Outdated Show resolved Hide resolved
pages/cart.js Outdated Show resolved Hide resolved
Comment on lines +31 to +37
const cartItems = cart.lines.nodes;
const cartCount = cartItems.length
const isCartEmpty = cartCount === 0;
const isCartLoading = false;
const cartSubTotal = cart.cost.subtotalAmount.amount;
const cartTotal = cart.cost.totalAmount.amount;
const checkoutUrl = cart.checkoutUrl;
Copy link
Member

Choose a reason for hiding this comment

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

Five of these seven lines are duplicated in CartQuickView.js we should address this, maybe creating a Cart service? Any suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm already tackling this, but I'm blocked by changes in this PR

styles/_utilities.scss Outdated Show resolved Hide resolved
@alvarocavalcanti alvarocavalcanti changed the title Titan 315 - empty state cartTable + cartQuickView TITAN-315 - empty state cartTable + cartQuickView Apr 19, 2023
Copy link
Contributor

@RossoMaguire RossoMaguire left a comment

Choose a reason for hiding this comment

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

LGTM! Nice job addressing the comments. We can tackle the other bits in @mikepawlinski PR

@alvarocavalcanti
Copy link
Member

@kleczynski Please try to use descriptive commit messages instead of refactor according to Alvaro suggestions. I mentioned this yesterday in the engineers channel: https://wpengine.slack.com/archives/C046YV4FDL6/p1681904355631379

Think that once this code gets merged and someone is reading through the commit history trying to figure out something they won't have clarity on what was added on that commit.

Copy link
Member

@alvarocavalcanti alvarocavalcanti left a comment

Choose a reason for hiding this comment

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

LGTM!

@kleczynski kleczynski merged commit f91535d into main Apr 21, 2023
@kleczynski kleczynski deleted the titan-315 branch April 21, 2023 10:56
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.

4 participants