From d9c7d9b6ca95829568cb9fa3510b7c1f966ec29f Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Thu, 26 Feb 2026 10:50:02 +0330 Subject: [PATCH] profile in header --- src/shared/Header.tsx | 175 ++++++++++++------------------------------ 1 file changed, 51 insertions(+), 124 deletions(-) diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx index 8073938..f46ba0c 100644 --- a/src/shared/Header.tsx +++ b/src/shared/Header.tsx @@ -1,27 +1,25 @@ -import { type FC, useEffect } from 'react' +import { type FC, useEffect, useState } from 'react' import Input from '@/components/Input' -import { HambergerMenu, Wallet } from 'iconsax-react' -// import AvatarImage from '@/assets/images/avatar_image.png' +import { ArrowDown2, Card, CloseCircle, HambergerMenu, Logout, ProfileCircle, Receipt1, Setting2, TicketDiscount, Wallet } from 'iconsax-react' +import { Link } from 'react-router-dom' import { useLocation } from 'react-router-dom' import Notifications from '@/pages/notification/Notification' import { useSharedStore } from './store/useSharedStore' -// import { useGetProfile } from '@/pages/profile/hooks/useProfileData' -// import { Popover, PopoverButton, PopoverPanel } from '@headlessui/react' -// import SidebarItem from './SidebarItem' -// import { useGetWalletBalance } from '@/pages/wallet/hooks/useWalletData' -// import { NumberFormat } from '../config/func' +import { Popover, PopoverButton, PopoverPanel } from '@headlessui/react' +import SidebarItem from './SidebarItem' import { t } from '@/locale' +import { useGetAdminMe } from '@/pages/admin/hooks/useAdminData' +import { Paths } from '@/config/Paths' const Header: FC = () => { const location = useLocation(); - // const [popoverKey, setPopoverKey] = useState(0); + const [popoverKey, setPopoverKey] = useState(0); const { setOpenSidebar, openSidebar } = useSharedStore() - // const { data } = useGetProfile() - // const getWalletBalance = useGetWalletBalance() + const { data } = useGetAdminMe() useEffect(() => { - // setPopoverKey((prevKey) => prevKey + 1); + setPopoverKey((prevKey) => prevKey + 1); }, [location.pathname]); return ( @@ -45,125 +43,54 @@ const Header: FC = () => { */} -
-
- {/* {NumberFormat(getWalletBalance.data?.data?.balance) + ' ' + t('toman')} */} - 20,132 -
-
- -
-
- {/* */} - {/* { - data && ( - - -
-
- -
-
-
- {data?.data?.user?.firstName + ' ' + data?.data?.user?.lastName} -
- -
+ {data?.data && ( + + +
+
+ {String(data?.data?.firstName ?? '').charAt(0)}{String(data?.data?.lastName ?? '').charAt(0)}
- - - -
- setPopoverKey((prevKey) => prevKey + 1)} size={20} color='black' /> +
+
+ {data?.data?.firstName + ' ' + data?.data?.lastName} +
+
- -
- -
+
+ -
- {data?.data?.user?.firstName + ' ' + data?.data?.user?.lastName} -
- -
- {data?.data?.user?.email} -
- - -
-
- } - title={t('header.wallet')} - link={Pages.wallet} - isActive - isWithoutLine - /> -
-
{t('home.balance')}
-
- {NumberFormat(getWalletBalance.data?.data?.balance) + ' ' + t('toman')} -
-
-
- - } - 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 - /> + +
+ setPopoverKey((prevKey) => prevKey + 1)} size={20} color='black' /> +
+ +
+ {String(data?.data?.firstName ?? '').charAt(0)}{String(data?.data?.lastName ?? '').charAt(0)}
- -
- } - title={t('sidebar.logout')} - isActive - link={Pages.setting} - isWithoutLine - isLogout - /> +
+ {data?.data?.firstName + ' ' + data?.data?.lastName}
+
+ {String(data?.data?.phone ?? '')} +
+ - - - ) - } */} + +
+ } + title={t('sidebar.logout')} + isActive + link={Paths.auth.login} + isWithoutLine + isLogout + activeName='' + /> +
+ + + )}
)