M0.4: frontend with Vue 3, Pinia, ESLint, vue-tsc and Vitest
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>
This commit is contained in:
parent
acc055c063
commit
50bcc95006
15 changed files with 456 additions and 2 deletions
38
ui/src/stores/app.ts
Normal file
38
ui/src/stores/app.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* 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 };
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue