Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #115 from HummingbirdHammocks/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
loidolt authored Aug 1, 2023
2 parents 0f3c028 + 191a69d commit da1f37b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
30 changes: 20 additions & 10 deletions src/sections/AccountPage/components/OrderCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const OrderCard = ({ order, firstName, lastName, email }) => {
successfulFulfillments
} = order.node;

console.log(lineItems.edges[0].node.title);

const { pathname } = useLocation();

const handleOrderDetails = (name) => {
Expand Down Expand Up @@ -107,18 +109,26 @@ export const OrderCard = ({ order, firstName, lastName, email }) => {
<Grid container spacing={2}>
<Grid item xs={12} sm={8} lg={7}>
{lineItems &&
lineItems.edges.map((item) => {
const {
title,
variant: {
title: variantTitle,
image: { url, altText }
},
quantity
} = item.node;
lineItems.edges.map((item, index) => {
if (!item.node) {
console.warn('item.node is null or undefined', item);
return <Box key={index}>Item is no longer available or was discontinued.</Box>;
}
const { title, variant } = item.node;
if (!variant) {
console.warn('item.node.variant is null or undefined', item);
return <Box key={index}>Item is no longer available or was discontinued.</Box>;
}
const { title: variantTitle, image } = variant;
if (!image) {
console.warn('item.node.variant.image is null or undefined', item);
return <Box key={index}>Item is no longer available or was discontinued.</Box>;
}
const { url, altText } = image;
const { quantity } = item.node;
return (
<Box sx={{ margin: 1 }} key={title}>
<Tooltip title={`${title} ${variantTitle}`}>
<Tooltip title={`${title && title} ${variantTitle && variantTitle}`}>
<Badge badgeContent={quantity} color="primary">
<img src={url} alt={altText} height={'80px'} width={'80px'} />
</Badge>
Expand Down
2 changes: 1 addition & 1 deletion src/sections/AccountPage/components/OrderDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const OrderDetails = ({ firstName, lastName, email, data, returnAccount }
'&:last-child td, &:last-child th': { border: 0 }
}}>
<TableCell scope="row">{title}</TableCell>
<TableCell align="right">{variant.sku}</TableCell>
<TableCell align="right">{variant && variant.sku && variant.sku}</TableCell>
<TableCell align="right">${originalTotalPrice.amount}</TableCell>
<TableCell align="right">{quantity}</TableCell>
<TableCell align="right">${discountedTotalPrice.amount}</TableCell>
Expand Down

0 comments on commit da1f37b

Please sign in to comment.