import { openUrl } from "@tauri-apps/plugin-opener"; import type { UpdateInfo } from "../../lib/types"; import Modal from "../ui/Modal"; import Button from "../ui/Button"; interface Props { updateInfo: UpdateInfo; currentVersion: string; onDismiss: () => void; onClose: () => void; } export default function UpdateDialog({ updateInfo, currentVersion, onDismiss, onClose, }: Props) { const handleDownload = async (url: string) => { try { await openUrl(url); } catch (e) { console.error("Failed to open URL:", e); } }; const formatSize = (bytes: number) => { if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`; return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; }; return ( } >
{currentVersion} {updateInfo.version}
{updateInfo.body && (

Release notes

{updateInfo.body}
)} {updateInfo.assets.length > 0 && (

Downloads

{updateInfo.assets.map((asset) => ( ))}
)}
); }