Fix: hide mode toggle on home page, store mapViewMode in URL
All checks were successful
Build Docker Image / build (push) Successful in 3m56s
All checks were successful
Build Docker Image / build (push) Successful in 3m56s
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user