"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useState, useEffect } from "react"; const NAV_ITEMS = [ { href: "/", label: "Overview", icon: "📊" }, { href: "/research", label: "Research", icon: "🔬" }, { href: "/valuation", label: "Valuation", icon: "💰" }, { href: "/technical", label: "Technical", icon: "📈" }, { href: "/markets", label: "Markets", icon: "🌍" }, { href: "/earnings", label: "Earnings", icon: "📅" }, { href: "/news", label: "News", icon: "📰" }, { href: "/portfolio", label: "Portfolio", icon: "💼" }, { href: "/filings", label: "Filings", icon: "📑" }, ]; export function Sidebar() { const pathname = usePathname(); const [input, setInput] = useState(""); const [ticker, setTickerLocal] = useState("AAPL"); useEffect(() => { const saved = localStorage.getItem("atlas_active_ticker"); if (saved) setTickerLocal(saved); const handler = (e: Event) => { const detail = (e as CustomEvent).detail; if (detail) setTickerLocal(detail); }; window.addEventListener("atlas-ticker-change", handler); return () => window.removeEventListener("atlas-ticker-change", handler); }, []); function handleSearch() { const val = input.trim().toUpperCase(); if (val) { setTickerLocal(val); localStorage.setItem("atlas_active_ticker", val); window.dispatchEvent(new CustomEvent("atlas-ticker-change", { detail: val })); setInput(""); } } return ( ); }