-
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.
Merge branch 'main' of https://github.com/pooriaset/nextjs-shop-app
- Loading branch information
Showing
40 changed files
with
11,213 additions
and
10,077 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 |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
"ecommerce", | ||
"iranyekanwebboldfanum", | ||
"muirtl", | ||
"nextauth", | ||
"nextjs", | ||
"Parens", | ||
"prefixer", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
user-agent: * | ||
disallow: /card | ||
disallow: /checkout | ||
disallow: /profile* |
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 |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import en from '../data/i18n/en.json'; | ||
|
||
type Messages = typeof en; | ||
|
||
declare global { | ||
// Use type safe message keys with `next-intl` | ||
interface IntlMessages extends Messages {} | ||
|
||
namespace NodeJS { | ||
interface ProcessEnv { | ||
NEXT_PUBLIC_WOOCOMMERCE_SESSION_KEY: string; | ||
NEXT_PUBLIC_GRAPHQL_URL: string; | ||
} | ||
} | ||
|
||
type Nullable<T> = { | ||
[P in keyof T]: T[P] | null; | ||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { GET_CUSTOMER_PROFILE } from '@/graphql/queries/customer'; | ||
import { GetCustomerProfileQuery } from '@/graphql/types/graphql'; | ||
import { useQuery } from '@apollo/client'; | ||
import { Box } from '@mui/material'; | ||
import MenuHeader from './MenuHeader'; | ||
import MenuItems from './MenuItems'; | ||
import { PersonOutline, ShoppingBagOutlined } from '@mui/icons-material'; | ||
import { useTranslations } from 'next-intl'; | ||
|
||
const Menu = () => { | ||
const { data, loading, error } = | ||
useQuery<GetCustomerProfileQuery>(GET_CUSTOMER_PROFILE); | ||
|
||
const t = useTranslations(); | ||
|
||
const fullName = data?.customer?.firstName | ||
? data?.customer?.firstName + ' ' + data?.customer?.lastName | ||
: t('profile.user'); | ||
|
||
const items = [ | ||
{ | ||
label: t('profile.myOrders'), | ||
href: '/profile/orders', | ||
icon: ShoppingBagOutlined, | ||
count: data?.customer?.orderCount || 0, | ||
}, | ||
{ | ||
label: t('profile.accountInfo'), | ||
href: '/profile/information', | ||
icon: PersonOutline, | ||
}, | ||
]; | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
width: 260, | ||
border: '1px solid', | ||
borderColor: 'divider', | ||
borderRadius: 1, | ||
}} | ||
> | ||
<MenuHeader | ||
isLoading={!!error || loading} | ||
fullName={fullName} | ||
username={data?.customer?.username || ''} | ||
/> | ||
|
||
<MenuItems items={items} /> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default Menu; |
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,40 @@ | ||
import CustomSkeleton from '@/components/CustomSkeleton/CustomSkeleton'; | ||
import { Link } from '@/navigation'; | ||
import { BorderColorOutlined } from '@mui/icons-material'; | ||
import { Box, IconButton, Stack, Typography } from '@mui/material'; | ||
import { FC } from 'react'; | ||
|
||
export interface MenuHeaderProps { | ||
fullName: string; | ||
username: string; | ||
isLoading?: boolean; | ||
} | ||
|
||
const MenuHeader: FC<MenuHeaderProps> = ({ fullName, username, isLoading }) => { | ||
return ( | ||
<Box p={2}> | ||
<Stack direction="row" alignItems="center" justifyContent="space-between"> | ||
<Stack spacing={0.25}> | ||
<CustomSkeleton isLoading={isLoading} height={20} width={40}> | ||
<Typography>{fullName}</Typography> | ||
</CustomSkeleton> | ||
<CustomSkeleton isLoading={isLoading} height={20} width={80}> | ||
<Typography variant="caption" color="text.secondary"> | ||
{username} | ||
</Typography> | ||
</CustomSkeleton> | ||
</Stack> | ||
<IconButton | ||
component={Link} | ||
href="/profile/information" | ||
size="small" | ||
color="primary" | ||
> | ||
<BorderColorOutlined fontSize="small" /> | ||
</IconButton> | ||
</Stack> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default MenuHeader; |
Oops, something went wrong.