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
|
// Text search (for filtering within current grid) - shared via useState
|
||||||
const searchQuery = useState<string>('catalog-search-query', () => '')
|
const searchQuery = useState<string>('catalog-search-query', () => '')
|
||||||
|
|
||||||
// Map view mode preference (stored in cookie)
|
// Map view mode (stored in URL query param 'view')
|
||||||
const mapViewCookie = useCookie<MapViewMode>('catalog-map-view', {
|
const mapViewMode = computed<MapViewMode>(() => {
|
||||||
default: () => 'offers',
|
const view = route.query.view as string | undefined
|
||||||
maxAge: 60 * 60 * 24 * 365 // 1 year
|
if (view === 'hubs' || view === 'suppliers' || view === 'offers') {
|
||||||
})
|
return view
|
||||||
const mapViewMode = computed({
|
}
|
||||||
get: () => mapViewCookie.value,
|
return 'offers' // default
|
||||||
set: (val: MapViewMode) => { mapViewCookie.value = val }
|
|
||||||
})
|
})
|
||||||
const setMapViewMode = (mode: MapViewMode) => {
|
const setMapViewMode = (mode: MapViewMode) => {
|
||||||
mapViewCookie.value = mode
|
updateQuery({ view: mode === 'offers' ? null : mode })
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drawer state for list view
|
// Drawer state for list view
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
:hub-label="hubLabel ?? undefined"
|
:hub-label="hubLabel ?? undefined"
|
||||||
:quantity="quantity"
|
:quantity="quantity"
|
||||||
:can-search="canSearch"
|
:can-search="canSearch"
|
||||||
:show-mode-toggle="true"
|
:show-mode-toggle="isCatalogSection"
|
||||||
:glass-style="isCatalogSection"
|
:glass-style="isCatalogSection"
|
||||||
@toggle-theme="toggleTheme"
|
@toggle-theme="toggleTheme"
|
||||||
@set-catalog-mode="setCatalogMode"
|
@set-catalog-mode="setCatalogMode"
|
||||||
|
|||||||
Reference in New Issue
Block a user