import { Wrench, Download, Upload, RotateCcw, Database, FileText, HardDrive } from 'lucide-react'; import { toast } from 'sonner'; interface ToolsPageProps { config: any; setConfig: (config: any) => void; } export default function ToolsPage({ config }: ToolsPageProps) { const handleBackup = () => { const dataStr = JSON.stringify(config, null, 2); const dataUri = 'data:application/json;charset=utf-8,' + encodeURIComponent(dataStr); const exportFileDefaultName = `meatloaf-config-${new Date().toISOString().split('T')[0]}.json`; const linkElement = document.createElement('a'); linkElement.setAttribute('href', dataUri); linkElement.setAttribute('download', exportFileDefaultName); linkElement.click(); toast.success('Configuration backed up'); }; const handleRestore = () => { const input = document.createElement('input'); input.type = 'file'; input.accept = '.json'; input.onchange = (e: any) => { const file = e.target.files[0]; const reader = new FileReader(); reader.onload = (event: any) => { try { const config = JSON.parse(event.target.result); toast.success('Configuration restored'); console.log('Restored config:', config); } catch (error) { toast.error('Invalid configuration file'); } }; reader.readAsText(file); }; input.click(); }; const handleFactoryReset = () => { if (confirm('Are you sure you want to reset to factory defaults? This cannot be undone.')) { toast.success('Configuration reset to factory defaults'); } }; const handleFormatSD = () => { if (confirm('Are you sure you want to format the SD card? All data will be lost.')) { toast.success('SD card formatting started'); } }; const handleSystemUpdate = () => { toast.loading('Checking for updates...'); setTimeout(() => { toast.dismiss(); toast.success('System is up to date'); }, 2000); }; const handleExportLogs = () => { toast.success('System logs exported'); }; return (