-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
114 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Divider, Stack, Typography } from '@mui/material'; | ||
import { FC, ReactNode } from 'react'; | ||
|
||
export interface CardHeaderProps { | ||
title: string; | ||
children?: ReactNode; | ||
} | ||
const CardHeader: FC<CardHeaderProps> = ({ title, children }) => { | ||
return ( | ||
<Stack spacing={0.5}> | ||
<Stack direction="row" justifyContent="space-between" alignItems="center"> | ||
<Typography variant="subtitle1">{title}</Typography> | ||
{children} | ||
</Stack> | ||
<Divider /> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default CardHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use client'; | ||
|
||
import { GET_CUSTOMER_ORDERS } from '@/graphql/queries/customer'; | ||
import { GetCustomerOrdersQuery } from '@/graphql/types/graphql'; | ||
import { useQuery } from '@apollo/client'; | ||
import { Card, CardContent, Stack } from '@mui/material'; | ||
import { useTranslations } from 'next-intl'; | ||
import CardHeader from '../components/CardHeader'; | ||
import OrderItem from '../components/OrderItem'; | ||
import OrderItemSkeleton from '../components/OrderItemSkeleton'; | ||
|
||
const Page = () => { | ||
const t = useTranslations(); | ||
|
||
const { data, loading, error } = useQuery<GetCustomerOrdersQuery>( | ||
GET_CUSTOMER_ORDERS, | ||
{ | ||
variables: { | ||
count: 10, | ||
statuses: [], | ||
}, | ||
}, | ||
); | ||
|
||
return ( | ||
<Card variant="outlined"> | ||
<CardContent> | ||
<CardHeader title={t('order.ordersHistory')} /> | ||
<Stack spacing={1.5} mt={2}> | ||
{loading || !!error ? ( | ||
<OrderItemSkeleton /> | ||
) : ( | ||
<> | ||
{data?.customer?.orders?.edges?.map((edge) => { | ||
const order = edge.node!; | ||
return <OrderItem key={order.id} {...order} />; | ||
})} | ||
</> | ||
)} | ||
</Stack> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters