Add map view toggle for fullWidthMap mode
All checks were successful
Build Docker Image / build (push) Successful in 3m25s

- Add MapViewMode type (offers/hubs/suppliers) with cookie storage
- Add view toggle button group on full-width map
- Update clusterNodeType and mapPointColor based on selected view
- Add translations for view options
This commit is contained in:
Ruslan Bakiev
2026-01-22 18:41:38 +07:00
parent 2d86c79b06
commit 749f15131b
5 changed files with 74 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import type { LocationQuery } from 'vue-router'
export type SelectMode = 'product' | 'supplier' | 'hub' | null
export type MapViewMode = 'offers' | 'hubs' | 'suppliers'
export type DisplayMode =
| 'map-default'
| 'grid-products'
@@ -214,6 +215,19 @@ 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 }
})
const setMapViewMode = (mode: MapViewMode) => {
mapViewCookie.value = mode
}
return {
// State
selectMode,
@@ -223,6 +237,7 @@ export function useCatalogSearch() {
hubId,
quantity,
searchQuery,
mapViewMode,
// Colors
entityColors,
@@ -239,6 +254,7 @@ export function useCatalogSearch() {
editFilter,
clearAll,
setLabel,
setMapViewMode,
// Labels cache
filterLabels