| // src/components/grant/ExportPanel.tsx | |
| import { useState } from "react"; | |
| import { Download, FileText, FileJson, FileSpreadsheet } from "lucide-react"; | |
| import { toast } from "react-toastify"; | |
| interface ExportPanelProps { | |
| proposalId?: string; | |
| onExport?: (format: string) => void; | |
| } | |
| export function ExportPanel({ proposalId, onExport }: ExportPanelProps) { | |
| const [exporting, setExporting] = useState(false); | |
| const formats = [ | |
| { id: "pdf", label: "PDF", icon: FileText }, | |
| { id: "docx", label: "Word", icon: FileText }, | |
| { id: "json", label: "JSON (metadata)", icon: FileJson }, | |
| { id: "csv", label: "CSV (budget)", icon: FileSpreadsheet }, | |
| ]; | |
| const handleExport = async (format: string) => { | |
| setExporting(true); | |
| try { | |
| // Simulate export | |
| await new Promise(r => setTimeout(r, 1000)); | |
| toast.success(`Exported as ${format.toUpperCase()}`); | |
| onExport?.(format); | |
| } catch { | |
| toast.error("Export failed"); | |
| } finally { | |
| setExporting(false); | |
| } | |
| }; | |
| return ( | |
| <div className="space-y-4"> | |
| <h3 className="font-semibold">Export Proposal</h3> | |
| <div className="grid grid-cols-2 gap-2"> | |
| {formats.map(f => ( | |
| <button | |
| key={f.id} | |
| onClick={() => handleExport(f.id)} | |
| disabled={exporting} | |
| className="flex items-center gap-2 p-2 border rounded-lg hover:bg-gray-50 disabled:opacity-50" | |
| > | |
| <f.icon className="w-4 h-4" /> | |
| <span className="text-sm">{f.label}</span> | |
| <Download className="w-3 h-3 ml-auto" /> | |
| </button> | |
| ))} | |
| </div> | |
| </div> | |
| ); | |
| } |
Xet Storage Details
- Size:
- 1.65 kB
- Xet hash:
- eb5cf91814ef1c475f8f1df32e2e744a6ae8ff65dba0a2eb0ce135c4495e153c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.