diff --git a/src/config/Pages.ts b/src/config/Pages.ts index fd96843..505c980 100644 --- a/src/config/Pages.ts +++ b/src/config/Pages.ts @@ -29,4 +29,6 @@ export const Pages = { setting: "/setting", wallet: "/wallet", profile: "/profile", + discounts: "/discounts", + financial: "/financial", }; diff --git a/src/index.css b/src/index.css index e71247d..21c97d6 100644 --- a/src/index.css +++ b/src/index.css @@ -12,7 +12,7 @@ body { padding: 0; width: 100%; direction: rtl; - overflow-x: hidden !important; + overflow: hidden !important; background: #eceef6; font-weight: 300; overflow: hidden; diff --git a/src/langs/fa.json b/src/langs/fa.json index 90f23b0..4fbbf3d 100644 --- a/src/langs/fa.json +++ b/src/langs/fa.json @@ -62,7 +62,12 @@ "logout": "خروج" }, "header": { - "search": "جستجو" + "search": "جستجو", + "wallet": "کیف پول", + "discounts": "کدهای تخفیف", + "financial_info": "مشخصات مالی", + "profile": "پروفایل", + "setting": "تنظیمات" }, "home": { "new": "جدید", diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx index a6cc720..63e6664 100644 --- a/src/shared/Header.tsx +++ b/src/shared/Header.tsx @@ -1,20 +1,28 @@ -import { FC } from 'react' +import { FC, useEffect, useState } from 'react' import Input from '../components/Input' -import { ArrowDown2, Element3, HambergerMenu, Wallet } from 'iconsax-react' +import { ArrowDown2, Card, CloseCircle, Element3, HambergerMenu, Logout, ProfileCircle, Receipt1, Setting2, TicketDiscount, Wallet } from 'iconsax-react' import AvatarImage from '../assets/images/Avatar.png' import { useTranslation } from 'react-i18next' -import { Link } from 'react-router-dom' +import { Link, useLocation } from 'react-router-dom' import { Pages } from '../config/Pages' import Notifications from '../pages/notification/Notification' import { useSharedStore } from './store/sharedStore' import { useGetProfile } from '../pages/profile/hooks/useProfileData' +import { Popover, PopoverButton, PopoverPanel } from '@headlessui/react' +import SideBarItem from './SideBarItem' const Header: FC = () => { + const location = useLocation(); + const [popoverKey, setPopoverKey] = useState(0); const { t } = useTranslation('global') const { setOpenSidebar, openSidebar } = useSharedStore() const { data } = useGetProfile() + useEffect(() => { + setPopoverKey((prevKey) => prevKey + 1); + }, [location.pathname]); + return (
@@ -35,20 +43,104 @@ const Header: FC = () => { { - data && -
-
- - - -
-
-
- {data?.data?.user?.firstName + ' ' + data?.data?.user?.lastName} -
- -
-
+ data && ( + + +
+
+ +
+
+
+ {data?.data?.user?.firstName + ' ' + data?.data?.user?.lastName} +
+ +
+
+
+ + +
+ setPopoverKey((prevKey) => prevKey + 1)} size={20} color='black' /> +
+
+
+ +
+ +
+ {data?.data?.user?.firstName + ' ' + data?.data?.user?.lastName} +
+ +
+ {data?.data?.user?.email} +
+
+ +
+ } + title={t('header.wallet')} + link={Pages.wallet} + isActive + isWithoutLine + /> + + } + title={t('sidebar.transactions')} + isActive + link={Pages.transactions} + isWithoutLine + /> + + } + title={t('header.discounts')} + isActive + link={Pages.discounts} + isWithoutLine + /> + + } + title={t('header.financial_info')} + isActive + link={Pages.financial} + isWithoutLine + /> + + } + title={t('header.profile')} + isActive + link={Pages.profile} + isWithoutLine + /> + + } + title={t('header.setting')} + isActive + link={Pages.setting} + isWithoutLine + /> +
+ +
+ } + title={t('sidebar.logout')} + isActive + link={Pages.setting} + isWithoutLine + isLogout + /> +
+ +
+
+ ) }
diff --git a/src/shared/SideBarItem.tsx b/src/shared/SideBarItem.tsx index 271c00e..aaa984b 100644 --- a/src/shared/SideBarItem.tsx +++ b/src/shared/SideBarItem.tsx @@ -9,6 +9,7 @@ type Props = { isActive: boolean, link: string, isLogout?: boolean, + isWithoutLine?: boolean } const SideBarItem: FC = (props: Props) => { @@ -20,10 +21,13 @@ const SideBarItem: FC = (props: Props) => { return ( -
+ { + !props.isWithoutLine && +
+ }
{props.icon}