add service worker najva and fix problem header

This commit is contained in:
hamid zarghami
2025-07-27 10:19:29 +03:30
parent a75682dd82
commit c9c2b87c21
2 changed files with 9 additions and 3 deletions
+1
View File
@@ -0,0 +1 @@
importScripts('https://van.najva.com/static/js/service-worker.js');
+8 -3
View File
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import Notifications from '../pages/notification/Notification' import Notifications from '../pages/notification/Notification'
import { useSharedStore } from './store/sharedStore' import { useSharedStore } from './store/sharedStore'
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/react' 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 { Paths } from '@/utils/Paths'
import SideBarItem from './SideBarItem' import SideBarItem from './SideBarItem'
import AvatarImage from '@/assets/images/avatar_image.png' import AvatarImage from '@/assets/images/avatar_image.png'
@@ -19,6 +19,7 @@ const Header: FC = () => {
const [showSearchResults, setShowSearchResults] = useState(false) const [showSearchResults, setShowSearchResults] = useState(false)
const [inputFocused, setInputFocused] = useState(false) const [inputFocused, setInputFocused] = useState(false)
const [showMobileSearch, setShowMobileSearch] = useState(false) const [showMobileSearch, setShowMobileSearch] = useState(false)
const { pathname } = useLocation()
const { t } = useTranslation('global') const { t } = useTranslation('global')
const { setOpenSidebar, openSidebar } = useSharedStore() const { setOpenSidebar, openSidebar } = useSharedStore()
@@ -98,8 +99,12 @@ const Header: FC = () => {
} }
}, []) }, [])
useEffect(() => {
setPopoverKey((prevKey) => prevKey + 1)
}, [pathname])
return ( return (
<div className='fixed z-50 right-4 left-4 xl:right-[285px] top-4 xl:h-16 h-12 flex items-center px-6 bg-white justify-between rounded-[32px] xl:w-[calc(100%-305px)]'> <div className='fixed z-1 right-4 left-4 xl:right-[285px] top-4 xl:h-16 h-12 flex items-center px-6 bg-white justify-between rounded-[32px] xl:w-[calc(100%-305px)]'>
{/* Desktop Search */} {/* Desktop Search */}
<div className='min-w-[270px] hidden xl:block relative'> <div className='min-w-[270px] hidden xl:block relative'>
<div id="search-input-container"> <div id="search-input-container">
@@ -160,7 +165,7 @@ const Header: FC = () => {
{showMobileSearch && showSearchResults && search && ( {showMobileSearch && showSearchResults && search && (
<div <div
id="mobile-search-dropdown-container" id="mobile-search-dropdown-container"
className='fixed right-4 left-4 top-16 z-50 bg-white rounded-xl shadow-lg max-h-[calc(100vh-80px)] overflow-y-auto' className='fixed right-4 left-4 top-16 z-1 bg-white rounded-xl shadow-lg max-h-[calc(100vh-80px)] overflow-y-auto'
> >
<div className='p-4 text-center text-sm text-description'> <div className='p-4 text-center text-sm text-description'>
نتیجهای یافت نشد نتیجهای یافت نشد