'use client' import React, { createContext, useContext } from 'react' import {NAV_ITEMS} from "@/lib/constants"; import Link from "next/link"; import {usePathname} from "next/navigation"; import SearchCommand from "@/components/SearchCommand"; import { Heart } from 'lucide-react'; import { Button } from '@/components/ui/button'; // Create context for popup state const DonatePopupContext = createContext<{ openDonatePopup: () => void; }>({ openDonatePopup: () => {} }); export const useDonatePopup = () => useContext(DonatePopupContext); const NavItems = ({initialStocks}: { initialStocks: StockWithWatchlistStatus[]}) => { const pathname = usePathname() const isActive = (path: string) => { if (path ==='/') return pathname === '/' return pathname.startsWith(path); } const openDonatePopup = () => { // Trigger the popup by dispatching a custom event window.dispatchEvent(new CustomEvent('open-donate-popup')); } return ( ) } export default NavItems