import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Info, RefreshCw, Download, CheckCircle, AlertCircle, RotateCcw, Loader2, ShieldCheck, BookOpen, ChevronRight, } from "lucide-react"; import { getVersion } from "@tauri-apps/api/app"; import { useUpdater } from "../hooks/useUpdater"; import { Link } from "react-router-dom"; import { APP_NAME } from "../shared/constants"; import { PageHelp } from "../components/shared/PageHelp"; import DataManagementCard from "../components/settings/DataManagementCard"; export default function SettingsPage() { const { t } = useTranslation(); const { state, checkForUpdate, downloadAndInstall, installAndRestart } = useUpdater(); const [version, setVersion] = useState(""); useEffect(() => { getVersion().then(setVersion); }, []); const progressPercent = state.contentLength && state.contentLength > 0 ? Math.round((state.progress / state.contentLength) * 100) : null; return (

{t("settings.title")}

{/* About card */}
S

{APP_NAME}

{t("settings.version", { version })}

{/* User guide card */}

{t("settings.userGuide.title")}

{t("settings.userGuide.description")}

{/* Update card */}

{t("settings.updates.title")}

{/* idle */} {state.status === "idle" && ( )} {/* checking */} {state.status === "checking" && (
{t("settings.updates.checking")}
)} {/* up to date */} {state.status === "upToDate" && (
{t("settings.updates.upToDate")}
)} {/* available */} {state.status === "available" && (

{t("settings.updates.available", { version: state.version })}

)} {/* downloading */} {state.status === "downloading" && (
{t("settings.updates.downloading")} {progressPercent !== null && {progressPercent}%}
)} {/* ready to install */} {state.status === "readyToInstall" && (

{t("settings.updates.readyToInstall")}

)} {/* installing */} {state.status === "installing" && (
{t("settings.updates.installing")}
)} {/* error */} {state.status === "error" && (
{t("settings.updates.error")}

{state.error}

)}
{/* Data management */} {/* Data safety notice */}

{t("settings.dataSafeNotice")}

); }