@@ -31,16 +31,10 @@ import useDevice from '~/composables/useDevice'
31
31
import type { ApiAddrSearchResult , ApiSearchResult } from ' ~/lib/apiSearch'
32
32
import IsochroneStatus from ' ~/components/Isochrone/IsochroneStatus.vue'
33
33
34
- //
35
- // Props
36
- //
37
34
const props = defineProps <{
38
35
boundaryArea? : Polygon | MultiPolygon
39
36
}>()
40
37
41
- //
42
- // Composables
43
- //
44
38
const mapStore = useMapStore ()
45
39
const { center, isModeFavorites, isModeExplorer, isModeExplorerOrFavorites, mode, selectedFeature, teritorioCluster } = storeToRefs (mapStore )
46
40
const menuStore = useMenuStore ()
@@ -56,10 +50,8 @@ const router = useRouter()
56
50
const device = useDevice ()
57
51
const { isochroneCurrentFeature } = useIsochrone ()
58
52
59
- //
60
- // Data
61
- //
62
- const allowRegionBackZoom = ref <boolean >(false )
53
+ // CHECK: maybe unused
54
+ // const allowRegionBackZoom = ref<boolean>(false)
63
55
const isFilterActive = ref <boolean >(false )
64
56
const initialBbox = ref <LngLatBounds >()
65
57
const isMenuItemOpen = ref <boolean >(false )
@@ -68,9 +60,6 @@ const showFavoritesOverlay = ref<boolean>(false)
68
60
const isPoiCardShown = ref <boolean >(false )
69
61
const mapFeaturesRef = ref <InstanceType <typeof MapFeatures >>()
70
62
71
- //
72
- // Hooks
73
- //
74
63
onBeforeMount (async () => {
75
64
const favs = getHashPart (router , ' favs' )
76
65
if (favs ) {
@@ -125,9 +114,6 @@ onMounted(async () => {
125
114
}
126
115
})
127
116
128
- //
129
- // Computed
130
- //
131
117
const isBottomMenuOpened = computed (() => {
132
118
return ((device .value .smallScreen && isPoiCardShown .value ) || isMenuItemOpen .value )
133
119
})
@@ -203,9 +189,6 @@ const siteName = computed(() => {
203
189
return settings ! .themes [0 ]?.title .fr || ' '
204
190
})
205
191
206
- //
207
- // Watchers
208
- //
209
192
watch (selectedFeature , (newFeature ) => {
210
193
isPoiCardShown .value = !! newFeature
211
194
@@ -223,23 +206,15 @@ watch(selectedFeature, (newFeature) => {
223
206
})
224
207
}
225
208
}
226
- }, { immediate: true } )
209
+ })
227
210
228
- watch (selectedCategoryIds , async (a , b ) => {
229
- if (a !== b ) {
211
+ watch (selectedCategoryIds , async (newValue , oldValue ) => {
212
+ if (newValue . toString () !== oldValue . toString () ) {
230
213
routerPushUrl ()
231
- await menuStore .fetchFeatures ({
232
- vidoConfig: config ! ,
233
- categoryIds: selectedCategoryIds .value ,
234
- clipingPolygonSlug: route .query .clipingPolygonSlug ?.toString (),
235
- })
236
- allowRegionBackZoom .value = true
237
214
}
238
215
})
239
216
240
217
watch (mode , () => {
241
- allowRegionBackZoom .value = false
242
-
243
218
const hash = {
244
219
mode: mode .value !== Mode .BROWSER ? mode .value : null ,
245
220
}
@@ -262,13 +237,10 @@ watch(isModeFavorites, async (isEnabled) => {
262
237
}
263
238
})
264
239
265
- //
266
- // Methods
267
- //
268
- async function goToSelectedFeature(feature ? : ApiPoi ): Promise <void > {
240
+ function goToSelectedFeature(feature ? : ApiPoi ): void {
269
241
if (mapFeaturesRef .value ) {
270
242
if (feature )
271
- await mapStore .setSelectedFeature (feature )
243
+ mapStore .setSelectedFeature (feature )
272
244
mapFeaturesRef .value .goToSelectedFeature ()
273
245
}
274
246
}
@@ -337,9 +309,9 @@ function onBottomMenuButtonClick() {
337
309
isMenuItemOpen .value = ! isMenuItemOpen .value
338
310
}
339
311
340
- async function onQuitExplorerFavoriteMode(): Promise < void > {
312
+ function onQuitExplorerFavoriteMode(): void {
341
313
if (mapFeaturesRef .value )
342
- await mapStore .setSelectedFeature ()
314
+ mapStore .setSelectedFeature ()
343
315
344
316
mode .value = Mode .BROWSER
345
317
}
@@ -378,7 +350,7 @@ function routerPushUrl(hashUpdate: { [key: string]: string | null } = {}) {
378
350
if (hashUpdate )
379
351
hash = setHashParts (hash , hashUpdate )
380
352
381
- router . push ({
353
+ navigateTo ({
382
354
path: mode .value !== Mode .BROWSER
383
355
? ' /'
384
356
: (categoryIds ? ` /${categoryIds }/ ` : ' /' ) + (id ? ` ${id } ` : ' ' ),
@@ -396,7 +368,7 @@ function toggleExploreAroundSelectedPoi(feature?: ApiPoi) {
396
368
isPoiCardShown .value = false
397
369
}
398
370
else {
399
- allowRegionBackZoom .value = false
371
+ // allowRegionBackZoom.value = false
400
372
mode .value = Mode .BROWSER
401
373
}
402
374
}
@@ -428,9 +400,9 @@ function scrollTop() {
428
400
header .scrollTop = 0
429
401
}
430
402
431
- async function handlePoiCardClose(): Promise < void > {
403
+ function handlePoiCardClose(): void {
432
404
if (mapFeaturesRef .value ) {
433
- await mapStore .setSelectedFeature ()
405
+ mapStore .setSelectedFeature ()
434
406
}
435
407
}
436
408
</script >
0 commit comments