feat: redesign promotions carrusel and fix closest stop marker issue
This commit is contained in:
@ -6,7 +6,7 @@ import type { BusStop } from '@/types'
|
|||||||
import { useRouteStore } from '@/stores/route'
|
import { useRouteStore } from '@/stores/route'
|
||||||
|
|
||||||
export const useFlujoPrincipal = () => {
|
export const useFlujoPrincipal = () => {
|
||||||
const { limpiarMapa, registrarMarker } = useMapState()
|
const { limpiarMapa } = useMapState()
|
||||||
const paradaCercanaInst = useParadaCercana()
|
const paradaCercanaInst = useParadaCercana()
|
||||||
const { encontrarParadaCercana, paradaCercana } = paradaCercanaInst
|
const { encontrarParadaCercana, paradaCercana } = paradaCercanaInst
|
||||||
const { trazarRuta } = useDirectionsRoute()
|
const { trazarRuta } = useDirectionsRoute()
|
||||||
@ -97,7 +97,8 @@ export const useFlujoPrincipal = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── PASO 6: Marcador de parada cercana ────────────────
|
// ── PASO 6: Marcador de parada cercana (ELIMINADO por petición del usuario para mantener mapa limpio) ────────────────
|
||||||
|
/*
|
||||||
registrarMarker(
|
registrarMarker(
|
||||||
new google.maps.Marker({
|
new google.maps.Marker({
|
||||||
position: { lat: paradaCercanaFound.latitude, lng: paradaCercanaFound.longitude },
|
position: { lat: paradaCercanaFound.latitude, lng: paradaCercanaFound.longitude },
|
||||||
@ -114,6 +115,7 @@ export const useFlujoPrincipal = () => {
|
|||||||
zIndex: 10
|
zIndex: 10
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
*/
|
||||||
|
|
||||||
// ── PASO 7: Pulso animado en ubicación del usuario ────
|
// ── PASO 7: Pulso animado en ubicación del usuario ────
|
||||||
dibujarPulsoUsuario(ubicacion, map)
|
dibujarPulsoUsuario(ubicacion, map)
|
||||||
|
|||||||
@ -45,9 +45,7 @@ const isUpdatingMarkers = ref(false);
|
|||||||
const unitMarkers = ref<Map<string, google.maps.Marker>>(new Map());
|
const unitMarkers = ref<Map<string, google.maps.Marker>>(new Map());
|
||||||
const unitFetchInterval = ref<any>(null);
|
const unitFetchInterval = ref<any>(null);
|
||||||
const userCoords = ref<{ lat: number; lng: number } | null>(null);
|
const userCoords = ref<{ lat: number; lng: number } | null>(null);
|
||||||
const polyline = ref<google.maps.Polyline | null>(null);
|
|
||||||
const walkingPolyline = ref<google.maps.Polyline | null>(null);
|
const walkingPolyline = ref<google.maps.Polyline | null>(null);
|
||||||
const walkingPolylineBorder = ref<google.maps.Polyline | null>(null);
|
|
||||||
const optimalStopPulse = ref<any>(null);
|
const optimalStopPulse = ref<any>(null);
|
||||||
const showRouteDropdown = ref(false);
|
const showRouteDropdown = ref(false);
|
||||||
const routeCardRef = ref<HTMLElement | null>(null);
|
const routeCardRef = ref<HTMLElement | null>(null);
|
||||||
@ -704,32 +702,26 @@ async function highlightOptimalStopForRoute() {
|
|||||||
</Transition>
|
</Transition>
|
||||||
</div> <!-- Fin uber-search-container -->
|
</div> <!-- Fin uber-search-container -->
|
||||||
|
|
||||||
<!-- Offers Bottom Sheet -->
|
<!-- Offers Floating Card (Uber Eats style) -->
|
||||||
<Transition name="sheet-slide">
|
<Transition name="sheet-slide">
|
||||||
<div v-if="showPromos && couponStore.coupons.length > 0" class="offers-sheet">
|
<div v-if="showPromos && couponStore.coupons.length > 0" class="offers-sheet">
|
||||||
<!-- Handle -->
|
<!-- Header -->
|
||||||
<div class="sheet-handle"></div>
|
|
||||||
|
|
||||||
<!-- Cabecera -->
|
|
||||||
<div class="sheet-header">
|
<div class="sheet-header">
|
||||||
<div class="sheet-title-group">
|
<div class="sheet-title-group">
|
||||||
<span class="material-icons">local_offer</span>
|
<span class="material-icons sheet-star">stars</span>
|
||||||
<strong>Ofertas Disponibles</strong>
|
<span class="sheet-title">Ofertas SIBU</span>
|
||||||
<span class="sheet-count">({{ couponStore.coupons.length }})</span>
|
|
||||||
</div>
|
</div>
|
||||||
<button class="close-btn" @click="showPromos = false">
|
<button class="sheet-close" @click="showPromos = false">
|
||||||
<span class="material-icons">close</span>
|
<span class="material-icons">close</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Card area with nav arrows -->
|
<!-- Card area with nav arrows -->
|
||||||
<div class="sheet-card-area">
|
<div class="sheet-card-area">
|
||||||
<!-- Arrow prev -->
|
<button class="sheet-nav" @click="prevPromo" :disabled="couponStore.coupons.length < 2">
|
||||||
<button class="sheet-nav sheet-nav--prev" @click="prevPromo" :disabled="couponStore.coupons.length < 2">
|
|
||||||
<span class="material-icons">chevron_left</span>
|
<span class="material-icons">chevron_left</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Promo Card -->
|
|
||||||
<Transition name="carousel-slide" mode="out-in">
|
<Transition name="carousel-slide" mode="out-in">
|
||||||
<div
|
<div
|
||||||
v-if="currentPromo"
|
v-if="currentPromo"
|
||||||
@ -739,47 +731,38 @@ async function highlightOptimalStopForRoute() {
|
|||||||
@touchstart="stopCarousel"
|
@touchstart="stopCarousel"
|
||||||
@mouseleave="startCarousel"
|
@mouseleave="startCarousel"
|
||||||
>
|
>
|
||||||
<!-- Image -->
|
|
||||||
<div class="sheet-img-wrap">
|
<div class="sheet-img-wrap">
|
||||||
<img
|
<img
|
||||||
:src="getImageUrl(currentPromo.image_url, 'coupon')"
|
:src="getImageUrl(currentPromo.image_url, 'coupon')"
|
||||||
class="sheet-img"
|
class="sheet-img"
|
||||||
:alt="currentPromo.title"
|
|
||||||
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'coupon')"
|
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'coupon')"
|
||||||
/>
|
/>
|
||||||
<span v-if="currentPromo.discount_percentage" class="sheet-discount">
|
<span v-if="currentPromo.discount_percentage" class="sheet-discount">-{{ currentPromo.discount_percentage }}%</span>
|
||||||
-{{ currentPromo.discount_percentage }}%
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Info -->
|
|
||||||
<div class="sheet-info">
|
<div class="sheet-info">
|
||||||
<p class="sheet-biz-name">{{ currentPromo.business?.name || 'SIBU' }}</p>
|
<span class="sheet-biz-name">{{ currentPromo.business?.name || 'Local' }}</span>
|
||||||
<h3 class="sheet-promo-title">{{ currentPromo.title }}</h3>
|
<h3 class="sheet-promo-title">{{ currentPromo.title }}</h3>
|
||||||
<p class="sheet-promo-desc">{{ currentPromo.description }}</p>
|
<button class="sheet-cta" @click="handlePromoClick(currentPromo)">Ver detalles</button>
|
||||||
<button class="sheet-cta" @click="router.push('/business/' + currentPromo.business_id)">
|
<!-- CTA to business removed for simplification -->
|
||||||
Ver Negocio
|
|
||||||
<span class="material-icons" style="font-size:1rem">arrow_forward</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Transition>
|
</Transition>
|
||||||
|
|
||||||
<!-- Arrow next -->
|
<button class="sheet-nav" @click="nextPromo" :disabled="couponStore.coupons.length < 2">
|
||||||
<button class="sheet-nav sheet-nav--next" @click="nextPromo" :disabled="couponStore.coupons.length < 2">
|
|
||||||
<span class="material-icons">chevron_right</span>
|
<span class="material-icons">chevron_right</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Dots -->
|
<!-- Dots -->
|
||||||
<div class="sheet-dots">
|
<div class="sheet-dots" v-if="couponStore.coupons.length > 1">
|
||||||
<button
|
<div
|
||||||
v-for="(_, i) in couponStore.coupons"
|
v-for="(_, i) in couponStore.coupons"
|
||||||
:key="i"
|
:key="i"
|
||||||
class="sheet-dot"
|
class="sheet-dot"
|
||||||
:class="{ 'sheet-dot--active': i === currentCarouselIndex }"
|
:class="{ 'sheet-dot--active': i === currentCarouselIndex }"
|
||||||
@click="currentCarouselIndex = i; startCarousel()"
|
@click="currentCarouselIndex = i; startCarousel()"
|
||||||
></button>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Transition>
|
</Transition>
|
||||||
@ -944,54 +927,38 @@ async function highlightOptimalStopForRoute() {
|
|||||||
OFFERS BOTTOM SHEET
|
OFFERS BOTTOM SHEET
|
||||||
═══════════════════════════════════════ */
|
═══════════════════════════════════════ */
|
||||||
.offers-sheet {
|
.offers-sheet {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
/* Base 72px (altura menú) + 60px espacio visual + safe area */
|
bottom: 80px; /* Separado del borde inferior/menú */
|
||||||
bottom: calc(72px + 60px + env(safe-area-inset-bottom, 0px));
|
left: 50%;
|
||||||
left: 10px;
|
transform: translateX(-50%);
|
||||||
right: 10px;
|
width: 92%;
|
||||||
background: #fff;
|
max-width: 400px;
|
||||||
border: 2px solid #000;
|
background: rgba(255, 255, 255, 0.85);
|
||||||
border-radius: 12px;
|
backdrop-filter: blur(20px) saturate(180%);
|
||||||
|
-webkit-backdrop-filter: blur(20px) saturate(180%);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
|
border-radius: 24px;
|
||||||
z-index: 2000;
|
z-index: 2000;
|
||||||
padding-bottom: 10px;
|
padding: 12px;
|
||||||
box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
|
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
|
||||||
color: #000;
|
color: #000;
|
||||||
/* Limitar altura máxima para no ocupar toda la pantalla */
|
overflow: hidden;
|
||||||
max-height: calc(100vh - 200px);
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
.offers-sheet {
|
.offers-sheet {
|
||||||
background: #111;
|
background: rgba(20, 20, 20, 0.8);
|
||||||
|
border-color: rgba(255, 255, 255, 0.1);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-color: #333;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.offers-sheet {
|
|
||||||
/* En móvil más espacio aún por el menú nativo */
|
|
||||||
bottom: calc(135px + env(safe-area-inset-bottom, 0px));
|
|
||||||
left: 8px;
|
|
||||||
right: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.sheet-handle {
|
|
||||||
width: 40px;
|
|
||||||
height: 4px;
|
|
||||||
border-radius: 99px;
|
|
||||||
background: var(--border-color);
|
|
||||||
margin: 10px auto 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sheet-header {
|
.sheet-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0.5rem 1rem 0.75rem;
|
padding: 0.25rem 0.5rem 0.5rem;
|
||||||
border-bottom: 1px solid var(--border-color);
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sheet-header-left {
|
.sheet-header-left {
|
||||||
@ -1033,32 +1000,41 @@ async function highlightOptimalStopForRoute() {
|
|||||||
.sheet-close:hover { color: var(--text-primary); }
|
.sheet-close:hover { color: var(--text-primary); }
|
||||||
.sheet-close .material-icons { font-size: 1.125rem; }
|
.sheet-close .material-icons { font-size: 1.125rem; }
|
||||||
|
|
||||||
/* Card area */
|
|
||||||
.sheet-card-area {
|
.sheet-card-area {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.25rem;
|
gap: 0.5rem;
|
||||||
padding: 0.75rem 0.5rem 0.375rem;
|
padding: 0.25rem;
|
||||||
min-height: 110px;
|
min-height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sheet-nav {
|
.sheet-nav {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 32px;
|
width: 28px;
|
||||||
height: 32px;
|
height: 28px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: 1px solid var(--border-color);
|
border: none;
|
||||||
background: var(--bg-primary);
|
background: rgba(0, 0, 0, 0.05);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.18s;
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
.sheet-nav:disabled { opacity: 0.1; cursor: default; }
|
||||||
|
.sheet-nav:not(:disabled):hover {
|
||||||
|
background: var(--active-color);
|
||||||
|
color: #101820;
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
.sheet-nav .material-icons { font-size: 1.125rem; }
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.sheet-nav {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.sheet-nav:disabled { opacity: 0.3; cursor: default; }
|
|
||||||
.sheet-nav:not(:disabled):hover { background: var(--active-color); color: #101820; border-color: var(--active-color); }
|
|
||||||
.sheet-nav .material-icons { font-size: 1.25rem; }
|
|
||||||
|
|
||||||
.sheet-card {
|
.sheet-card {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -1071,11 +1047,11 @@ async function highlightOptimalStopForRoute() {
|
|||||||
.sheet-img-wrap {
|
.sheet-img-wrap {
|
||||||
position: relative;
|
position: relative;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 88px;
|
width: 80px;
|
||||||
height: 88px;
|
height: 80px;
|
||||||
border-radius: 12px;
|
border-radius: 16px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: var(--bg-primary);
|
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sheet-img {
|
.sheet-img {
|
||||||
@ -1086,15 +1062,15 @@ async function highlightOptimalStopForRoute() {
|
|||||||
|
|
||||||
.sheet-discount {
|
.sheet-discount {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 6px;
|
top: 0;
|
||||||
left: 6px;
|
left: 0;
|
||||||
background: #ef4444;
|
background: #f43f5e;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 0.6875rem;
|
font-size: 0.65rem;
|
||||||
font-weight: 800;
|
font-weight: 900;
|
||||||
padding: 0.15rem 0.4rem;
|
padding: 0.2rem 0.5rem;
|
||||||
border-radius: 6px;
|
border-bottom-right-radius: 12px;
|
||||||
line-height: 1.2;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sheet-info {
|
.sheet-info {
|
||||||
@ -1102,27 +1078,25 @@ async function highlightOptimalStopForRoute() {
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.2rem;
|
gap: 0.15rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sheet-biz-name {
|
.sheet-biz-name {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.6875rem;
|
font-size: 0.65rem;
|
||||||
font-weight: 700;
|
font-weight: 800;
|
||||||
color: var(--active-color);
|
color: var(--text-secondary);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.05em;
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sheet-promo-title {
|
.sheet-promo-title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.9375rem;
|
font-size: 0.9rem;
|
||||||
font-weight: 800;
|
font-weight: 900;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
line-height: 1.2;
|
line-height: 1.1;
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sheet-promo-desc {
|
.sheet-promo-desc {
|
||||||
@ -1137,23 +1111,30 @@ async function highlightOptimalStopForRoute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sheet-cta {
|
.sheet-cta {
|
||||||
|
align-self: flex-start;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.25rem;
|
gap: 0.25rem;
|
||||||
margin-top: 0.375rem;
|
margin-top: 0.4rem;
|
||||||
padding: 0.4rem 0.875rem;
|
padding: 0.35rem 0.75rem;
|
||||||
background: var(--active-color);
|
background: #101820;
|
||||||
color: #101820;
|
color: #fee715;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 99px;
|
border-radius: 12px;
|
||||||
font-size: 0.8125rem;
|
font-size: 0.75rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
font-family: inherit;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: transform 0.15s;
|
transition: transform 0.2s;
|
||||||
align-self: flex-start;
|
}
|
||||||
|
|
||||||
|
.sheet-cta:active { transform: scale(0.95); }
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.sheet-cta {
|
||||||
|
background: #fee715;
|
||||||
|
color: #101820;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.sheet-cta:active { transform: scale(0.97); }
|
|
||||||
|
|
||||||
/* Dots */
|
/* Dots */
|
||||||
.sheet-dots {
|
.sheet-dots {
|
||||||
|
|||||||
Reference in New Issue
Block a user