From 3c6ae03c30c5a20b9a6fc933a069db7e08abb6b1 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Thu, 22 Jan 2026 11:45:23 +0700 Subject: [PATCH] Add entity color scheme and improve map hover effect - Add color scheme: product/offer=orange, supplier=blue, hub=green - Remove 'location' filter (same as hub) - Quantity filter appears only after product is selected - Map hover shows 'target' ring effect (outer white ring) - Tokens in header use entity-specific colors --- app/components/catalog/CatalogMap.vue | 61 +++++++++++++++----- app/components/navigation/MainNavigation.vue | 8 ++- app/composables/useCatalogSearch.ts | 33 +++++------ app/pages/catalog/index.vue | 11 ++-- i18n/locales/en/catalog.json | 1 - i18n/locales/ru/catalog.json | 1 - 6 files changed, 76 insertions(+), 39 deletions(-) diff --git a/app/components/catalog/CatalogMap.vue b/app/components/catalog/CatalogMap.vue index 714001c..8699df4 100644 --- a/app/components/catalog/CatalogMap.vue +++ b/app/components/catalog/CatalogMap.vue @@ -208,12 +208,7 @@ const initClientClusteringLayers = (map: MapboxMapType) => { filter: ['!', ['has', 'point_count']], paint: { 'circle-radius': 12, - 'circle-color': [ - 'case', - ['==', ['get', 'uuid'], props.hoveredItemId || ''], - '#facc15', // yellow when hovered - props.pointColor - ], + 'circle-color': props.pointColor, 'circle-stroke-width': 3, 'circle-stroke-color': '#ffffff' } @@ -260,6 +255,36 @@ const initClientClusteringLayers = (map: MapboxMapType) => { map.on('mouseenter', 'unclustered-point', () => { map.getCanvas().style.cursor = 'pointer' }) map.on('mouseleave', 'unclustered-point', () => { map.getCanvas().style.cursor = '' }) + // Hovered point layer (on top of everything) - "target" effect with border + map.addSource(hoveredSourceId.value, { + type: 'geojson', + data: hoveredPointGeoJson.value + }) + // Outer ring (white) + map.addLayer({ + id: 'hovered-point-ring', + type: 'circle', + source: hoveredSourceId.value, + paint: { + 'circle-radius': 20, + 'circle-color': 'transparent', + 'circle-stroke-width': 3, + 'circle-stroke-color': '#ffffff' + } + }) + // Inner point (same as entity color) + map.addLayer({ + id: 'hovered-point-layer', + type: 'circle', + source: hoveredSourceId.value, + paint: { + 'circle-radius': 14, + 'circle-color': props.pointColor, + 'circle-stroke-width': 3, + 'circle-stroke-color': '#ffffff' + } + }) + // Auto-fit bounds to all items if (!didFitBounds.value && props.items.length > 0) { const bounds = new LngLatBounds() @@ -312,12 +337,7 @@ const initServerClusteringLayers = (map: MapboxMapType) => { filter: ['==', ['get', 'count'], 1], paint: { 'circle-radius': 12, - 'circle-color': [ - 'case', - ['==', ['get', 'id'], props.hoveredItemId || ''], - '#facc15', // yellow when hovered - props.pointColor - ], + 'circle-color': props.pointColor, 'circle-stroke-width': 3, 'circle-stroke-color': '#ffffff' } @@ -365,18 +385,31 @@ const initServerClusteringLayers = (map: MapboxMapType) => { map.on('mouseenter', 'server-points', () => { map.getCanvas().style.cursor = 'pointer' }) map.on('mouseleave', 'server-points', () => { map.getCanvas().style.cursor = '' }) - // Hovered point layer (on top of everything) + // Hovered point layer (on top of everything) - "target" effect with border map.addSource(hoveredSourceId.value, { type: 'geojson', data: hoveredPointGeoJson.value }) + // Outer ring (white) + map.addLayer({ + id: 'hovered-point-ring', + type: 'circle', + source: hoveredSourceId.value, + paint: { + 'circle-radius': 20, + 'circle-color': 'transparent', + 'circle-stroke-width': 3, + 'circle-stroke-color': '#ffffff' + } + }) + // Inner point (same as entity color) map.addLayer({ id: 'hovered-point-layer', type: 'circle', source: hoveredSourceId.value, paint: { 'circle-radius': 14, - 'circle-color': '#3b82f6', + 'circle-color': props.pointColor, 'circle-stroke-width': 3, 'circle-stroke-color': '#ffffff' } diff --git a/app/components/navigation/MainNavigation.vue b/app/components/navigation/MainNavigation.vue index 369ea67..987aa01 100644 --- a/app/components/navigation/MainNavigation.vue +++ b/app/components/navigation/MainNavigation.vue @@ -27,7 +27,8 @@