import { type FC, useEffect } from 'react' import Input from '@/components/Input' // import { ArrowDown2, CloseCircle, HambergerMenu, Logout, Wallet } from 'iconsax-react' // import AvatarImage from '../assets/images/avatar_image.png' import { useTranslation } from 'react-i18next' import { Link, useLocation } from 'react-router-dom' import { Paths } from '@/config/Paths' import { useSharedStore } from '@/shared/store/sharedStore' import { Eye, HambergerMenu } from 'iconsax-react' import { clx } from '@/helpers/utils' type SidebarSize = 'default' | 'wide' type HeaderProps = { hasMainSidebar?: boolean sidebarSize?: SidebarSize } const sidebarSizeClasses: Record = { default: { base: 'xl:right-[285px] xl:w-[calc(100%-305px)]', withSub: 'xl:right-[320px] xl:w-[calc(100%-340px)]', }, wide: { base: 'xl:right-[390px] xl:w-[calc(100%-406px)]', withSub: 'xl:right-[425px] xl:w-[calc(100%-441px)]', }, } const Header: FC = ({ hasMainSidebar = true, sidebarSize = 'default' }) => { // const location = useLocation(); // const [popoverKey, setPopoverKey] = useState(0); const { t } = useTranslation('global') const { setOpenSidebar, openSidebar, hasSubMenu, setSearch } = useSharedStore() const location = useLocation() const editorPathPrefix = `${Paths.editor}/` const isEditorRoute = location.pathname.startsWith(editorPathPrefix) && location.pathname.length > editorPathPrefix.length const editorDocumentId = isEditorRoute ? (location.pathname.slice(editorPathPrefix.length).split('/')[0] ?? '') : '' // useEffect(() => { // setPopoverKey((prevKey) => prevKey + 1); // }, [location.pathname]); // const handleLogout = () => { // removeToken() // removeRefreshToken() // window.location.href = Pages.auth.login // } useEffect(() => { setSearch('') // eslint-disable-next-line react-hooks/exhaustive-deps }, [location.pathname]) return (
setSearch(value)} />
setOpenSidebar(!openSidebar)} className='xl:hidden block'>
{/* */}
{isEditorRoute && editorDocumentId ? ( ) : null} {/* */} {/* */} {/* { data && (
{data?.data?.user?.firstName + ' ' + data?.data?.user?.lastName}
setPopoverKey((prevKey) => prevKey + 1)} size={20} color='#da2129' />
{data?.data?.user?.firstName + ' ' + data?.data?.user?.lastName}
{data?.data?.user?.email}
handleLogout()} className='flex gap-2 items-center cursor-pointer'>
{t('sidebar.logout')}
) } */}
) } export default Header