aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/ui/src/stores/ui.svelte.ts
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-01-20 13:44:21 +0800
committerGitHub <noreply@github.com>2026-01-20 13:44:21 +0800
commit7338b8627833018a0e3c05c3c4f3cc7fc182e8d2 (patch)
tree23e39e5603aadc10d6b2d7efad063c68f357a860 /packages/ui/src/stores/ui.svelte.ts
parentdbf781a35b96252e0199fec4337515651e49a8f6 (diff)
parentcf6cd6ba667b35e352b705946420cf4acab2b004 (diff)
downloadDropOut-7338b8627833018a0e3c05c3c4f3cc7fc182e8d2.tar.gz
DropOut-7338b8627833018a0e3c05c3c4f3cc7fc182e8d2.zip
[Chore] branch: Sync with main (#75)
Diffstat (limited to 'packages/ui/src/stores/ui.svelte.ts')
-rw-r--r--packages/ui/src/stores/ui.svelte.ts32
1 files changed, 32 insertions, 0 deletions
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<typeof setTimeout> | 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();