"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect, useState } from "react"; export function Topbar() { const pathname = usePathname(); const [newLeadsCount, setNewLeadsCount] = useState(0); 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); }, []); const isSearch = pathname === "/suche" || pathname.startsWith("/suche/"); const isLeadspeicher = pathname === "/leadspeicher" || pathname.startsWith("/leadspeicher/"); return (
{/* Left: Logo + Nav */}
mein-solar | Lead Finder
); }