diff --git a/app/composables/useCatalogSearch.ts b/app/composables/useCatalogSearch.ts index 28bf681..60012a2 100644 --- a/app/composables/useCatalogSearch.ts +++ b/app/composables/useCatalogSearch.ts @@ -250,17 +250,16 @@ export function useCatalogSearch() { // Text search (for filtering within current grid) - shared via useState const searchQuery = useState('catalog-search-query', () => '') - // Map view mode preference (stored in cookie) - const mapViewCookie = useCookie('catalog-map-view', { - default: () => 'offers', - maxAge: 60 * 60 * 24 * 365 // 1 year - }) - const mapViewMode = computed({ - get: () => mapViewCookie.value, - set: (val: MapViewMode) => { mapViewCookie.value = val } + // Map view mode (stored in URL query param 'view') + const mapViewMode = computed(() => { + const view = route.query.view as string | undefined + if (view === 'hubs' || view === 'suppliers' || view === 'offers') { + return view + } + return 'offers' // default }) const setMapViewMode = (mode: MapViewMode) => { - mapViewCookie.value = mode + updateQuery({ view: mode === 'offers' ? null : mode }) } // Drawer state for list view diff --git a/app/layouts/topnav.vue b/app/layouts/topnav.vue index 8df9639..a0d8ea7 100644 --- a/app/layouts/topnav.vue +++ b/app/layouts/topnav.vue @@ -21,7 +21,7 @@ :hub-label="hubLabel ?? undefined" :quantity="quantity" :can-search="canSearch" - :show-mode-toggle="true" + :show-mode-toggle="isCatalogSection" :glass-style="isCatalogSection" @toggle-theme="toggleTheme" @set-catalog-mode="setCatalogMode"