diff --git a/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx b/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx index 33a78a00e9..f96b11ccb5 100644 --- a/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx +++ b/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx @@ -7,16 +7,27 @@ vi.mock("../../../hooks/useLocale", () => ({ // Mock Tauri invoke for get_available_languages vi.mock("@tauri-apps/api/core", () => ({ - invoke: vi.fn().mockResolvedValue([ - { value: "english", display: "English" }, - { value: "chinese", display: "中文" }, - { value: "chinesetraditional", display: "繁體中文" }, - { value: "japanese", display: "日本語" }, - { value: "korean", display: "한국어" }, - { value: "spanish", display: "Español" }, - { value: "russian", display: "Русский" }, - { value: "turkish", display: "Türkçe" }, - ]), + invoke: vi.fn(async (command: string) => { + if (command === "get_app_info") { + return { + name: "CodexBar", + version: "0.60.3", + buildNumber: "42", + updateChannel: "stable", + tagline: "usage", + }; + } + return [ + { value: "english", display: "English" }, + { value: "chinese", display: "中文" }, + { value: "chinesetraditional", display: "繁體中文" }, + { value: "japanese", display: "日本語" }, + { value: "korean", display: "한국어" }, + { value: "spanish", display: "Español" }, + { value: "russian", display: "Русский" }, + { value: "turkish", display: "Türkçe" }, + ]; + }), })); vi.mock("@tauri-apps/plugin-dialog", () => ({ @@ -96,6 +107,14 @@ const settings: SettingsSnapshot = { showResetWhenExhausted: false, }; +describe("GeneralTab running version", () => { + it("shows the running app version on the general tab", async () => { + render(); + + expect(await screen.findByText("0.60.3 (42)")).toBeInTheDocument(); + }); +}); + describe("GeneralTab language picker", () => { it("renders all supported language options", () => { render(); diff --git a/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx b/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx index f2e700a5e3..2d6e9a722e 100644 --- a/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx +++ b/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx @@ -2,7 +2,8 @@ import { useCallback, useEffect, useState } from "react"; import { useLocale } from "../../../hooks/useLocale"; import { invoke } from "@tauri-apps/api/core"; import { open } from "@tauri-apps/plugin-dialog"; -import { playNotificationSound, quitApp } from "../../../lib/tauri"; +import { getAppInfo, playNotificationSound, quitApp } from "../../../lib/tauri"; +import type { AppInfoBridge } from "../../../types/bridge"; import { Field, NumberInput, Select, Toggle } from "../../../components/FormControls"; import type { Language, @@ -199,6 +200,14 @@ export default function GeneralTab({ .catch(() => {}); // graceful fallback to static default }, []); + const [appVersion, setAppVersion] = useState(null); + + useEffect(() => { + getAppInfo() + .then(setAppVersion) + .catch(() => {}); // version row degrades to absent, never blocks the tab + }, []); + const handleTestSound = useCallback((event: NotificationSoundEvent) => { setSoundError(null); setPlayingSound(event); @@ -576,6 +585,21 @@ export default function GeneralTab({ } + + {/* ── Running version (upstream 0.64.0 #3806) ─────────────── */} + {mode === "general" && appVersion && ( +
+

{t("Version")}

+
+ + + {appVersion.version} + {appVersion.buildNumber !== "dev" && ` (${appVersion.buildNumber})`} + + +
+
+ )} ); }