Sincronización final: MapView.vue con fixes de reset, apertura automática y decimales

This commit is contained in:
2026-03-02 14:11:53 -05:00
parent 9650f2b019
commit 91d0c12514

View File

@ -21,7 +21,7 @@ import SearchOverlay from "@/components/map/SearchOverlay.vue";
import PromoCarousel from "@/components/map/PromoCarousel.vue"; import PromoCarousel from "@/components/map/PromoCarousel.vue";
import ArrivalBanner from "@/components/map/ArrivalBanner.vue"; import ArrivalBanner from "@/components/map/ArrivalBanner.vue";
const ETACard = defineAsyncComponent(() => import("@/components/ETACard.vue")); const ETACard = defineAsyncComponent(() => import("@/components/map/ETACard.vue"));
import type { BusStop } from '@/types' import type { BusStop } from '@/types'
const router = useRouter(); const router = useRouter();
@ -413,35 +413,33 @@ watch([etaCargando, () => busesActivos.value.length], ([loading, count]) => {
*/ */
function handleBannerClick() { function handleBannerClick() {
// Solo abrir el ETACard, NO borrar paradas ni ruta
showETACard.value = true; showETACard.value = true;
// Desaparecer las paradas:
routeStore.clearSelection();
router.replace({ query: {} });
clearMapMarkers();
} }
// Watch for route selection changes // Watch for route selection changes
watch(() => routeStore.selectedRouteId, (routeId) => { watch(() => routeStore.selectedRouteId, (routeId) => {
if (routeId) { if (routeId) {
if (routeStore.wasSelectedFromMap) { if (routeStore.wasSelectedFromMap) {
// OPTIMIZACIÓN PROBLEMA 1: Paralelismo Total // Iniciar dibujo y búsqueda de disponibilidad en paralelo
// Iniciamos dibujo y búsqueda de disponibilidad en paralelo // ETACard se abrirá cuando paradaCercana sea calculada (ver watcher abajo)
showETACard.value = false;
updateMapMarkers(false); updateMapMarkers(false);
updateActiveUnits(); updateActiveUnits();
showETACard.value = true; // RESTORED: Abrir automáticamente al seleccionar ruta
} else { } else {
clearMapMarkers(); clearMapMarkers();
} }
} else { } else {
clearMapMarkers(); clearMapMarkers();
// showETACard.value = false; // REVERTED: Mantener ETACard abierta aunque se limpie el mapa (petición de usuario)
} }
}); });
// Watch for paradaCercana to recalculate ETA as soon as it's identified // Watch for paradaCercana to recalculate ETA as soon as it's identified
// Y abrir el ETACard automáticamente cuando ya tenemos la parada
watch(paradaCercana, (newStop) => { watch(paradaCercana, (newStop) => {
if (newStop && routeStore.selectedRouteId) { if (newStop && routeStore.selectedRouteId) {
updateActiveUnits(); updateActiveUnits();
showETACard.value = true; // Abrir ahora que sí tenemos datos reales
} }
}); });
@ -572,7 +570,7 @@ watch([() => authStore.userProfile?.auto_location, isLoaded], ([canLocate, loade
:walk-duration="duracionCaminata" :walk-duration="duracionCaminata"
:buses="busesActivos" :buses="busesActivos"
:is-loading="etaCargando" :is-loading="etaCargando"
@close="showETACard = false" @close="animateAndReload"
@refresh="paradaCercana && routeStore.selectedRouteId ? calcularETA(routeStore.selectedRouteId, paradaCercana) : null" @refresh="paradaCercana && routeStore.selectedRouteId ? calcularETA(routeStore.selectedRouteId, paradaCercana) : null"
/> />
</div> </div>