feat: redesign transport section with improved UX, accessibility, and type safety

- Replace native <select> filters with scrollable chip components (TransportFilterChips)
- Add skeleton shimmer loaders for taxi and shuttle cards (TaxiSkeletonCard, ShuttleSkeletonCard)
- Add search bar to TaxisLocales to filter by driver name
- Horizontal card layout on mobile for ViajesTuristicos, vertical on tablet+
- Add ARIA roles (tablist/tab, list/listitem, switch, alert, status) throughout
- Apply hover: hover media query so card hover effects don't trigger on touch
- Add prefers-reduced-motion support across all animations and transitions
- Add clear-filters button in empty states when filters are active
- Fix min-height to use 100dvh instead of 100vh for mobile nav bar
- Reduce tab slider animation from 0.5s to 0.32s
- Fix tsconfig: noUncheckedSideEffectImports false, add vite-plugin-pwa/client types
- Fix AppImage unused parameter warning (_e)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 17:48:23 -05:00
parent fefaf30f38
commit 5c1b62f55a
9 changed files with 1392 additions and 532 deletions

View File

@ -6,7 +6,8 @@ import { useShuttleStore } from '@/stores/shuttle'
import AuthGuard from '@/components/common/AuthGuard.vue'
import AppImage from '@/components/AppImage.vue'
import { analyticsService } from '@/services/analyticsService'
import LoadingBranded from '@/components/common/LoadingBranded.vue'
import ShuttleSkeletonCard from '@/components/transporte/ShuttleSkeletonCard.vue'
import TransportFilterChips from '@/components/transporte/TransportFilterChips.vue'
const { t } = useI18n()
const shuttleStore = useShuttleStore()
@ -15,6 +16,19 @@ const router = useRouter()
const shuttleCategoryFilter = ref('all')
const shuttleTypeFilter = ref('all')
const categoryOptions = computed(() => [
{ value: 'all', label: t('shuttle.allAreas') || 'Todas', icon: 'grid_view' },
{ value: 'local', label: t('shuttle.local') || 'Local', icon: 'place' },
{ value: 'interprovincial', label: t('shuttle.interprovincial') || 'Interprovincial', icon: 'route' },
])
const typeOptions = computed(() => [
{ value: 'all', label: t('common.all'), icon: 'swap_horiz' },
{ value: 'one_way', label: t('shuttle.oneWay'), icon: 'arrow_forward' },
{ value: 'round_trip', label: t('shuttle.roundTrip'), icon: 'sync_alt' },
{ value: 'both', label: t('shuttle.both'), icon: 'directions' },
])
const filteredShuttles = computed(() => {
return shuttleStore.shuttles.filter(shuttle => {
const matchesCategory = shuttleCategoryFilter.value === 'all' || shuttle.category === shuttleCategoryFilter.value
@ -23,152 +37,153 @@ const filteredShuttles = computed(() => {
})
})
const hasActiveFilters = computed(() =>
shuttleCategoryFilter.value !== 'all' || shuttleTypeFilter.value !== 'all'
)
function clearFilters() {
shuttleCategoryFilter.value = 'all'
shuttleTypeFilter.value = 'all'
}
const verDetalle = (shuttleId: string, shuttleName: string) => {
analyticsService.logEvent({
event_name: 'view_details',
entity_type: 'shuttle',
entity_id: shuttleId,
entity_name: shuttleName
})
router.push({
name: 'ShuttleDetalle',
params: { id: shuttleId }
})
analyticsService.logEvent({
event_name: 'view_details',
entity_type: 'shuttle',
entity_id: shuttleId,
entity_name: shuttleName
})
router.push({ name: 'ShuttleDetalle', params: { id: shuttleId } })
}
function fetchData() {
shuttleStore.loadShuttles()
shuttleStore.loadShuttles()
}
function handleRefocus() {
// Recarga silenciosa: no congela la UI si ya hay datos
shuttleStore.silentReload()
shuttleStore.silentReload()
}
onMounted(async () => {
analyticsService.logEvent({ event_name: 'screen_view', screen_name: 'ViajesTuristicos' })
window.addEventListener('app-refocus', handleRefocus)
if(shuttleStore.shuttles.length === 0) {
await fetchData()
}
analyticsService.logEvent({ event_name: 'screen_view', screen_name: 'ViajesTuristicos' })
window.addEventListener('app-refocus', handleRefocus)
if (shuttleStore.shuttles.length === 0) {
await fetchData()
}
})
onUnmounted(() => {
window.removeEventListener('app-refocus', handleRefocus)
window.removeEventListener('app-refocus', handleRefocus)
})
</script>
<template>
<div class="viajes-turisticos">
<!-- FILTROS PREMIUM -->
<div class="filters-container">
<div class="filter-card glass-effect">
<div class="selectors-side">
<!-- Ruta Select -->
<div class="select-group-premium">
<div class="group-content">
<label>{{ t('shuttle.category') || 'Categoría' }}</label>
<select v-model="shuttleCategoryFilter">
<option value="all">{{ t('shuttle.allAreas') || 'Todas las áreas' }}</option>
<option value="local">Local</option>
<option value="interprovincial">Interprovincial</option>
</select>
</div>
</div>
<!-- Tipo de Viaje Select -->
<div class="select-group-premium">
<div class="group-content">
<label>{{ t('shuttle.tripType') }}</label>
<select v-model="shuttleTypeFilter">
<option value="all">{{ t('shuttle.tripType') }}</option>
<option value="one_way">{{ t('shuttle.oneWay') }}</option>
<option value="round_trip">{{ t('shuttle.roundTrip') }}</option>
<option value="both">{{ t('shuttle.both') }}</option>
</select>
</div>
</div>
</div>
<!-- FILTERS -->
<div class="filters-wrap">
<div class="filter-section">
<span class="filter-label">{{ t('shuttle.category') }}</span>
<TransportFilterChips
v-model="shuttleCategoryFilter"
:options="categoryOptions"
:label="t('shuttle.category')"
/>
</div>
<div class="filter-section">
<span class="filter-label">{{ t('shuttle.tripType') }}</span>
<TransportFilterChips
v-model="shuttleTypeFilter"
:options="typeOptions"
:label="t('shuttle.tripType')"
/>
</div>
</div>
<!-- ESTADOS -->
<div v-if="shuttleStore.isLoading" class="state-container">
<LoadingBranded :message="t('taxi.loadingTaxis') || 'Cargando viajes...'" icon="airport_shuttle" />
<!-- LOADING SKELETONS -->
<div v-if="shuttleStore.isLoading" class="shuttles-grid" aria-busy="true" aria-label="Cargando viajes...">
<ShuttleSkeletonCard v-for="n in 4" :key="n" />
</div>
<div v-else-if="shuttleStore.error" class="state-container">
<span class="material-icons notranslate" translate="no">error_outline</span>
<!-- ERROR -->
<div v-else-if="shuttleStore.error" class="state-container" role="alert">
<span class="material-icons notranslate state-icon state-icon--error" translate="no" aria-hidden="true">error_outline</span>
<p>{{ shuttleStore.error }}</p>
<button class="retry-btn" @click="shuttleStore.loadShuttles()">
<span class="material-icons notranslate" translate="no">refresh</span>
{{ t('common.retry') || 'Reintentar' }}
<span class="material-icons notranslate" translate="no" aria-hidden="true">refresh</span>
{{ t('common.retry') }}
</button>
</div>
<!-- GRID PREMIUM CON AUTHGUARD -->
<!-- GRID -->
<AuthGuard
v-else
:title="t('shuttle.auth.title') || 'Viajes Exclusivos'"
:message="t('shuttle.auth.message') || 'Regístrate para reservar tus viajes, ver horarios detallados y tarifas de grupo.'"
>
<div class="shuttles-grid">
<div
v-for="shuttle in filteredShuttles"
:key="shuttle.id"
<div class="shuttles-grid" role="list" :aria-label="'Viajes disponibles'">
<article
v-for="shuttle in filteredShuttles"
:key="shuttle.id"
v-memo="[shuttle.id]"
class="shuttle-card-premium glass-effect"
class="shuttle-card glass-effect"
role="listitem"
:aria-label="`${shuttle.origin} a ${shuttle.destination}${shuttle.company_name ? ', ' + shuttle.company_name : ''}`"
@click="verDetalle(shuttle.id, shuttle.company_name || `${shuttle.origin}-${shuttle.destination}`)"
@keydown.enter="verDetalle(shuttle.id, shuttle.company_name || `${shuttle.origin}-${shuttle.destination}`)"
tabindex="0"
>
<div class="card-image-wrap">
<AppImage
:src="shuttle.image_url"
<!-- Image desktop full, mobile strip -->
<div class="card-image-wrap" aria-hidden="true">
<AppImage
:src="shuttle.image_url"
type="shuttle"
imgClass="shuttle-img"
alt="Shuttle"
alt=""
/>
<div class="company-tag" v-if="shuttle.company_name">
<span class="material-icons notranslate" translate="no">business</span>
<span class="material-icons notranslate" translate="no" aria-hidden="true">business</span>
{{ shuttle.company_name }}
</div>
</div>
<div class="card-body-premium">
<div class="card-body">
<div class="route-header">
<div class="route-main">
<span class="location-name">{{ shuttle.origin }}</span>
<span class="material-icons separator-icon notranslate" translate="no">east</span>
<span class="location-name">{{ shuttle.destination }}</span>
</div>
<span class="location-name">{{ shuttle.origin }}</span>
<span class="material-icons separator-icon notranslate" translate="no" aria-hidden="true">east</span>
<span class="location-name">{{ shuttle.destination }}</span>
</div>
<div class="card-meta">
<div class="meta-tag">
<span class="material-icons notranslate" translate="no">directions_bus</span>
<span class="material-icons notranslate" translate="no" aria-hidden="true">directions_bus</span>
<span>{{ shuttle.vehicle_type }}</span>
</div>
<div class="meta-tag" v-if="shuttle.estimated_duration">
<span class="material-icons notranslate" translate="no">schedule</span>
<span class="material-icons notranslate" translate="no" aria-hidden="true">schedule</span>
<span>{{ shuttle.estimated_duration }}</span>
</div>
</div>
<div class="card-footer-premium">
<div class="card-footer">
<div class="price-container">
<span class="price-label">{{ t('shuttle.from') || 'Desde' }}</span>
<span class="price-val">${{ shuttle.price_per_person }}</span>
<span class="price-val" :aria-label="`Precio desde $${shuttle.price_per_person}`">${{ shuttle.price_per_person }}</span>
</div>
<button class="view-details-btn">
<div class="view-details-btn" aria-hidden="true">
<span class="material-icons notranslate" translate="no">chevron_right</span>
</button>
</div>
</div>
</div>
</div>
</article>
<!-- EMPTY STATE -->
<div v-if="filteredShuttles.length === 0" class="empty-state">
<span class="material-icons notranslate" translate="no">directions_bus_filled</span>
<p>{{ t('shuttle.noShuttles') }}</p>
<div v-if="filteredShuttles.length === 0" class="empty-state" role="status">
<span class="material-icons notranslate empty-icon" translate="no" aria-hidden="true">directions_bus_filled</span>
<p class="empty-title">{{ t('shuttle.noShuttles') }}</p>
<button v-if="hasActiveFilters" class="clear-filters-btn" @click="clearFilters">
<span class="material-icons notranslate" translate="no" aria-hidden="true">filter_alt_off</span>
{{ t('common.clear') }}
</button>
</div>
</div>
</AuthGuard>
@ -180,93 +195,104 @@ onUnmounted(() => {
padding-bottom: 2rem;
}
/* FILTROS CONSISTENTES */
.filters-container {
padding: 0 1rem 1.5rem;
}
.filter-card {
border-radius: 1rem;
padding: 0.75rem 1rem;
border: 1px solid var(--border-color);
background: var(--card-bg);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.selectors-side {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.5rem;
}
.select-group-premium {
display: flex;
align-items: center;
gap: 0.5rem;
background: var(--bg-primary);
border: 1px solid var(--border-color);
border-radius: 0.75rem;
padding: 0.5rem 0.75rem;
transition: all 0.3s ease;
}
.select-group-premium:focus-within {
border-color: var(--active-color);
}
.group-content {
flex: 1;
/* FILTERS */
.filters-wrap {
padding: 0 1rem 1rem;
display: flex;
flex-direction: column;
gap: 0.875rem;
}
.group-content label {
font-size: 0.65rem;
.filter-section {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.filter-label {
font-size: 0.75rem;
font-weight: 800;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--text-secondary);
margin-bottom: 0.125rem;
}
.group-content select {
background: transparent;
border: none;
color: var(--text-primary);
font-weight: 700;
font-size: 0.9375rem;
outline: none;
width: 100%;
}
/* GRID Y CARDS PREMIUM */
/* GRID — single column on mobile, 2-col on tablet, 3-col on desktop */
.shuttles-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 1.5rem;
padding: 0 1rem;
grid-template-columns: 1fr;
gap: 1rem;
padding: 0.5rem 1rem 1.5rem;
}
.shuttle-card-premium {
border-radius: 1.5rem;
@media (min-width: 640px) {
.shuttles-grid {
grid-template-columns: repeat(2, 1fr);
gap: 1.25rem;
}
}
@media (min-width: 1024px) {
.shuttles-grid {
grid-template-columns: repeat(3, 1fr);
gap: 1.5rem;
}
}
/* CARD — horizontal on mobile, vertical on tablet+ */
.shuttle-card {
border-radius: 1.25rem;
overflow: hidden;
border: 1px solid var(--border-color);
background: var(--card-bg);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
cursor: pointer;
/* Horizontal layout on mobile */
display: flex;
flex-direction: column;
flex-direction: row;
}
.shuttle-card-premium:hover {
transform: translateY(-8px);
border-color: var(--active-color);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
.shuttle-card:focus-visible {
outline: 2px solid var(--active-color);
outline-offset: 2px;
}
@media (min-width: 480px) {
/* Vertical card layout on larger screens */
.shuttle-card {
flex-direction: column;
}
}
@media (hover: hover) {
.shuttle-card:hover {
transform: translateY(-5px);
border-color: var(--active-color);
box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}
.shuttle-card:hover .view-details-btn {
background: var(--active-color);
color: #101820;
border-color: var(--active-color);
transform: rotate(-45deg);
}
}
/* Image: small strip on mobile, full-width on larger */
.card-image-wrap {
position: relative;
height: 180px;
width: 100%;
width: 100px;
min-height: 120px;
flex-shrink: 0;
}
@media (min-width: 480px) {
.card-image-wrap {
width: 100%;
min-height: unset;
height: 170px;
}
}
.shuttle-img {
@ -277,71 +303,101 @@ onUnmounted(() => {
.company-tag {
position: absolute;
top: 1rem;
left: 1rem;
top: 0.75rem;
left: 0.75rem;
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(8px);
padding: 0.375rem 0.75rem;
border-radius: 0.75rem;
padding: 0.25rem 0.625rem;
border-radius: 0.625rem;
color: #fff;
font-size: 0.75rem;
font-size: 0.7rem;
font-weight: 700;
display: flex;
align-items: center;
gap: 0.5rem;
gap: 0.375rem;
border: 1px solid rgba(255, 255, 255, 0.2);
/* Hide on mobile to save space */
display: none;
}
.card-body-premium {
padding: 1.25rem;
@media (min-width: 480px) {
.company-tag {
display: flex;
}
}
.card-body {
padding: 0.875rem;
display: flex;
flex-direction: column;
gap: 1rem;
gap: 0.625rem;
flex: 1;
min-width: 0;
}
.route-main {
@media (min-width: 480px) {
.card-body {
padding: 1.125rem;
gap: 0.875rem;
}
}
.route-header {
display: flex;
align-items: center;
gap: 0.75rem;
gap: 0.5rem;
flex-wrap: wrap;
}
.location-name {
font-size: 1.125rem;
font-size: 0.9375rem;
font-weight: 800;
color: var(--text-primary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 80px;
}
@media (min-width: 480px) {
.location-name {
font-size: 1.0625rem;
max-width: none;
}
}
.separator-icon {
color: var(--active-color);
font-size: 1.25rem;
font-size: 1.125rem;
flex-shrink: 0;
}
.card-meta {
display: flex;
gap: 1rem;
flex-wrap: wrap;
gap: 0.5rem;
}
.meta-tag {
display: flex;
align-items: center;
gap: 0.375rem;
gap: 0.25rem;
color: var(--text-secondary);
font-size: 0.875rem;
font-size: 0.75rem;
font-weight: 600;
}
.meta-tag .material-icons {
font-size: 1.125rem;
font-size: 1rem;
color: var(--active-color);
}
.card-footer-premium {
margin-top: 0.5rem;
.card-footer {
margin-top: auto;
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 1rem;
padding-top: 0.625rem;
border-top: 1px solid var(--border-color);
}
@ -351,21 +407,27 @@ onUnmounted(() => {
}
.price-label {
font-size: 0.65rem;
font-size: 0.6875rem;
font-weight: 700;
text-transform: uppercase;
color: var(--text-secondary);
}
.price-val {
font-size: 1.5rem;
font-size: 1.375rem;
font-weight: 900;
color: var(--active-color);
}
@media (min-width: 480px) {
.price-val {
font-size: 1.5rem;
}
}
.view-details-btn {
width: 44px;
height: 44px;
width: 40px;
height: 40px;
border-radius: 50%;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
@ -373,17 +435,11 @@ onUnmounted(() => {
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
transition: all 0.25s ease;
flex-shrink: 0;
}
.shuttle-card-premium:hover .view-details-btn {
background: var(--active-color);
color: #101820;
border-color: var(--active-color);
transform: rotate(-45deg);
}
/* ESTADOS */
/* STATES */
.state-container {
display: flex;
flex-direction: column;
@ -393,15 +449,12 @@ onUnmounted(() => {
text-align: center;
}
.spin {
animation: spin 1s infinite linear;
.state-icon {
font-size: 3rem;
color: var(--active-color);
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
.state-icon--error {
color: #ef4444;
}
.retry-btn {
@ -415,21 +468,62 @@ onUnmounted(() => {
border-radius: 99px;
font-weight: 800;
cursor: pointer;
transition: all 0.3s ease;
transition: transform 0.15s ease;
min-height: 44px;
}
.retry-btn:active {
transform: scale(0.97);
}
.empty-state {
grid-column-start: 1;
grid-column-end: -1;
grid-column: 1 / -1;
text-align: center;
padding: 4rem 2rem;
padding: 3.5rem 2rem;
color: var(--text-secondary);
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
.empty-state .material-icons {
font-size: 4rem;
margin-bottom: 1rem;
opacity: 0.5;
.empty-icon {
font-size: 3.5rem;
opacity: 0.4;
}
.empty-title {
font-size: 1rem;
font-weight: 600;
margin: 0;
}
.clear-filters-btn {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.625rem 1.25rem;
background: var(--bg-secondary);
border: 1.5px solid var(--border-color);
border-radius: 99px;
font-weight: 700;
font-size: 0.875rem;
color: var(--text-primary);
cursor: pointer;
transition: border-color 0.18s ease;
min-height: 44px;
}
.clear-filters-btn:hover {
border-color: var(--active-color);
}
@media (prefers-reduced-motion: reduce) {
.shuttle-card,
.view-details-btn,
.retry-btn,
.clear-filters-btn {
transition: none;
}
}
</style>