"use client"; import type { TFunction } from "i18next"; import { useTranslation } from "react-i18next"; import { Button } from "@kandev/ui/button"; import { Spinner } from "@kandev/ui/spinner"; import { IconCheck, IconAlertTriangle } from "@tabler/icons-react"; import type { SelfUpdatePhase } from "@/hooks/domains/system/use-self-update"; type SelfUpdateProgressProps = { phase: SelfUpdatePhase; targetVersion: string | null; errorMessage: string | null; onDismiss: () => void; }; /** * The version string is a value; only the frame around it is copy. When the * target version is not known yet the whole sentence switches to a variant * that does not name one, rather than interpolating a translated noun phrase. */ function activeText(phase: SelfUpdatePhase, target: string | null, t: TFunction): string { switch (phase) { case "starting": return target ? t("system:selfUpdateStarting", { version: target }) : t("system:selfUpdateStartingUnknown"); case "installing": return target ? t("system:selfUpdateInstalling", { version: target }) : t("system:selfUpdateInstallingUnknown"); case "restarting": return t("system:selfUpdateRestarting"); default: return ""; } } function ActiveRow({ phase, targetVersion, }: { phase: SelfUpdatePhase; targetVersion: string | null; }) { const { t } = useTranslation(); return (
{t("system:selfUpdateKeepOpen")}