"use client"; import { useState, useEffect } from "react"; import Link from "next/link"; import { ShoppingBag, Menu, Phone, Wrench } from "lucide-react"; import { NavDropdown } from "./NavDropdown"; import { MobileMenu } from "./MobileMenu"; import { useCartStore } from "@/lib/cart-store"; import { companyDetails } from "@/content/company"; import { cn } from "@/lib/utils"; import { buttonClasses } from '@/components/ui/Button'; export function Header() { const [isScrolled, setIsScrolled] = useState(false); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const [mounted, setMounted] = useState(false); const cartItems = useCartStore((state) => state.items); useEffect(() => { const t = setTimeout(() => setMounted(true), 0); const handleScroll = () => { if (window.scrollY > 40) { setIsScrolled(true); } else { setIsScrolled(false); } }; window.addEventListener("scroll", handleScroll); return () => { window.removeEventListener("scroll", handleScroll); clearTimeout(t); }; }, []); const cartCount = mounted ? cartItems.reduce((total, item) => total + item.quantity, 0) : 0; const acSections = [ { title: "Klimatyzatory", items: [ { label: "Ścienne split", href: "/sklep?category=scienne", description: "Klasyczne jednostki ścienne do mieszkań", }, { label: "Multisplit", href: "/sklep?category=multisplit", description: "Systemy wielopokojowe (2-5 pomieszczeń)", }, /* { label: "Kasetonowe i konsolowe", href: "/sklep?category=kasetonowe", description: "Modele biurowe i przypodłogowe", }, */ ], }, { title: "Usługi HVAC", items: [ { label: "Montaż klimatyzacji", href: "/montaz-klimatyzacji", description: "Kompleksowy dobór, audyt i montaż", }, { label: "Serwis i czyszczenie", href: "/serwis-klimatyzacji", description: "Odgrzybianie, naprawy i przeglądy", }, { label: "Cennik montażu", href: "/cennik-montazu", description: "Przejrzyste ceny — split, multisplit, bruzda", }, ], }, ]; return ( <> {companyDetails.shortName} . Dobór urządzenia Blog Kontakt {companyDetails.phone} {cartCount > 0 && ( {cartCount} )} Darmowa wycena {companyDetails.shortName} . {cartCount > 0 && ( {cartCount} )} setIsMobileMenuOpen(true)} className="p-2 text-primary hover:text-accent hover:bg-muted transition-colors rounded-lg outline-none" aria-label="Otwórz menu" > setIsMobileMenuOpen(false)} /> > ); }