diff --git a/components/BandeauBas.vue b/components/BandeauBas.vue index deb85d1..51c6a68 100644 --- a/components/BandeauBas.vue +++ b/components/BandeauBas.vue @@ -461,10 +461,12 @@ const jaugePct = computed(() => { } /* ── FAB mobile soutenir ─────────────────────────────────────────────────── */ +/* Stack vertical avec le FAB Chatbot a droite (evite l'overlap avec les chips + sidebar mobile sur viewport intermediaire ~880px - bug E2E M3) */ .fab-soutenir { position: fixed; - bottom: 68px; /* au-dessus du FAB chatbot à 24px du bas + 48px de hauteur */ - left: 16px; + bottom: 84px; /* au-dessus du FAB chatbot a bottom-6 (24px) + 48px de hauteur + 12px gap */ + right: 16px; z-index: 1000; width: 44px; height: 44px; diff --git a/components/EuropeMap.vue b/components/EuropeMap.vue index 6a6c157..9c918a7 100644 --- a/components/EuropeMap.vue +++ b/components/EuropeMap.vue @@ -123,6 +123,12 @@ async function initMap() { updateMarkers(L) } +// Vue initiale (centre Europe + zoom 4) - sauvegardee pour reset +const INITIAL_CENTER: [number, number] = [50.0, 10.0] +const INITIAL_ZOOM = 4 + +let initialFitDone = false + function updateMarkers(L?: any) { if (!mapInstance || !clusterGroup) return const leaflet = L || (window as any).L @@ -158,6 +164,29 @@ function updateMarkers(L?: any) { markers.set(org.id, marker) clusterGroup.addLayer(marker) }) + + // Bug E2E L3 : recadrer la carte sur les resultats filtres + // Conditions : 1+ resultat, et au moins 1 marker hors viewport actuel. + // On evite de recadrer au tout premier rendu (laisser la vue initiale). + if (orgsWithCoords.length > 0 && initialFitDone) { + try { + const bounds = leaflet.latLngBounds( + orgsWithCoords.map((o) => [o.lat!, o.lng!]) + ) + // On recadre uniquement si la liste filtree est restreinte + // (evite un recadrage permanent quand toutes les fiches sont la). + if (orgsWithCoords.length <= 15) { + mapInstance.fitBounds(bounds, { + padding: [40, 40], + maxZoom: 10, + animate: true, + }) + } + } catch (e) { + console.warn('[EuropeMap] fitBounds echoue:', e) + } + } + initialFitDone = true } watch( diff --git a/components/NavMap.vue b/components/NavMap.vue index ae3938c..aeb68ab 100644 --- a/components/NavMap.vue +++ b/components/NavMap.vue @@ -128,6 +128,8 @@ async function initMap() { updateMarkers(L) } +let initialFitDone = false + function updateMarkers(L?: any) { if (!mapInstance || !clusterGroup) return const leaflet = L || (window as any).L @@ -168,6 +170,25 @@ function updateMarkers(L?: any) { markers.set(org.Id, marker) clusterGroup.addLayer(marker) }) + + // Bug E2E L3 : recadrer la carte sur les resultats filtres + if (orgsWithCoords.length > 0 && initialFitDone) { + try { + const bounds = leaflet.latLngBounds( + orgsWithCoords.map((o: any) => [o.latitude!, o.longitude!]) + ) + if (orgsWithCoords.length <= 15) { + mapInstance.fitBounds(bounds, { + padding: [40, 40], + maxZoom: 10, + animate: true, + }) + } + } catch (e) { + console.warn('[NavMap] fitBounds echoue:', e) + } + } + initialFitDone = true } // Réagir aux changements de filtres (liste d'orgs) diff --git a/pages/fiche/[id].vue b/pages/fiche/[id].vue index 9f19738..cd57b52 100644 --- a/pages/fiche/[id].vue +++ b/pages/fiche/[id].vue @@ -72,6 +72,21 @@ const { data: org, pending, error } = await useFetch(`/api/fiche/${orgId}`, key: `fiche-${orgId}`, }) +// ── Fallback Pratiques regeneratives (bug E2E L1) ───────────────────── +// Si /api/fiche/:id echoue, on regarde si l'id correspond a une pratique +// regenerative et on redirige automatiquement vers /pratique/:id. +if (error.value) { + try { + const pratiquesRes = await $fetch<{ list: { id: number }[] }>('/api/pratiques') + const numericId = Number(orgId) + if (!isNaN(numericId) && pratiquesRes.list?.some((p) => p.id === numericId)) { + await navigateTo(`/pratique/${numericId}`, { replace: true }) + } + } catch { + // pas de fallback dispo, on garde l'erreur + } +} + // ── Commentaires — tick de rafraîchissement ─────────────────────────── const commentRefreshTick = ref(0) diff --git a/pages/index.vue b/pages/index.vue index a264520..9c856e6 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -205,15 +205,17 @@
ÉCHELLE
- {{ opt }} + >{{ opt }}
@@ -221,15 +223,17 @@
FONCTION
- {{ fn }} + >{{ fn }}
@@ -446,6 +450,7 @@ const hasActiveFilters = computed(() => function resetFilters() { search.value = '' + mobileSearch.value = '' echelle.value = [] fonctions.value = [] territoire.value = null diff --git a/pages/pratiques-regeneratives.vue b/pages/pratiques-regeneratives.vue index 7f0d667..31d57d5 100644 --- a/pages/pratiques-regeneratives.vue +++ b/pages/pratiques-regeneratives.vue @@ -211,15 +211,17 @@ le réemploi de matériaux en Belgique."

CRITÈRES
- {{ c.label }} + >{{ c.label }}
@@ -227,15 +229,17 @@ le réemploi de matériaux en Belgique."

TYPE
- {{ TYPES_ENTITE_LABELS[t] ?? t }} + >{{ TYPES_ENTITE_LABELS[t] ?? t }}
@@ -457,6 +461,7 @@ const hasActiveFilters = computed(() => function resetFilters() { search.value = '' + mobileSearch.value = '' criteres.value = [] typesEntite.value = [] pays.value = [] diff --git a/pages/proposer-pratique.vue b/pages/proposer-pratique.vue index 8e87091..f63f7e8 100644 --- a/pages/proposer-pratique.vue +++ b/pages/proposer-pratique.vue @@ -3,7 +3,7 @@
- ← Retour à la carte + ← Retour aux pratiques régénératives