From 7ac929cf0dc583d8f985648649bdd98c0963f9d5 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Tue, 30 Dec 2025 00:45:13 +0100 Subject: [PATCH] feat(settings): improve typing --- app/stores/settings.ts | 10 ++++------ app/utils/settings.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 app/utils/settings.ts diff --git a/app/stores/settings.ts b/app/stores/settings.ts index 1d97460..018afe3 100644 --- a/app/stores/settings.ts +++ b/app/stores/settings.ts @@ -1,20 +1,18 @@ -type Menu = "options" | "clock" | "user" | "touchScreen"; - export const useSettingsStore = defineStore("settings", { state: () => ({ - currentMenu: null as Menu | null, - currentSubMenu: null as string | null, + currentMenu: null as SettingsMenu | null, + currentSubMenu: null as SettingsSubMenu | null, menuExpanded: false, }), actions: { - openMenu(menu: Menu, expanded: boolean = false) { + openMenu(menu: SettingsMenu, expanded: boolean = false) { this.currentMenu = menu; this.menuExpanded = expanded; this.currentSubMenu = null; }, - openSubMenu(submenu: string) { + openSubMenu(submenu: SettingsSubMenu) { this.currentSubMenu = submenu; }, diff --git a/app/utils/settings.ts b/app/utils/settings.ts new file mode 100644 index 0000000..65196a3 --- /dev/null +++ b/app/utils/settings.ts @@ -0,0 +1,17 @@ +export const SETTINGS_MENUS = ["options", "clock", "user", "touchScreen"] as const; + +export const SETTINGS_SUB_MENUS = [ + "optionsLanguage", + "optionsGbaMode", + "optionsStartUp", + "clockAlarm", + "clockTime", + "clockDate", + "userBirthday", + "userName", + "userMessage", + "userColor", +] as const; + +export type SettingsMenu = (typeof SETTINGS_MENUS)[number]; +export type SettingsSubMenu = (typeof SETTINGS_SUB_MENUS)[number];