"use client"; import Image from "next/image"; import logoImg from "../../public/assets/images/brand/logo.svg"; import Link from "next/link"; import { motion } from "framer-motion"; import { usePrivy } from "@privy-io/react-auth"; import { useRouter } from 'next/navigation'; import Cookies from "js-cookie"; import { useCallback, useEffect, useState } from "react"; export default function Header() { const privy = usePrivy(); const router = useRouter(); const [activeSection, setActiveSection] = useState(""); const handleLogin = useCallback(() => privy.login(), [privy]); useEffect(() => { if (privy?.ready) { if (privy.authenticated) { localStorage.setItem('useremail', privy.user?.email?.address ?? "Guest"); Cookies.set('privy-authenticated', 'true', { path: '/', expires: 1 }); router.push('/dashboard'); } } }, [privy.ready, privy.authenticated, router]); // Smooth scroll function const scrollToSection = (sectionId: string) => { const element = document.getElementById(sectionId); if (element) { setActiveSection(sectionId); element.scrollIntoView({ behavior: "smooth", block: "start", }); } }; // Intersection Observer to detect active section useEffect(() => { const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { setActiveSection(entry.target.id); } }); }, { threshold: 0.5 } ); const sections = ["features", "tokenomics"]; sections.forEach((section) => { const element = document.getElementById(section); if (element) observer.observe(element); }); return () => observer.disconnect(); }, []); const navItems = [ { name: "Features", href: "features", isExternal: false }, { name: "Tokenomics", href: "tokenomics", isExternal: false }, { name: "Docs", href: "https://almaze.gitbook.io/docs/", isExternal: true }, ]; return (
    {navItems.map((item) => (
  • {item.isExternal ? ( {item.name} {activeSection === item.href && ( )} ) : ( scrollToSection(item.href)} className={`relative py-1.5 px-2 rounded-md text-sm font-medium text-[#001A2C] transition-colors duration-200 ${ activeSection === item.href ? "text-[#1DA2FF]" : "" }`} whileHover={{ scale: 1.05 }} transition={{ type: "spring", stiffness: 400, damping: 10 }} > {item.name} {activeSection === item.href && ( )} )}
  • ))}
Try Almaze{" "}
); }