import React, { useState, useEffect } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/index'; import { Button } from '@/components/ui/index'; import { RefreshCw, Check, AlertCircle, Loader } from 'lucide-react'; import { checkAppUpdatesCmd, installAppUpdatesCmd, getUpdateChannelCmd, setUpdateChannelCmd, } from '@/lib/tauriCommands'; export function Updater() { const [channel, setChannel] = useState('stable'); const [checking, setChecking] = useState(false); const [updateAvailable, setUpdateAvailable] = useState(false); const [error, setError] = useState(null); const loadChannel = async () => { try { const ch = await getUpdateChannelCmd(); setChannel(ch); } catch { console.error('Failed to load channel'); } }; const checkForUpdates = async () => { setChecking(true); setError(null); try { const available = await checkAppUpdatesCmd(); setUpdateAvailable(available); } catch { setError('Failed to check for updates'); } finally { setChecking(false); } }; const handleInstallUpdate = async () => { try { await installAppUpdatesCmd(); setUpdateAvailable(false); } catch { setError('Failed to install update'); } }; const handleChannelChange = async (newChannel: string) => { setChannel(newChannel); try { await setUpdateChannelCmd(newChannel); } catch { setError('Failed to update channel'); } }; useEffect(() => { void loadChannel(); void checkForUpdates(); }, []); return (

Updater

Configure application auto-updates

Update Channel
Check for Updates {error && (
{error}
)} {updateAvailable ? (
Update Available
A new version is ready to install
) : (
Up to Date
You are running the latest version
)}
); }