'use client'; import { Loader2, CheckCircle2, XCircle, ExternalLink, Globe } from 'lucide-react'; import { Badge } from '@/components/ui/badge'; import { cn } from '@/lib/utils'; import type { ActiveUrl } from '@/hooks/use-web-search-events'; interface ScrapingUrlsMonitorProps { urls: ActiveUrl[]; className?: string; } export function ScrapingUrlsMonitor({ urls, className }: ScrapingUrlsMonitorProps) { if (urls.length === 0) return null; const getFaviconUrl = (url: string): string => { try { const domain = new URL(url).hostname; return `https://www.google.com/s2/favicons?domain=${domain}&sz=16`; } catch { return ''; } }; const getStatusIcon = (status: ActiveUrl['status']) => { switch (status) { case 'started': return ; case 'completed': case 'cached': return ; case 'failed': return ; default: return ; } }; const getSourceBadge = (source?: string) => { if (!source) return null; const colors: Record = { static: 'bg-blue-500/10 text-blue-600 border-blue-500/20', nodriver: 'bg-purple-500/10 text-purple-600 border-purple-500/20', playwright: 'bg-orange-500/10 text-orange-600 border-orange-500/20', cached: 'bg-gray-500/10 text-gray-600 border-gray-500/20', }; return ( {source} ); }; return ( Sites Sendo Acessados ({urls.length}) {urls.map((url, idx) => ( {getStatusIcon(url.status)} { (e.target as HTMLImageElement).style.display = 'none'; }} /> {url.title || url.url} {getSourceBadge(url.source)} {url.duration && ( {url.duration}ms )} {url.url} ))} ); }
{url.url}