diff options
| author | 2026-01-14 03:52:30 +0000 | |
|---|---|---|
| committer | 2026-01-14 03:52:30 +0000 | |
| commit | 66f401fd1248ce8d1624ec82342af5e07c51554e (patch) | |
| tree | e36bf6235274bd9a34d4d74f6b58f2371e4f93c8 /ui | |
| parent | 956b15693ebe52a75d6b27c59bd14b47764d0110 (diff) | |
| download | DropOut-66f401fd1248ce8d1624ec82342af5e07c51554e.tar.gz DropOut-66f401fd1248ce8d1624ec82342af5e07c51554e.zip | |
refactor: enhance UIState class by adding type for currentView and updating setView method
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/src/stores/ui.svelte.ts | 26 | ||||
| -rw-r--r-- | ui/src/types/index.ts | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/ui/src/stores/ui.svelte.ts b/ui/src/stores/ui.svelte.ts index 8fc339b..b010390 100644 --- a/ui/src/stores/ui.svelte.ts +++ b/ui/src/stores/ui.svelte.ts @@ -1,32 +1,30 @@ +import { type ViewType } from "../types"; + export class UIState { - currentView = $state("home"); + currentView: ViewType = $state("home"); status = $state("Ready"); showConsole = $state(false); appVersion = $state("..."); private statusTimeout: any; - constructor() { - // Watch for status changes to auto-dismiss - $effect(() => { - if (this.status !== "Ready") { - if (this.statusTimeout) clearTimeout(this.statusTimeout); - this.statusTimeout = setTimeout(() => { - this.status = "Ready"; - }, 5000); - } - }); - } - 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: string) { + setView(view: ViewType) { this.currentView = view; } } diff --git a/ui/src/types/index.ts b/ui/src/types/index.ts index dc0915b..b7ff0a0 100644 --- a/ui/src/types/index.ts +++ b/ui/src/types/index.ts @@ -1,3 +1,5 @@ +export type ViewType = "home" | "versions" | "settings"; + export interface Version { id: string; type: string; |