feat: remove query based routing

This commit is contained in:
2025-12-29 19:47:01 +01:00
parent e912270d1e
commit 96f8d5093b
14 changed files with 207 additions and 140 deletions

View File

@@ -1,28 +1,25 @@
type Menu = "options" | "clock" | "user" | "touchScreen";
export const useSettingsStore = defineStore("settings", {
state: () => ({
currentMenu: null as string | null,
currentMenu: null as Menu | null,
currentSubMenu: null as string | null,
menuExpanded: false,
}),
getters: {
isMenuOpen: (state) => (menu: string) => {
if (!state.currentMenu) return false;
return new RegExp(`^${menu}[A-Z]`).test(state.currentMenu);
},
isAnyOtherMenuOpen: (state) => (excludeMenu: string) => {
if (!state.currentMenu) return false;
return ["options", "clock", "user", "touchScreen"]
.filter((m) => m !== excludeMenu)
.some((m) => new RegExp(`^${m}[A-Z]`).test(state.currentMenu!));
},
},
actions: {
setActiveMenu(menu: string | null) {
openMenu(menu: Menu, expanded: boolean = false) {
this.currentMenu = menu;
this.menuExpanded = expanded;
this.currentSubMenu = null;
},
setCurrentSubMenu(submenu: string | null) {
openSubMenu(submenu: string) {
this.currentSubMenu = submenu;
},
closeSubMenu() {
this.currentSubMenu = null;
},
},
});