"use client"; import { useRef } from "react"; interface LeadsToolbarProps { search: string; status: string; onSearchChange: (v: string) => void; onStatusChange: (v: string) => void; exportParams: Record; } export function LeadsToolbar({ search, status, onSearchChange, onStatusChange, exportParams, }: LeadsToolbarProps) { const debounceRef = useRef | null>(null); function handleSearchInput(e: React.ChangeEvent) { const val = e.target.value; if (debounceRef.current) clearTimeout(debounceRef.current); debounceRef.current = setTimeout(() => onSearchChange(val), 300); // immediate update of input e.currentTarget.value = val; } function handleExport() { const params = new URLSearchParams({ format: "xlsx", ...exportParams }); window.location.href = `/api/leads/export?${params.toString()}`; } return (
{/* Search input */}
{ e.currentTarget.style.borderColor = "#3b82f6"; }} onBlur={(e) => { e.currentTarget.style.borderColor = "#1e1e2e"; }} />
{/* Status filter */} {/* Export button */}
); }