From 207f83be8d4850131ec86455d2818ab4809e4580 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Thu, 2 Jul 2026 21:31:09 +0330 Subject: [PATCH] up --- src/shared/Header.tsx | 136 ++++-------------------------------------- 1 file changed, 13 insertions(+), 123 deletions(-) diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx index 0189132..c6ea7f4 100644 --- a/src/shared/Header.tsx +++ b/src/shared/Header.tsx @@ -1,31 +1,19 @@ -import { type FC, useEffect } from 'react' +import { type FC } from 'react' import Input from '@/components/Input' import { HambergerMenu, Wallet } from 'iconsax-react' -// import AvatarImage from '@/assets/images/avatar_image.png' -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 { t } from '@/locale' import { useGetMe } from '@/pages/user/hooks/useUserData' import { NumberFormat } from '@/config/func' const Header: FC = () => { - const location = useLocation(); const { data } = useGetMe() - // const [popoverKey, setPopoverKey] = useState(0); const { setOpenSidebar, openSidebar } = useSharedStore() - // const { data } = useGetProfile() - // const getWalletBalance = useGetWalletBalance() - useEffect(() => { - // setPopoverKey((prevKey) => prevKey + 1); - }, [location.pathname]); + const displayName = [data?.firstName, data?.lastName].filter(Boolean).join(' ').trim() + const initials = `${String(data?.firstName ?? '').charAt(0)}${String(data?.lastName ?? '').charAt(0)}` return (
@@ -59,114 +47,16 @@ const Header: FC = () => {
{/* */} - {/* { - 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 - /> -
-
{t('home.balance')}
-
- {NumberFormat(getWalletBalance.data?.data?.balance) + ' ' + t('rial')} -
-
-
- - } - 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 - /> -
- -
-
- ) - } */} + {displayName && ( +
+
+ {initials} +
+
+ {displayName} +
+
+ )} )