"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { cn } from "@/lib/utils"; import { Building2, Linkedin, Search, BarChart3, Settings, Zap, ChevronLeft, ChevronRight, MapPin, Database } from "lucide-react"; import { useAppStore } from "@/lib/store"; import { useEffect, useState } from "react"; const navItems = [ { href: "/airscale", icon: Building2, label: "AirScale → Email", color: "text-blue-400" }, { href: "/linkedin", icon: Linkedin, label: "LinkedIn → Email", color: "text-blue-500" }, { href: "/serp", icon: Search, label: "SERP → Email", color: "text-purple-400" }, { href: "/maps", icon: MapPin, label: "Maps → Email", color: "text-green-400" }, { href: "/leadvault", icon: Database, label: "LeadVault", color: "text-violet-400", badge: true }, { href: "/results", icon: BarChart3, label: "Ergebnisse & Verlauf", color: "text-yellow-400" }, { href: "/settings", icon: Settings, label: "Einstellungen", color: "text-gray-400" }, ]; interface CredentialStatus { anymailfinder: boolean; apify: boolean; vayne: boolean; googlemaps: boolean; } export function Sidebar() { const pathname = usePathname(); const { sidebarCollapsed, setSidebarCollapsed } = useAppStore(); const [creds, setCreds] = useState({ anymailfinder: false, apify: false, vayne: false, googlemaps: false }); const [newLeadsCount, setNewLeadsCount] = useState(0); useEffect(() => { fetch("/api/credentials") .then(r => r.json()) .then(d => setCreds(d)) .catch(() => {}); }, []); useEffect(() => { function fetchNewLeads() { fetch("/api/leads/stats") .then(r => r.json()) .then((d: { new?: number }) => setNewLeadsCount(d.new ?? 0)) .catch(() => {}); } fetchNewLeads(); const t = setInterval(fetchNewLeads, 30000); return () => clearInterval(t); }, []); return ( ); }