From da0d79f0db873c08fab3bc85023167e174d18b0e Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Mon, 19 Jan 2026 14:17:32 +0800 Subject: chore(ui): refactor workspace to monorepo --- packages/ui/src/stores/ui.svelte.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 packages/ui/src/stores/ui.svelte.ts (limited to 'packages/ui/src/stores/ui.svelte.ts') diff --git a/packages/ui/src/stores/ui.svelte.ts b/packages/ui/src/stores/ui.svelte.ts new file mode 100644 index 0000000..e88f6b4 --- /dev/null +++ b/packages/ui/src/stores/ui.svelte.ts @@ -0,0 +1,32 @@ +import { type ViewType } from "../types"; + +export class UIState { + currentView: ViewType = $state("home"); + status = $state("Ready"); + showConsole = $state(false); + appVersion = $state("..."); + + private statusTimeout: ReturnType | null = null; + + setStatus(msg: string) { + if (this.statusTimeout) clearTimeout(this.statusTimeout); + + this.status = msg; + + if (msg !== "Ready") { + this.statusTimeout = setTimeout(() => { + this.status = "Ready"; + }, 5000); + } + } + + toggleConsole() { + this.showConsole = !this.showConsole; + } + + setView(view: ViewType) { + this.currentView = view; + } +} + +export const uiState = new UIState(); -- cgit v1.2.3-70-g09d2