import React, { useState, useMemo, memo } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Download, ChevronDown, ChevronUp, Phone, MapPin, Globe, Search } from 'lucide-react'; const Dashboard = memo(({ stats, groupedData, onExport }) => { const [expandedNiche, setExpandedNiche] = useState(null); const [searchTerm, setSearchTerm] = useState(''); const toggleNiche = (niche) => { if (expandedNiche === niche) { setExpandedNiche(null); } else { setExpandedNiche(niche); } }; const filteredNiches = useMemo(() => { return Object.keys(groupedData).filter(niche => niche.toLowerCase().includes(searchTerm.toLowerCase()) ).sort(); }, [groupedData, searchTerm]); return (
{/* Header / Stats */}
{/* Actions */}
setSearchTerm(e.target.value)} style={{ width: '100%', padding: '0.75rem 1rem 0.75rem 2.5rem', background: 'var(--surface-color)', border: '1px solid var(--border-color)', borderRadius: 'var(--radius-md)', color: 'white', outline: 'none' }} />
{/* Niches List */}
{filteredNiches.map((niche, index) => ( toggleNiche(niche)} index={index} /> ))}
); }); Dashboard.displayName = 'Dashboard'; const StatCard = memo(({ title, value, delay, highlight }) => (

{title}

{value}

)); StatCard.displayName = 'StatCard'; const NicheGroup = memo(({ niche, businesses, isExpanded, onToggle, index }) => { return (
{niche.charAt(0).toUpperCase()}

{niche}

{businesses.length} leads potenciais
{isExpanded ? : }
{isExpanded && (
{businesses.map((biz) => ( ))}
)}
); }); NicheGroup.displayName = 'NicheGroup'; const BusinessCard = memo(({ business }) => (

{business.title}

{business.phone && (
{business.phone}
)}
{business.street || business.address || 'Endereço não disponível'}
{/* Debugging/Info: Show that it has no website explicitly if needed, but the list is filtered */}
Sem Website
)); BusinessCard.displayName = 'BusinessCard'; export default Dashboard;