feat(settings): improve typing
This commit is contained in:
@@ -1,20 +1,18 @@
|
|||||||
type Menu = "options" | "clock" | "user" | "touchScreen";
|
|
||||||
|
|
||||||
export const useSettingsStore = defineStore("settings", {
|
export const useSettingsStore = defineStore("settings", {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
currentMenu: null as Menu | null,
|
currentMenu: null as SettingsMenu | null,
|
||||||
currentSubMenu: null as string | null,
|
currentSubMenu: null as SettingsSubMenu | null,
|
||||||
menuExpanded: false,
|
menuExpanded: false,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
openMenu(menu: Menu, expanded: boolean = false) {
|
openMenu(menu: SettingsMenu, expanded: boolean = false) {
|
||||||
this.currentMenu = menu;
|
this.currentMenu = menu;
|
||||||
this.menuExpanded = expanded;
|
this.menuExpanded = expanded;
|
||||||
this.currentSubMenu = null;
|
this.currentSubMenu = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
openSubMenu(submenu: string) {
|
openSubMenu(submenu: SettingsSubMenu) {
|
||||||
this.currentSubMenu = submenu;
|
this.currentSubMenu = submenu;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
17
app/utils/settings.ts
Normal file
17
app/utils/settings.ts
Normal file
@@ -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];
|
||||||
Reference in New Issue
Block a user