From c9c2b87c2135c4027e50274c82ae69819596483a Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sun, 27 Jul 2025 10:19:29 +0330 Subject: [PATCH] add service worker najva and fix problem header --- public/najva-messaging-sw.js | 1 + src/shared/Header.tsx | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 public/najva-messaging-sw.js diff --git a/public/najva-messaging-sw.js b/public/najva-messaging-sw.js new file mode 100644 index 0000000..67206c3 --- /dev/null +++ b/public/najva-messaging-sw.js @@ -0,0 +1 @@ +importScripts('https://van.najva.com/static/js/service-worker.js'); \ No newline at end of file diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx index 14fd988..9a65804 100644 --- a/src/shared/Header.tsx +++ b/src/shared/Header.tsx @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next' import Notifications from '../pages/notification/Notification' import { useSharedStore } from './store/sharedStore' import { Popover, PopoverButton, PopoverPanel } from '@headlessui/react' -import { Link } from 'react-router-dom' +import { Link, useLocation } from 'react-router-dom' import { Paths } from '@/utils/Paths' import SideBarItem from './SideBarItem' import AvatarImage from '@/assets/images/avatar_image.png' @@ -19,6 +19,7 @@ const Header: FC = () => { const [showSearchResults, setShowSearchResults] = useState(false) const [inputFocused, setInputFocused] = useState(false) const [showMobileSearch, setShowMobileSearch] = useState(false) + const { pathname } = useLocation() const { t } = useTranslation('global') const { setOpenSidebar, openSidebar } = useSharedStore() @@ -98,8 +99,12 @@ const Header: FC = () => { } }, []) + useEffect(() => { + setPopoverKey((prevKey) => prevKey + 1) + }, [pathname]) + return ( -
+
{/* Desktop Search */}
@@ -160,7 +165,7 @@ const Header: FC = () => { {showMobileSearch && showSearchResults && search && (
نتیجه‌ای یافت نشد