'use client'; import { ExternalLink } from 'lucide-react'; import * as Tooltip from '@radix-ui/react-tooltip'; import type { Citation as CitationType } from '@/lib/types'; interface CitationProps { citation: CitationType; compact?: boolean; } export function Citation({ citation, compact }: CitationProps) { if (compact) { return ( {citation.index} ); } return ( {citation.index} {citation.favicon && ( { (e.target as HTMLImageElement).style.display = 'none'; }} /> )} {citation.domain}

{citation.title}

{citation.snippet && (

{citation.snippet}

)}
{citation.favicon && ( { (e.target as HTMLImageElement).style.display = 'none'; }} /> )} {citation.domain}
); } interface CitationListProps { citations: CitationType[]; maxVisible?: number; } export function CitationList({ citations, maxVisible = 6 }: CitationListProps) { if (!citations || citations.length === 0) return null; const visible = citations.slice(0, maxVisible); const remaining = citations.length - maxVisible; return (
{visible.map((citation) => ( ))} {remaining > 0 && (
{citations.slice(maxVisible).map((citation) => ( {citation.index} {citation.title} ))}
)}
); }