import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { X, Download, Trash2 } from "lucide-react"; import { type Citation } from "@shared/schema"; interface CitationPanelProps { citations: Citation[]; isVisible: boolean; onClose: () => void; onRemoveCitation: (citationId: number) => void; } export default function CitationPanel({ citations, isVisible, onClose, onRemoveCitation }: CitationPanelProps) { if (!isVisible) return null; const handleExportCitations = () => { const citationText = citations .map((citation, index) => { return `[${index + 1}] ${citation.citationText}${citation.section ? ` (${citation.section})` : ''}${citation.pageNumber ? ` - Page ${citation.pageNumber}` : ''}`; }) .join('\n\n'); const blob = new Blob([citationText], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'citations.txt'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; return (
{/* Header */}

Active Citations

{citations.length}
{/* Citations List */}
{citations.length === 0 ? (

No citations added yet

Click "Add Citation" on search results to build your reference list

) : (
{citations.map((citation, index) => (
{index + 1}

{citation.citationText}

{(citation.section || citation.pageNumber) && (
{citation.section && ( {citation.section} )} {citation.pageNumber && ( Page {citation.pageNumber} )}
)}
))}
)}
{/* Footer */} {citations.length > 0 && (
)}
); }