AI media harness for planning, generating, and editing locally
TypeScript
Show the version and Alpha channel in the library title bar and on the Updates page
Bittic20dcaab645c
diff --git a/src/App.test.tsx b/src/App.test.tsxindex c62eb49..1530644 100644--- a/src/App.test.tsx+++ b/src/App.test.tsx@@ -116,9 +116,9 @@ describe("project library controls", () => {it("puts the brand in the title bar, focuses search with Ctrl+F and switches between grid and list", async () => {const { container } = render(<App />);await screen.findByText("Northern Light — Brand Film");- // 16px icon, "Slopus" and "Preview" as the window caption; no web header.+ // 16px icon, "Slopus" and the version and channel as the window caption; no web header.expect(container.querySelector(".titlebar__title")?.textContent).toBe("Slopus");- expect(container.querySelector(".titlebar__secondary")?.textContent).toBe("Preview");+ expect(container.querySelector(".titlebar__secondary")?.textContent).toBe(`v${__APP_VERSION__} - Alpha`);expect(container.querySelector(".titlebar__icon img")?.getAttribute("src")).toContain("marketing/icon.png");expect(screen.getByRole("heading", { level: 1, name: "Projects" })).toBeInTheDocument();expect(container.querySelector("kbd")).toBeNull();diff --git a/src/App.tsx b/src/App.tsxindex 1923b1e..fb7392f 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -16,6 +16,7 @@ import { UpdateInfoBar, UpdatePanel, updateNeedsAttention } from "./components/Uimport { CommandBar, CommandBarButton, EmptyState, InfoBadge, InfoBar, TextField } from "./components/ui";import { AppUpdater } from "./lib/updater";import { useShortcut } from "./lib/commands";+import { APP_CHANNEL, APP_VERSION } from "./lib/version";import { useRunningExportName } from "./lib/exportJob";import { reportGenerationJobs, revealInExplorer, type GuardJob } from "./lib/nativeShell";import { describeDiagnosticError, errorContext, writeDiagnostic } from "./lib/diagnostics";@@ -388,7 +389,7 @@ function App() {return (<div className="app-shell"><div className="app-screen" hidden={settingsOpen}>- <TitleBar title="Slopus" secondary="Preview" actions={shellActions}>+ <TitleBar title="Slopus" secondary={`v${APP_VERSION} - ${APP_CHANNEL}`} actions={shellActions}>{/* Search sits in the middle of the title bar, as in Windows Settings. */}<TextFieldclassName="titlebar-search"diff --git a/src/components/UpdatePanel.tsx b/src/components/UpdatePanel.tsxindex b80d63d..4491ce7 100644--- a/src/components/UpdatePanel.tsx+++ b/src/components/UpdatePanel.tsx@@ -1,6 +1,7 @@import { Download32, Refresh32, Reset32, Success32 } from "./ui/icons";import { useSyncExternalStore, type ReactNode } from "react";import type { AppUpdater } from "../lib/updater";+import { APP_CHANNEL, APP_VERSION } from "../lib/version";import { Expander, InfoBar, ProgressBar, ProgressRing } from "./ui";type UpdaterState = ReturnType<AppUpdater["getSnapshot"]>;@@ -72,6 +73,7 @@ export function UpdatePanel({ updater, blockReason }: { updater: AppUpdater; blo<span className="update-card__glyph">{glyph}</span><div className="update-card__text" aria-live="polite"><h2 className="update-card__title">{statusTitle(state)}</h2>+ <span className="update-card__caption">Current version {APP_VERSION} ({APP_CHANNEL})</span><span className="update-card__caption">{state.stage === "disabled"? "Installed release builds update themselves. To update a portable copy, download the new version."diff --git a/src/lib/version.ts b/src/lib/version.tsnew file mode 100644index 0000000..5d95ed5--- /dev/null+++ b/src/lib/version.ts@@ -0,0 +1,4 @@+/* The running build's version and release channel, shown in the library's+ title bar and on the Updates page. */+export const APP_VERSION: string = __APP_VERSION__;+export const APP_CHANNEL = "Alpha";diff --git a/src/vite-env.d.ts b/src/vite-env.d.tsindex ed77210..8305e94 100644--- a/src/vite-env.d.ts+++ b/src/vite-env.d.ts@@ -1,2 +1,5 @@/// <reference types="vite/client" />+/** package.json's version, e.g. "0.1.1"; set by vite.config.ts. */+declare const __APP_VERSION__: string;+diff --git a/tsconfig.node.json b/tsconfig.node.jsonindex 24b3d43..0150624 100644--- a/tsconfig.node.json+++ b/tsconfig.node.json@@ -4,6 +4,7 @@"skipLibCheck": true,"module": "ESNext","moduleResolution": "Bundler",+ "resolveJsonModule": true,"allowImportingTsExtensions": true,"noEmit": true},diff --git a/vite.config.ts b/vite.config.tsindex 5dda505..aa84bc7 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -1,8 +1,11 @@import { defineConfig } from "vitest/config";import react from "@vitejs/plugin-react";+/* The one version number: package.json (kept equal to tauri.conf.json). */+import { version } from "./package.json";export default defineConfig({plugins: [react()],+ define: { __APP_VERSION__: JSON.stringify(version) },clearScreen: false,server: {port: 1420,