"use client"; import { Download, RefreshCw } from "@/ui/icon-registry"; import { Spinner } from "@/ui"; import { SettingsButton, SettingsGroup, SettingsRow, SettingsValue } from "./settings-ui"; import { useAppUpdate } from "@/features/shell/use-app-update"; export function AppVersionSection() { const update = useAppUpdate(); const devChannel = update.releaseChannel === "dev"; const progress = update.progress === null ? null : Math.round(update.progress); const onLatest = update.currentVersion && update.latestVersion && !update.updateAvailable; const description = devChannel ? "Dev builds update through the local installer." : update.updateAvailable ? update.phase === "ready" ? `v${update.latestVersion} is downloaded — restart to finish updating.` : update.status === "downloading" ? `Downloading v${update.latestVersion}${progress === null ? "." : ` — ${progress}%.`}` : `v${update.latestVersion} is available on GitHub.` : onLatest ? "You are on the latest version." : update.latestVersion ? `Latest release: v${update.latestVersion}.` : "Release check unavailable."; return ( {update.currentVersion ? `v${update.currentVersion}` : "Web UI"} } actions={ update.updateAvailable ? ( {update.status === "checking" ? ( ) : update.phase === "ready" ? ( ) : ( )} {update.status === "checking" ? "Checking…" : update.status === "downloading" ? progress === null ? "Downloading…" : `Downloading ${progress}%` : update.phase === "ready" ? "Restart to update" : "Update"} ) : undefined } /> ); }