fix: map lifecycle crash, state persistence with pinia-persistedstate, and premium business details UI
This commit is contained in:
@ -7,6 +7,7 @@ import { couponsService } from '@/services/couponsService'
|
||||
import type { Business, Coupon } from '@/types'
|
||||
import FavoriteButton from '@/components/FavoriteButton.vue'
|
||||
import { getImageUrl as utilGetImageUrl } from '@/utils/imageUrl'
|
||||
import { analyticsService } from '@/services/analyticsService'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
@ -14,32 +15,35 @@ const { t } = useI18n()
|
||||
const business = ref<Business | null>(null)
|
||||
const coupons = ref<Coupon[]>([])
|
||||
const isLoading = ref(true)
|
||||
const fetchError = ref(false)
|
||||
|
||||
import { analyticsService } from '@/services/analyticsService'
|
||||
|
||||
onMounted(async () => {
|
||||
async function fetchData() {
|
||||
const id = route.params.id as string
|
||||
if (!id) return
|
||||
isLoading.value = true
|
||||
fetchError.value = false
|
||||
try {
|
||||
const [bizData, allCoupons] = await Promise.all([
|
||||
businessService.getBusiness(id),
|
||||
couponsService.getAllCoupons({ active_only: true })
|
||||
])
|
||||
business.value = bizData
|
||||
// Filter coupons for this business
|
||||
coupons.value = allCoupons.filter(c => c.business_id === id)
|
||||
|
||||
analyticsService.logEvent({
|
||||
event_name: 'screen_view',
|
||||
screen_name: 'BusinessDetails',
|
||||
item_id: bizData.name,
|
||||
properties: { business_id: id }
|
||||
event_name: 'screen_view',
|
||||
screen_name: 'BusinessDetails',
|
||||
item_id: bizData.name,
|
||||
properties: { business_id: id }
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('Failed to load business details', e)
|
||||
fetchError.value = true
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(fetchData)
|
||||
|
||||
function getImageUrl(path: string | null | undefined) {
|
||||
return utilGetImageUrl(path, 'business')
|
||||
@ -54,463 +58,619 @@ function openDirections() {
|
||||
window.open(`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(business.value.address + ' ' + (business.value.area || ''))}`, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="business-details-view" v-if="!isLoading && business">
|
||||
<!-- Hero Section -->
|
||||
<div class="hero-section">
|
||||
<img :src="getImageUrl(business.image_url)" alt="Business Image" class="hero-image" />
|
||||
<div class="hero-overlay"></div>
|
||||
|
||||
<button class="back-floating" @click="goBack">
|
||||
<div class="bdv" v-if="!isLoading && business">
|
||||
|
||||
<!-- Hero -->
|
||||
<section class="hero">
|
||||
<img :src="getImageUrl(business.image_url)" alt="" class="hero__img" />
|
||||
<div class="hero__scrim"></div>
|
||||
|
||||
<button class="hero__back" @click="goBack" aria-label="Volver">
|
||||
<span class="material-icons">arrow_back</span>
|
||||
</button>
|
||||
|
||||
<div class="fav-floating">
|
||||
<FavoriteButton
|
||||
item-type="business"
|
||||
:item-id="business.id"
|
||||
<div class="hero__fav">
|
||||
<FavoriteButton
|
||||
item-type="business"
|
||||
:item-id="business.id"
|
||||
:item-name="business.name"
|
||||
:item-image="business.image_url || undefined"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="hero-content">
|
||||
<div class="category-badge premium-font">{{ business.category }}</div>
|
||||
<h1 class="business-name premium-font">{{ business.name }}</h1>
|
||||
<div class="area-tag">
|
||||
<div class="hero__body">
|
||||
<span class="hero__cat">{{ business.category }}</span>
|
||||
<h1 class="hero__name">{{ business.name }}</h1>
|
||||
<p class="hero__area">
|
||||
<span class="material-icons">location_on</span>
|
||||
{{ business.area }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Details Content -->
|
||||
<div class="details-container">
|
||||
<div class="premium-story">
|
||||
<h2 class="premium-font">{{ business.description ? t('business.aboutUs') : t('business.detailsTitle') }}</h2>
|
||||
<p>"{{ business.description || t('business.detailsDescription') }}"</p>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Highlights Grid (Inspired by the frame) -->
|
||||
<div class="highlights-grid">
|
||||
<div class="highlight-item">
|
||||
<div class="highlight-header">
|
||||
<h3 class="premium-font">{{ t('business.timelessHeritage') }}</h3>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<p>{{ t('business.timelessHeritageDesc') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="highlight-item">
|
||||
<div class="highlight-header">
|
||||
<h3 class="premium-font">{{ t('business.worldClassDishes') }}</h3>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<p>{{ t('business.worldClassDishesDesc') }}</p>
|
||||
</div>
|
||||
<div class="hero__rule"></div>
|
||||
</section>
|
||||
|
||||
<div class="highlight-item">
|
||||
<div class="highlight-header">
|
||||
<h3 class="premium-font">{{ t('business.emotionElegance') }}</h3>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<p>{{ t('business.emotionEleganceDesc') }}</p>
|
||||
</div>
|
||||
<!-- Content -->
|
||||
<main class="content">
|
||||
|
||||
<div class="highlight-item">
|
||||
<div class="highlight-header">
|
||||
<h3 class="premium-font">{{ t('business.unmatchedExperience') }}</h3>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<p>{{ t('business.unmatchedExperienceDesc') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Description -->
|
||||
<section class="section section--center">
|
||||
<p class="eyebrow">{{ business.description ? t('business.aboutUs') : t('business.detailsTitle') }}</p>
|
||||
<blockquote class="quote">
|
||||
{{ business.description || t('business.detailsDescription') }}
|
||||
</blockquote>
|
||||
</section>
|
||||
|
||||
<!-- Info Section -->
|
||||
<div class="info-sections">
|
||||
<div class="info-card">
|
||||
<span class="material-icons">map</span>
|
||||
<div class="info-text">
|
||||
<h4>{{ t('business.address') }}</h4>
|
||||
<p>{{ business.address }}</p>
|
||||
<button v-if="business.latitude || business.address" class="track-directions-btn" @click="openDirections">
|
||||
<span class="material-icons">directions</span>
|
||||
{{ t('business.getDirections') || 'Cómo llegar' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info-card">
|
||||
<span class="material-icons">phone</span>
|
||||
<div class="info-text">
|
||||
<h4>{{ t('business.contact') }}</h4>
|
||||
<p>{{ business.phone || t('common.notAvailable') }}</p>
|
||||
</div>
|
||||
<!-- Highlights -->
|
||||
<section class="section">
|
||||
<div class="highlights">
|
||||
<article class="hl" v-for="(item, i) in [
|
||||
{ title: t('business.timelessHeritage'), desc: t('business.timelessHeritageDesc') },
|
||||
{ title: t('business.worldClassDishes'), desc: t('business.worldClassDishesDesc') },
|
||||
{ title: t('business.emotionElegance'), desc: t('business.emotionEleganceDesc') },
|
||||
{ title: t('business.unmatchedExperience'), desc: t('business.unmatchedExperienceDesc') },
|
||||
]" :key="i">
|
||||
<span class="hl__num">{{ String(i + 1).padStart(2, '0') }}</span>
|
||||
<h3 class="hl__title">{{ item.title }}</h3>
|
||||
<p class="hl__desc">{{ item.desc }}</p>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div v-if="business.website" class="info-card">
|
||||
<span class="material-icons">public</span>
|
||||
<div class="info-text">
|
||||
<h4>Página Web</h4>
|
||||
<a :href="business.website" target="_blank" class="website-link">{{ business.website }}</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Info Cards -->
|
||||
<section class="section">
|
||||
<p class="eyebrow">{{ t('business.contact') }}</p>
|
||||
<div class="info-grid">
|
||||
|
||||
<div v-if="business.social_media" class="info-card">
|
||||
<span class="material-icons">language</span>
|
||||
<div class="info-text">
|
||||
<h4>{{ t('business.socialMedia') }}</h4>
|
||||
<p>{{ business.social_media }}</p>
|
||||
<div class="info-tile">
|
||||
<div class="info-tile__icon"><span class="material-icons">map</span></div>
|
||||
<div class="info-tile__body">
|
||||
<h4 class="info-tile__label">{{ t('business.address') }}</h4>
|
||||
<p class="info-tile__value">{{ business.address }}</p>
|
||||
<button v-if="business.latitude || business.address" class="btn-directions" @click="openDirections">
|
||||
<span class="material-icons">near_me</span>
|
||||
{{ t('business.getDirections') || 'Cómo llegar' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Offers Section -->
|
||||
<div v-if="coupons.length > 0" class="offers-section">
|
||||
<h2 class="section-title premium-font">{{ t('business.availableOffers') }}</h2>
|
||||
<div class="coupons-grid">
|
||||
<div v-for="coupon in coupons" :key="coupon.id" class="coupon-card-detail">
|
||||
<div class="coupon-header-flex">
|
||||
<div class="coupon-discount">{{ coupon.discount_percentage }}% OFF</div>
|
||||
<FavoriteButton
|
||||
item-type="coupon"
|
||||
:item-id="coupon.id"
|
||||
<div class="info-tile">
|
||||
<div class="info-tile__icon"><span class="material-icons">phone</span></div>
|
||||
<div class="info-tile__body">
|
||||
<h4 class="info-tile__label">{{ t('business.contact') }}</h4>
|
||||
<p class="info-tile__value">{{ business.phone || t('common.notAvailable') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="business.website" class="info-tile">
|
||||
<div class="info-tile__icon"><span class="material-icons">public</span></div>
|
||||
<div class="info-tile__body">
|
||||
<h4 class="info-tile__label">Página Web</h4>
|
||||
<a :href="business.website" target="_blank" class="info-tile__link">{{ business.website }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="business.social_media" class="info-tile">
|
||||
<div class="info-tile__icon"><span class="material-icons">tag</span></div>
|
||||
<div class="info-tile__body">
|
||||
<h4 class="info-tile__label">{{ t('business.socialMedia') }}</h4>
|
||||
<p class="info-tile__value">{{ business.social_media }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Coupons -->
|
||||
<section v-if="coupons.length > 0" class="section section--offers">
|
||||
<p class="eyebrow">{{ t('business.availableOffers') }}</p>
|
||||
<div class="coupons">
|
||||
<div v-for="coupon in coupons" :key="coupon.id" class="coupon">
|
||||
<div class="coupon__top">
|
||||
<span class="coupon__pct">{{ coupon.discount_percentage }}<sup>%</sup></span>
|
||||
<FavoriteButton
|
||||
item-type="coupon"
|
||||
:item-id="coupon.id"
|
||||
:item-name="coupon.title"
|
||||
:item-image="coupon.image_url || undefined"
|
||||
/>
|
||||
</div>
|
||||
<div class="coupon-info">
|
||||
<h3>{{ coupon.title }}</h3>
|
||||
<p>{{ coupon.description }}</p>
|
||||
</div>
|
||||
<div class="coupon__divider"></div>
|
||||
<h3 class="coupon__title">{{ coupon.title }}</h3>
|
||||
<p class="coupon__desc">{{ coupon.description }}</p>
|
||||
<span class="coupon__tag">OFF</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div v-else-if="isLoading" class="loading-full">
|
||||
<div class="loader"></div>
|
||||
<p>{{ t('business.loadingPremium') }}</p>
|
||||
<!-- Loading -->
|
||||
<div v-else-if="isLoading" class="state-full">
|
||||
<div class="spinner"></div>
|
||||
<p class="state-full__msg">{{ t('business.loadingPremium') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Error -->
|
||||
<div v-else-if="fetchError" class="state-full">
|
||||
<span class="material-icons state-full__icon">wifi_off</span>
|
||||
<h3 class="state-full__title">{{ t('common.error') || 'Sin conexión' }}</h3>
|
||||
<p class="state-full__sub">No pudimos cargar los datos. Revisa tu internet e intenta de nuevo.</p>
|
||||
<button class="btn-retry" @click="fetchData">
|
||||
<span class="material-icons">refresh</span>
|
||||
{{ t('common.retry') || 'Reintentar' }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&display=swap');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');
|
||||
|
||||
.business-details-view {
|
||||
:root {
|
||||
--serif: 'Cormorant Garamond', Georgia, serif;
|
||||
--sans: 'DM Sans', system-ui, sans-serif;
|
||||
}
|
||||
|
||||
.bdv {
|
||||
min-height: 100vh;
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
padding-bottom: 60px;
|
||||
font-family: var(--sans);
|
||||
padding-bottom: 80px;
|
||||
}
|
||||
|
||||
.premium-font {
|
||||
font-family: 'Playfair Display', serif;
|
||||
}
|
||||
|
||||
/* Hero Section */
|
||||
.hero-section {
|
||||
/* ── Hero ── */
|
||||
.hero {
|
||||
position: relative;
|
||||
height: 60vh;
|
||||
width: 100%;
|
||||
height: 65vh;
|
||||
min-height: 420px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hero-image {
|
||||
.hero__img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transform: scale(1.04);
|
||||
transition: transform 8s ease;
|
||||
}
|
||||
|
||||
.hero-overlay {
|
||||
.hero:hover .hero__img { transform: scale(1); }
|
||||
|
||||
.hero__scrim {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.8) 100%);
|
||||
inset: 0;
|
||||
background: linear-gradient(160deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.30) 40%, rgba(0,0,0,0.82) 100%);
|
||||
}
|
||||
|
||||
.back-floating {
|
||||
.hero__back,
|
||||
.hero__fav {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
background: rgba(255,255,255,0.2);
|
||||
backdrop-filter: blur(10px);
|
||||
border: none;
|
||||
top: 24px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.hero__back {
|
||||
left: 24px;
|
||||
background: rgba(255,255,255,0.12);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
border: 1px solid rgba(255,255,255,0.22);
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
z-index: 10;
|
||||
transition: background 0.2s, transform 0.2s;
|
||||
}
|
||||
|
||||
.fav-floating {
|
||||
.hero__back:hover {
|
||||
background: rgba(255,255,255,0.25);
|
||||
transform: translateX(-2px);
|
||||
}
|
||||
|
||||
.hero__fav { right: 24px; }
|
||||
|
||||
.hero__body {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
z-index: 10;
|
||||
bottom: 52px;
|
||||
left: 48px;
|
||||
right: 48px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.coupon-header-flex {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.hero-content {
|
||||
position: absolute;
|
||||
bottom: 40px;
|
||||
left: 40px;
|
||||
right: 40px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.category-badge {
|
||||
background: var(--active-color);
|
||||
color: white;
|
||||
padding: 6px 16px;
|
||||
border-radius: 100px;
|
||||
.hero__cat {
|
||||
display: inline-block;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 16px;
|
||||
font-family: var(--sans);
|
||||
font-size: 0.7rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.18em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
color: var(--active-color);
|
||||
background: rgba(0,0,0,0.35);
|
||||
backdrop-filter: blur(8px);
|
||||
border: 1px solid rgba(254,231,21,0.4);
|
||||
padding: 5px 14px;
|
||||
border-radius: 100px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.business-name {
|
||||
font-size: 3.5rem;
|
||||
margin: 0 0 12px 0;
|
||||
line-height: 1.1;
|
||||
.hero__name {
|
||||
font-family: var(--serif);
|
||||
font-size: clamp(2.4rem, 5vw, 4rem);
|
||||
font-weight: 300;
|
||||
line-height: 1.08;
|
||||
margin: 0 0 14px;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.area-tag {
|
||||
.hero__area {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 1.2rem;
|
||||
opacity: 0.9;
|
||||
gap: 6px;
|
||||
font-size: 0.95rem;
|
||||
opacity: 0.78;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Content */
|
||||
.details-container {
|
||||
max-width: 1000px;
|
||||
margin: -60px auto 0;
|
||||
position: relative;
|
||||
background: var(--bg-primary);
|
||||
border-top: 1px solid var(--border-color);
|
||||
border-radius: 40px 40px 0 0;
|
||||
padding: 60px 40px;
|
||||
box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
|
||||
.hero__area .material-icons { font-size: 1rem; }
|
||||
|
||||
.hero__rule {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
background: linear-gradient(90deg, transparent, var(--active-color) 40%, transparent);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.premium-story {
|
||||
text-align: center;
|
||||
max-width: 700px;
|
||||
margin: 0 auto 60px;
|
||||
/* ── Content ── */
|
||||
.content {
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
padding: 0 32px;
|
||||
}
|
||||
|
||||
.premium-story h2 {
|
||||
font-size: 2.2rem;
|
||||
margin-bottom: 24px;
|
||||
color: var(--text-primary);
|
||||
.section {
|
||||
padding: 72px 0;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.premium-story p {
|
||||
font-size: 1.2rem;
|
||||
.section:last-child { border-bottom: none; }
|
||||
.section--center { text-align: center; }
|
||||
|
||||
.eyebrow {
|
||||
font-family: var(--sans);
|
||||
font-size: 0.68rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
color: var(--active-color);
|
||||
margin: 0 0 28px;
|
||||
}
|
||||
|
||||
.quote {
|
||||
font-family: var(--serif);
|
||||
font-size: clamp(1.3rem, 2.5vw, 1.7rem);
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
color: var(--text-primary);
|
||||
margin: 0 auto;
|
||||
max-width: 680px;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Highlights Grid */
|
||||
.highlights-grid {
|
||||
/* ── Highlights ── */
|
||||
.highlights {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 40px;
|
||||
margin-bottom: 80px;
|
||||
}
|
||||
|
||||
.highlight-item {
|
||||
padding: 20px;
|
||||
.hl {
|
||||
padding: 36px 40px 36px 0;
|
||||
border-right: 1px solid var(--border-color);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.highlight-header {
|
||||
margin-bottom: 16px;
|
||||
.hl:nth-child(2n) {
|
||||
padding: 36px 0 36px 40px;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.highlight-header h3 {
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 8px;
|
||||
.hl:nth-child(n+3) { border-bottom: none; }
|
||||
|
||||
.hl__num {
|
||||
display: block;
|
||||
font-family: var(--serif);
|
||||
font-size: 2.8rem;
|
||||
font-weight: 300;
|
||||
color: var(--active-color);
|
||||
opacity: 0.4;
|
||||
line-height: 1;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
width: 40px;
|
||||
height: 3px;
|
||||
background: var(--active-color);
|
||||
border-radius: 2px;
|
||||
.hl__title {
|
||||
font-family: var(--serif);
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
.highlight-item p {
|
||||
.hl__desc {
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.65;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Info Cards */
|
||||
.info-sections {
|
||||
/* ── Info Grid ── */
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 80px;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
background: var(--bg-secondary);
|
||||
padding: 24px;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.info-card .material-icons {
|
||||
color: var(--active-color);
|
||||
font-size: 1.8rem;
|
||||
background: var(--active-bg);
|
||||
padding: 10px;
|
||||
border-radius: 12px;
|
||||
.info-tile {
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
align-items: flex-start;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 16px;
|
||||
padding: 22px 24px;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.info-text h4 {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 0.9rem;
|
||||
.info-tile:hover {
|
||||
border-color: var(--active-color);
|
||||
box-shadow: 0 0 0 1px var(--active-color);
|
||||
}
|
||||
|
||||
.info-tile__icon {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
border-radius: 10px;
|
||||
background: var(--active-bg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info-tile__icon .material-icons {
|
||||
font-size: 1.25rem;
|
||||
color: var(--active-color);
|
||||
}
|
||||
|
||||
.info-tile__label {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.16em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-secondary);
|
||||
letter-spacing: 1px;
|
||||
margin: 0 0 5px;
|
||||
}
|
||||
|
||||
.info-text p {
|
||||
.info-tile__value {
|
||||
font-size: 0.97rem;
|
||||
font-weight: 500;
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.track-directions-btn {
|
||||
.info-tile__link {
|
||||
font-size: 0.97rem;
|
||||
font-weight: 500;
|
||||
color: var(--active-color);
|
||||
text-decoration: none;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.info-tile__link:hover { text-decoration: underline; }
|
||||
|
||||
.btn-directions {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 12px;
|
||||
padding: 8px 16px;
|
||||
background: var(--active-color);
|
||||
color: #101820;
|
||||
border: none;
|
||||
padding: 10px 18px;
|
||||
border-radius: 12px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
margin-top: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.track-directions-btn:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(254, 231, 21, 0.3);
|
||||
filter: brightness(1.1);
|
||||
}
|
||||
|
||||
.website-link {
|
||||
color: var(--active-color);
|
||||
text-decoration: none;
|
||||
border-radius: 8px;
|
||||
font-family: var(--sans);
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
font-size: 1.1rem;
|
||||
transition: opacity 0.2s;
|
||||
cursor: pointer;
|
||||
transition: filter 0.2s, transform 0.2s;
|
||||
}
|
||||
|
||||
.website-link:hover {
|
||||
opacity: 0.8;
|
||||
text-decoration: underline;
|
||||
.btn-directions .material-icons { font-size: 1rem; }
|
||||
|
||||
.btn-directions:hover {
|
||||
filter: brightness(1.1);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* Offers Section */
|
||||
.offers-section {
|
||||
border-top: 1px solid var(--border-color);
|
||||
padding-top: 60px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.coupons-grid {
|
||||
/* ── Coupons ── */
|
||||
.coupons {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 24px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.coupon-card-detail {
|
||||
background: var(--card-bg);
|
||||
border: 2px dashed var(--active-color);
|
||||
padding: 24px;
|
||||
border-radius: 16px;
|
||||
.coupon {
|
||||
position: relative;
|
||||
background: var(--card-bg, var(--bg-secondary));
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 18px;
|
||||
padding: 28px;
|
||||
overflow: hidden;
|
||||
transition: transform 0.22s, box-shadow 0.22s;
|
||||
}
|
||||
|
||||
.coupon::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0; left: 0; right: 0;
|
||||
height: 3px;
|
||||
background: var(--active-color);
|
||||
}
|
||||
|
||||
.coupon:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 12px 32px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
.coupon__top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.coupon-discount {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 900;
|
||||
.coupon__pct {
|
||||
font-family: var(--serif);
|
||||
font-size: 3.2rem;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
color: var(--active-color);
|
||||
}
|
||||
|
||||
.coupon-info h3 {
|
||||
margin: 0 0 8px 0;
|
||||
.coupon__pct sup {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.coupon__divider {
|
||||
height: 1px;
|
||||
background: var(--border-color);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.coupon__title {
|
||||
font-family: var(--serif);
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.coupon-info p {
|
||||
margin: 0;
|
||||
.coupon__desc {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.55;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.95rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Loader */
|
||||
.loading-full {
|
||||
height: 100vh;
|
||||
.coupon__tag {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
font-size: 0.6rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.18em;
|
||||
color: var(--active-color);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* ── States ── */
|
||||
.state-full {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
gap: 16px;
|
||||
padding: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.loader {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 3px solid var(--bg-secondary);
|
||||
.spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 2px solid var(--border-color);
|
||||
border-top-color: var(--active-color);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s infinite linear;
|
||||
animation: spin 0.75s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.state-full__icon {
|
||||
font-size: 2.8rem;
|
||||
color: var(--text-secondary);
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
.state-full__title {
|
||||
font-family: var(--serif);
|
||||
font-size: 1.5rem;
|
||||
font-weight: 400;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.state-full__sub {
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-secondary);
|
||||
max-width: 340px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.btn-retry {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
padding: 12px 24px;
|
||||
background: var(--active-color);
|
||||
color: #101820;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-family: var(--sans);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: filter 0.2s;
|
||||
}
|
||||
|
||||
.btn-retry:hover { filter: brightness(1.1); }
|
||||
|
||||
/* ── Responsive ── */
|
||||
@media (max-width: 768px) {
|
||||
.hero-section { height: 50vh; }
|
||||
.business-name { font-size: 2.5rem; }
|
||||
.highlights-grid { grid-template-columns: 1fr; }
|
||||
.details-container { padding: 40px 20px; }
|
||||
.hero-content { left: 20px; bottom: 30px; }
|
||||
.hero { height: 55vh; }
|
||||
.hero__body { left: 24px; right: 24px; bottom: 40px; }
|
||||
.hero__name { font-size: 2.2rem; }
|
||||
.content { padding: 0 20px; }
|
||||
.section { padding: 52px 0; }
|
||||
|
||||
.highlights { grid-template-columns: 1fr; }
|
||||
.hl,
|
||||
.hl:nth-child(2n) {
|
||||
padding: 28px 0;
|
||||
border-right: none;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
.hl:last-child { border-bottom: none; }
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.hero__back { left: 16px; top: 16px; }
|
||||
.hero__fav { right: 16px; top: 16px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ async function animateAndReload() {
|
||||
isBannerClosing.value = true;
|
||||
|
||||
// 🔥 CRÍTICO
|
||||
routeStore.wasSelectedFromMap = false;
|
||||
routeStore.setWasSelectedFromMap(false);
|
||||
|
||||
clearMapMarkers();
|
||||
limpiarCaminata();
|
||||
@ -160,14 +160,26 @@ onMounted(async () => {
|
||||
unitFetchInterval.value = setInterval(updateActiveUnits, 15000);
|
||||
updateActiveUnits();
|
||||
startCarousel();
|
||||
|
||||
// 🛰️ RESIZE FIX: Trigger map resize when app becomes visible again
|
||||
document.addEventListener('visibilitychange', handleVisibilityChange);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (unitFetchInterval.value) clearInterval(unitFetchInterval.value);
|
||||
if (carouselTimer.value) clearInterval(carouselTimer.value);
|
||||
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
||||
// NOTA: No llamamos a clearMapMarkers() para mantener la ruta si el usuario vuelve
|
||||
});
|
||||
|
||||
function handleVisibilityChange() {
|
||||
if (document.visibilityState === 'visible' && map.value) {
|
||||
console.log('SIBU | App visible, redimensionando mapa...');
|
||||
google.maps.event.trigger(map.value, 'resize');
|
||||
updateActiveUnits();
|
||||
}
|
||||
}
|
||||
|
||||
async function initializeMap() {
|
||||
await nextTick();
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
@ -330,7 +342,7 @@ function selectRouteAndClose(route: any) {
|
||||
}
|
||||
|
||||
showUberSearch.value = false;
|
||||
routeStore.wasSelectedFromMap = true;
|
||||
routeStore.setWasSelectedFromMap(true);
|
||||
routeStore.selectRoute(route.id, route.name);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import { analyticsService } from '@/services/analyticsService'
|
||||
import type { Taxi } from '@/types'
|
||||
import FavoriteButton from '@/components/FavoriteButton.vue'
|
||||
import { getImageUrl } from '@/utils/imageUrl'
|
||||
import AuthGuard from '@/components/common/AuthGuard.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
const taxiStore = useTaxiStore()
|
||||
@ -117,8 +118,12 @@ function getShiftLabel(shift: string) {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else class="taxis-grid">
|
||||
<div v-for="taxi in filteredTaxis" :key="taxi.id" v-memo="[taxi.id]" class="taxi-card-new glass-effect">
|
||||
<AuthGuard
|
||||
:title="t('discover.auth.title')"
|
||||
:message="t('shuttle.auth.message')"
|
||||
>
|
||||
<div class="taxis-grid">
|
||||
<div v-for="taxi in filteredTaxis" :key="taxi.id" v-memo="[taxi.id]" class="taxi-card-new glass-effect">
|
||||
<div class="card-top">
|
||||
<div class="driver-avatar-wrap">
|
||||
<div class="driver-avatar">
|
||||
@ -186,7 +191,8 @@ function getShiftLabel(shift: string) {
|
||||
<span class="material-icons">no_accounts</span>
|
||||
<p>{{ t('taxi.noTaxisAvailable') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AuthGuard>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user