Fix: hide mode toggle on home page, store mapViewMode in URL
All checks were successful
Build Docker Image / build (push) Successful in 3m56s

This commit is contained in:
Ruslan Bakiev
2026-01-26 15:44:44 +07:00
parent 6b359b177c
commit 2275f956ae
2 changed files with 9 additions and 10 deletions

View File

@@ -250,17 +250,16 @@ export function useCatalogSearch() {
// Text search (for filtering within current grid) - shared via useState
const searchQuery = useState<string>('catalog-search-query', () => '')
// Map view mode preference (stored in cookie)
const mapViewCookie = useCookie<MapViewMode>('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<MapViewMode>(() => {
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

View File

@@ -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"