diff --git a/src/app/components/nav/Header.tsx b/src/app/components/nav/Header.tsx index 68ff456..3a5f846 100644 --- a/src/app/components/nav/Header.tsx +++ b/src/app/components/nav/Header.tsx @@ -68,6 +68,7 @@ export default function Header({ setGlobalLoggingOut }: HeaderProps) { const refreshAuthToken = useAuthStore(s => s.refreshAuthToken) const router = useRouter() const pathname = usePathname() + const isHome = pathname === '/' const [hasReferralPerm, setHasReferralPerm] = useState(false) const [adminMgmtOpen, setAdminMgmtOpen] = useState(false) @@ -122,8 +123,8 @@ export default function Header({ setGlobalLoggingOut }: HeaderProps) { useEffect(() => { if (!mounted) return - if (pathname !== '/') { - // non-home: header always visible + if (!isHome) { + // non-home: header always visible, no scroll listeners setScrollY(100) return } @@ -148,7 +149,7 @@ export default function Header({ setGlobalLoggingOut }: HeaderProps) { window.removeEventListener('scroll', handleScroll) window.removeEventListener('wheel', handleWheel) } - }, [mounted, pathname]) + }, [mounted, isHome]) // Fetch user permissions and set hasReferralPerm useEffect(() => { @@ -307,15 +308,23 @@ export default function Header({ setGlobalLoggingOut }: HeaderProps) { ((user as any)?.roles?.includes?.('admin')) ) const isAdmin = mounted && rawIsAdmin - const headerVisible = pathname !== '/' ? animateIn : animateIn && scrollY > 24 - const parallaxOffset = pathname === '/' ? Math.max(-16, -scrollY * 0.15) : 0 + + // Only gate visibility by scroll on home; elsewhere just use animateIn + const headerVisible = isHome ? animateIn && scrollY > 24 : animateIn + const parallaxOffset = isHome ? Math.max(-16, -scrollY * 0.15) : 0 return (