// Ported from legacy henza_pwa/src/store/navStore.ts (a hand-rolled reactive // class) to a real Pinia store, preserving the exact same state shape and // setter behavior — including the pre-existing path/route-name mismatch on // the "home" entry (path: '/' vs. the app's actual /home route), which is // unused dead data since navigation uses `name`, not `path`. Ported as-is. import { defineStore } from 'pinia' interface NavItem { name: string path: string icon: string index: number } interface NavState { navBarRoutes: NavItem[] activeLink: number showNav: boolean // legacy passes `undefined` to clear the transition (router/index.ts:270) pageTransition: string | undefined } export const useNavStore = defineStore('nav', { state: (): NavState => ({ navBarRoutes: [ { name: 'userPage::hasSubRoute', path: '/user', icon: 'vuesax-linear:user', index: 1 }, { name: 'cart', path: '/cart', icon: 'vuesax-linear:bag-happy', index: 2 }, { name: 'search', path: '/search', icon: 'vuesax-linear:search-normal-1', index: 3 }, { name: 'home', path: '/', icon: 'vuesax-linear:home-2', index: 4 }, ], activeLink: 4, showNav: true, pageTransition: 'right', }), actions: { setNavVisibility(data: boolean) { this.showNav = data }, setActiveLink(activeLink: number) { this.activeLink = activeLink }, setPgaTransition(transition: string | undefined) { this.pageTransition = transition }, }, })