import { useEffect, useState } from "react"; import { getVersion } from "@tauri-apps/api/app"; import { Loader2, RefreshCw, Monitor } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; import { useT } from "@/i18n"; import { autoUpdateEnabled, installNow, lookForUpdate, setAutoUpdate, useSelfUpdate } from "@/lib/selfUpdate"; export function AboutCard({ onHistory }: { onHistory?: () => void }) { const t = useT(); const s = useSelfUpdate(); const [version, setVersion] = useState(""); const [auto, setAuto] = useState(autoUpdateEnabled()); const [asked, setAsked] = useState(false); useEffect(() => { void getVersion().then(setVersion).catch(() => {}); }, []); const busy = s.phase === "checking" || s.phase === "downloading" || s.phase === "installing"; return (

{t("history.manager")}

{t("settings.version", { v: version || "…" })}

{t("about.autoHint")}

{s.version && s.phase !== "current" && ( )} {s.percent !== null && s.phase === "downloading" && ( {s.percent}% )}
{onHistory ? : s.version && s.notes && s.phase !== "current" &&

{s.notes}

} {s.phase === "ready" &&

{t("selfupd.onClose")}

} {asked && s.phase === "current" &&

{t("about.upToDate")}

} {s.phase === "error" && (

{t("about.checkFailed")}

{s.error &&

{s.error}

}
)}
); }