Empty workbench (main area and status bar) themed only through --lt-* tokens. ipc.ts wraps Tauri invoke so engine calls never reject; the app store loads app.about. Type-aware ESLint bans floating promises, any and inline comments. Requires Node 22.12+ for Vite 8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
/**
|
|
* Application-wide state: product information from `app.about` and the
|
|
* last error the shell reported.
|
|
*/
|
|
import { defineStore } from "pinia";
|
|
import { ref } from "vue";
|
|
import { run, type EngineError } from "../ipc";
|
|
|
|
/** Result of the `app.about` command. */
|
|
export interface AboutInfo {
|
|
/** Product name. */
|
|
name: string;
|
|
/** Version of the running build. */
|
|
version: string;
|
|
/** Slogan shown in the About window. */
|
|
slogan: string;
|
|
}
|
|
|
|
/** Store holding product information and the last engine error. */
|
|
export const useAppStore = defineStore("app", () => {
|
|
/** Product information, null until loaded. */
|
|
const about = ref<AboutInfo | null>(null);
|
|
/** Last error from the engine, null if none. */
|
|
const lastError = ref<EngineError | null>(null);
|
|
|
|
/** Loads product information from the engine; on failure records the error. */
|
|
async function loadAbout(): Promise<void> {
|
|
const result = await run<AboutInfo>("app.about");
|
|
if (result.ok) {
|
|
about.value = result.value;
|
|
lastError.value = null;
|
|
} else {
|
|
lastError.value = result.error;
|
|
}
|
|
}
|
|
|
|
return { about, lastError, loadAbout };
|
|
});
|