feat(catalog): two-level offers navigation + map auto-centering
All checks were successful
Build Docker Image / build (push) Successful in 3m45s
All checks were successful
Build Docker Image / build (push) Successful in 3m45s
- Add fitBounds to CatalogMap for auto-centering on all points - Add productUuid filter to useCatalogOffers composable - Create useCatalogProducts composable for products list - Update offers/index.vue: show products first, then offers by product - Update offers/map.vue: same two-level navigation - Add translations for new UI elements Navigation flow: /catalog/offers → product selection → offers for that product 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Map as MapboxMapType } from 'mapbox-gl'
|
||||
import { LngLatBounds } from 'mapbox-gl'
|
||||
|
||||
interface MapItem {
|
||||
uuid: string
|
||||
@@ -43,6 +44,7 @@ const emit = defineEmits<{
|
||||
|
||||
const mapRef = useMapboxRef(props.mapId)
|
||||
const { flyThroughSpace } = useMapboxFlyAnimation()
|
||||
const didFitBounds = ref(false)
|
||||
|
||||
const mapOptions = computed(() => ({
|
||||
style: 'mapbox://styles/mapbox/satellite-streets-v12',
|
||||
@@ -160,6 +162,16 @@ const onMapCreated = (map: MapboxMapType) => {
|
||||
map.on('mouseleave', 'clusters', () => { map.getCanvas().style.cursor = '' })
|
||||
map.on('mouseenter', 'unclustered-point', () => { map.getCanvas().style.cursor = 'pointer' })
|
||||
map.on('mouseleave', 'unclustered-point', () => { map.getCanvas().style.cursor = '' })
|
||||
|
||||
// Auto-fit bounds to all items
|
||||
if (!didFitBounds.value && props.items.length > 0) {
|
||||
const bounds = new LngLatBounds()
|
||||
props.items.forEach(item => {
|
||||
bounds.extend([item.longitude, item.latitude])
|
||||
})
|
||||
map.fitBounds(bounds, { padding: 50, maxZoom: 10 })
|
||||
didFitBounds.value = true
|
||||
}
|
||||
}
|
||||
|
||||
if (map.loaded()) {
|
||||
|
||||
Reference in New Issue
Block a user