diff --git a/desktop-ui/src/components/app-layout.tsx b/desktop-ui/src/components/app-layout.tsx
index 114f9568..27544fab 100644
--- a/desktop-ui/src/components/app-layout.tsx
+++ b/desktop-ui/src/components/app-layout.tsx
@@ -9,6 +9,7 @@ import { HttpsTrustNotice } from "./app/https-trust-notice";
import { useProjectCreateHotkey } from "./app/projects/use-project-create-hotkey";
import { useProjectSearchHotkey } from "./app/projects/use-project-search-hotkey";
import { TerminalPanel } from "./app/terminal/terminal-panel";
+import { UpdateNotice } from "./app/update-notice";
import { DesktopAnalytics } from "./shared/desktop-analytics";
import { PageTransition } from "./shared/page-transition";
import { SharedNavigation } from "./shared/shared-navigation";
@@ -43,6 +44,7 @@ function AppLayoutContent() {
{label}
+
- {description}
+
+ {summary?.title ?? "Reading the update status…"} +
+ {summary?.detail ? ( ++ {summary.detail}
-{errorMessage}
- ) : null} - + {summary?.canRestart ? ( + restart + ) : ( + + )} +{error}
: null} + ); }; diff --git a/desktop-ui/src/components/app/settings/settings-update-preview.tsx b/desktop-ui/src/components/app/settings/settings-update-preview.tsx index 92e8202b..a4ab352b 100644 --- a/desktop-ui/src/components/app/settings/settings-update-preview.tsx +++ b/desktop-ui/src/components/app/settings/settings-update-preview.tsx @@ -2,76 +2,64 @@ import { useState } from "react"; +import type { UpdateStatusDto } from "@/types/localify"; + import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; -import type { AppUpdateStatus } from "@/providers/app-update-provider"; -import type { AppUpdateInfoDto } from "@/types/localify"; import { SettingsUpdateCard } from "./settings-update-card"; -type UpdatePreviewState = { - status: AppUpdateStatus; - label: string; - update: AppUpdateInfoDto | null; - errorMessage: string | null; -}; +const NOW = 1_780_000_000; -const previewUpdate = { - version: "1.4.0", - notes: "Mock release notes for the update card preview.", - pubDate: "2026-04-27T10:00:00Z", -} satisfies AppUpdateInfoDto; +const base: UpdateStatusDto = { + installed: "1.6.0", + available: null, + state: "upToDate", + reason: null, + automatic: true, + lastCheckAt: NOW - 3 * 3600, + canInstall: true, +}; -const previewStates = [ - { - status: "idle", - label: "Idle", - update: null, - errorMessage: null, - }, - { - status: "checking", - label: "Checking", - update: null, - errorMessage: null, - }, - { - status: "available", - label: "Available", - update: previewUpdate, - errorMessage: null, - }, - { - status: "installing", - label: "Installing", - update: previewUpdate, - errorMessage: null, - }, +const previewStates: { label: string; status: UpdateStatusDto }[] = [ + { label: "Never checked", status: { ...base, state: "unknown", lastCheckAt: null } }, + { label: "Up to date", status: base }, + { label: "Checking", status: { ...base, state: "checking" } }, + { label: "Available", status: { ...base, state: "available", available: "1.7.0" } }, { - status: "upToDate", - label: "Up to date", - update: null, - errorMessage: null, + label: "Automatic off", + status: { + ...base, + state: "available", + available: "1.7.0", + automatic: false, + reason: + "Automatic updates are off. Install it with: localify update install, or turn them on with: localify update --auto on", + }, }, { - status: "unconfigured", - label: "Unconfigured", - update: null, - errorMessage: null, + label: "Can't install", + status: { + ...base, + state: "available", + available: "1.7.0", + canInstall: false, + reason: + "/Applications/Localify.app belongs to another account: only its owner can update it.", + }, }, + { label: "Installing", status: { ...base, state: "installing", available: "1.7.0" } }, { - status: "error", - label: "Error", - update: previewUpdate, - errorMessage: "Localify could not download the latest desktop update.", + label: "Failed", + status: { ...base, state: "failed", reason: "The update feed could not be reached." }, }, -] satisfies UpdatePreviewState[]; +]; +/** Mock states for designing the update card without a daemon. */ export const SettingsUpdatePreview = () => { - const [selectedStatus, setSelectedStatus] = useState+ {appName} {version} is ready to install. +
+