import { useState, type ComponentType } from 'react'; import { toast } from 'sonner'; import { Database, Download, FileSpreadsheet, FileJson, AlertTriangle, CheckCircle2, XCircle, Loader2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { cn, errMessage } from '@/lib/utils'; import { downloadFile } from '@/lib/download'; import { SectionCard, type SectionCardProps } from './dataShared'; function ExportCard({ icon: Icon, title, description, filename, endpoint }: { icon: ComponentType<{ className?: string }>; title: string; description: string; filename: string; endpoint: string; }) { const [loading, setLoading] = useState(false); const handleDownload = async () => { setLoading(true); try { await downloadFile(endpoint, filename); toast.success(`${title} downloaded.`); } catch (err) { toast.error(errMessage(err, 'Download failed.')); } finally { setLoading(false); } }; return (
{title}
{description}
Payments export
Just your payment records — filter by date and choose a format. Leave dates empty for the current year.
Exports may contain sensitive account metadata (website URLs, usernames, account info). Store exported files securely and avoid sharing them unencrypted.
What's included
What's not included