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 #116 from HummingbirdHammocks/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
loidolt authored Sep 26, 2023
2 parents da1f37b + 98970ed commit 62de07b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/sections/AccountPage/components/OrderCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export const OrderCard = ({ order, firstName, lastName, email }) => {
</Typography>
</Box>
<Box>
<Typography variant="caption">{`Total (${currencyCode}):`}</Typography>
<Typography>{`$${totalPrice}`}</Typography>
<Typography variant="caption">{`Total (${totalPrice?.currencyCode}):`}</Typography>
<Typography>{`$${totalPrice?.amount}`}</Typography>
</Box>
<Chip label={financialStatus} color={financialStatusColor(financialStatus)} />
</Stack>
Expand Down
6 changes: 3 additions & 3 deletions src/sections/AccountPage/components/OrderDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const OrderDetails = ({ firstName, lastName, email, data, returnAccount }
<TableCell align="right" colSpan={4}>
Sub Total
</TableCell>
<TableCell align="right">${subtotalPrice}</TableCell>
<TableCell align="right">${subtotalPrice?.amount}</TableCell>
</TableRow>
<TableRow
sx={{
Expand All @@ -153,7 +153,7 @@ export const OrderDetails = ({ firstName, lastName, email, data, returnAccount }
<TableCell align="right" colSpan={4}>
Shipping
</TableCell>
<TableCell align="right">${totalShippingPrice}</TableCell>
<TableCell align="right">${totalShippingPrice?.amount}</TableCell>
</TableRow>
<TableRow
sx={{
Expand All @@ -171,7 +171,7 @@ export const OrderDetails = ({ firstName, lastName, email, data, returnAccount }
<TableCell align="right" colSpan={4}>
Total
</TableCell>
<TableCell align="right">${totalPrice}</TableCell>
<TableCell align="right">${totalPrice?.amount}</TableCell>
</TableRow>
</TableBody>
</Table>
Expand Down
36 changes: 25 additions & 11 deletions src/sections/AccountPage/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ const AccountOrdersPage = () => {
}
});

console.log(error);

useEffect(() => {
if (data?.customer.orders?.edges && q) {
if (data?.customer?.orders?.edges && q) {
const index = data.customer.orders?.edges.findIndex((i) => i.node.name === q);
if (index >= 0) {
setAccountDetails({ open: true, index });
Expand All @@ -51,18 +53,18 @@ const AccountOrdersPage = () => {
<Box>
{error && 'Error'}
{loading && <MiddleSpinner divminheight="460px" size={20} />}
{data && (
{data && data.customer && (
<Grid container spacing={2} sx={{ paddingBottom: 4 }}>
<Grid item xs={12}>
<Typography sx={{ marginBottom: 7 }} variant="h4">
Order History
</Typography>
<OrderHistory
rows={data.customer.orders?.edges}
data={data?.customer.orders?.edges[accountDetails.index]}
firstName={data.customer.firstName}
lastName={data.customer.lastName}
email={data.customer.email}
rows={data.customer?.orders?.edges}
data={data.customer?.orders?.edges[accountDetails.index]}
firstName={data.customer?.firstName}
lastName={data.customer?.lastName}
email={data.customer?.email}
/>
</Grid>
</Grid>
Expand Down Expand Up @@ -101,7 +103,10 @@ const CUSTOMER_INFO = gql`
node {
name
id
totalPrice
totalPrice {
amount
currencyCode
}
processedAt
currencyCode
fulfillmentStatus
Expand All @@ -127,7 +132,10 @@ const CUSTOMER_INFO = gql`
currentTotalTax {
amount
}
totalShippingPrice
totalShippingPrice {
amount
currencyCode
}
lineItems(first: 10) {
edges {
node {
Expand All @@ -154,8 +162,14 @@ const CUSTOMER_INFO = gql`
}
}
}
subtotalPrice
totalPrice
subtotalPrice {
amount
currencyCode
}
totalPrice {
amount
currencyCode
}
}
}
}
Expand Down

0 comments on commit 62de07b

Please sign in to comment.