diff options
| author | 2026-01-14 12:12:04 +0800 | |
|---|---|---|
| committer | 2026-01-14 12:12:04 +0800 | |
| commit | d11e3d6f4f05a150fa285d974d9836b972fd0ed5 (patch) | |
| tree | 220f1968d22c4116bb86849168e242eb18234921 /ui/src/stores/ui.svelte.ts | |
| parent | f1babdf9a625ddbb661f4e0678e6258511347656 (diff) | |
| parent | b8cfb443b23e644ac0a7f469b500b2beaf001e9a (diff) | |
| download | DropOut-d11e3d6f4f05a150fa285d974d9836b972fd0ed5.tar.gz DropOut-d11e3d6f4f05a150fa285d974d9836b972fd0ed5.zip | |
Merge pull request #12 from HsiangNianian/dev
Diffstat (limited to 'ui/src/stores/ui.svelte.ts')
| -rw-r--r-- | ui/src/stores/ui.svelte.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ui/src/stores/ui.svelte.ts b/ui/src/stores/ui.svelte.ts new file mode 100644 index 0000000..9c29c25 --- /dev/null +++ b/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(); |