feat: redesign Schedules, Discover, and Routes views with SIBU Main HUD aesthetic and Tailwind v4
This commit is contained in:
@ -1,28 +1,45 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRouteStore } from '@/stores/route'
|
||||
import { useTaxiStore } from '@/stores/taxi'
|
||||
import { analyticsService } from '@/services/analyticsService'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import FavoriteButton from '@/components/FavoriteButton.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const routeStore = useRouteStore()
|
||||
const taxiStore = useTaxiStore()
|
||||
|
||||
const activeTab = ref<'routes' | 'taxis'>('routes')
|
||||
const originSearch = ref('')
|
||||
const destinationSearch = ref('')
|
||||
const selectedCorregimiento = ref('')
|
||||
const englishOnly = ref(false)
|
||||
|
||||
onMounted(async () => {
|
||||
analyticsService.logEvent({ event_name: 'screen_view', screen_name: 'Routes' })
|
||||
await routeStore.loadRoutes()
|
||||
analyticsService.logEvent({ event_name: 'screen_view', screen_name: 'Transport' })
|
||||
await Promise.all([
|
||||
routeStore.loadRoutes(),
|
||||
taxiStore.loadTaxis()
|
||||
])
|
||||
})
|
||||
|
||||
const handleSearch = async () => {
|
||||
const handleBusSearch = async () => {
|
||||
await routeStore.loadRoutes({
|
||||
originCity: originSearch.value,
|
||||
destinationCity: destinationSearch.value
|
||||
})
|
||||
}
|
||||
|
||||
const handleTaxiFilter = async () => {
|
||||
await taxiStore.loadTaxis({
|
||||
corregimiento: selectedCorregimiento.value || undefined,
|
||||
english_speaking: englishOnly.value || undefined
|
||||
})
|
||||
}
|
||||
|
||||
const goToSchedules = (route: any) => {
|
||||
analyticsService.logEvent({
|
||||
event_name: 'route_selected',
|
||||
@ -30,259 +47,239 @@ const goToSchedules = (route: any) => {
|
||||
properties: { route_id: route.id }
|
||||
})
|
||||
routeStore.selectRoute(route.id, route.name)
|
||||
router.push('/schedules')
|
||||
router.push({ path: '/schedules', query: { routeId: route.id } })
|
||||
}
|
||||
|
||||
const callTaxi = (phoneNumber: string) => {
|
||||
window.open(`tel:${phoneNumber}`)
|
||||
}
|
||||
|
||||
const correlimientos = computed(() => {
|
||||
const set = new Set(taxiStore.taxis.map(t => t.corregimiento).filter(Boolean))
|
||||
return Array.from(set).sort()
|
||||
})
|
||||
|
||||
const getStatusClass = (status: string) => {
|
||||
if (status === 'active') return 'bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-400'
|
||||
return 'bg-slate-100 dark:bg-zinc-800 text-slate-500 dark:text-zinc-400'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="routes-view">
|
||||
<div class="header">
|
||||
<h1>Búsqueda de Rutas</h1>
|
||||
<p>Encuentra tu próximo viaje fácilmente</p>
|
||||
</div>
|
||||
|
||||
<div class="search-box">
|
||||
<div class="input-group">
|
||||
<span class="material-icons">location_on</span>
|
||||
<input
|
||||
v-model="originSearch"
|
||||
placeholder="Origen (Ciudad)"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
</div>
|
||||
<div class="divider">
|
||||
<span class="material-icons">swap_vert</span>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<span class="material-icons">flag</span>
|
||||
<input
|
||||
v-model="destinationSearch"
|
||||
placeholder="Destino (Ciudad)"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
</div>
|
||||
<button @click="handleSearch" class="search-btn">
|
||||
<span class="material-icons">search</span>
|
||||
Buscar Rutas
|
||||
<div class="transport-view bg-white dark:bg-background-dark min-h-screen text-slate-900 dark:text-white pb-32">
|
||||
<!-- Header -->
|
||||
<div class="px-6 pt-12 pb-4 flex items-center justify-between sticky top-0 z-50 bg-white/80 dark:bg-background-dark/80 backdrop-blur-md">
|
||||
<button @click="router.back()" class="size-10 flex items-center justify-center rounded-full bg-slate-100 dark:bg-card-dark text-slate-600 dark:text-gray-300 active:scale-95 transition-transform">
|
||||
<span class="material-icons text-[20px]">arrow_back</span>
|
||||
</button>
|
||||
<h1 class="text-xl font-extrabold tracking-tight text-primary uppercase italic">SIBU</h1>
|
||||
<div class="size-10"></div>
|
||||
</div>
|
||||
|
||||
<div v-if="routeStore.isLoadingRoutes" class="loading">
|
||||
<div class="spinner"></div>
|
||||
<p>Buscando mejores rutas...</p>
|
||||
</div>
|
||||
<div class="px-6 py-2 space-y-6">
|
||||
<!-- Tabs Selector -->
|
||||
<div class="bg-slate-50 dark:bg-card-dark rounded-[2.5rem] p-1.5 flex shadow-inner border border-slate-200 dark:border-white/5">
|
||||
<button
|
||||
@click="activeTab = 'routes'"
|
||||
class="flex-1 py-3 px-4 rounded-[2rem] flex items-center justify-center gap-2 text-sm font-bold transition-all"
|
||||
:class="activeTab === 'routes' ? 'bg-primary shadow-lg text-slate-900' : 'bg-transparent text-slate-500 dark:text-gray-500'"
|
||||
>
|
||||
<span class="material-icons text-lg">directions_bus</span>
|
||||
Rutas de Bus
|
||||
</button>
|
||||
<button
|
||||
@click="activeTab = 'taxis'"
|
||||
class="flex-1 py-3 px-4 rounded-[2rem] flex items-center justify-center gap-2 text-sm font-bold transition-all"
|
||||
:class="activeTab === 'taxis' ? 'bg-primary shadow-lg text-slate-900' : 'bg-transparent text-slate-500 dark:text-gray-500'"
|
||||
>
|
||||
<span class="material-icons text-lg">local_taxi</span>
|
||||
Taxis Locales
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else-if="routeStore.allRoutes.length === 0" class="no-results">
|
||||
<span class="material-icons">sentiment_dissatisfied</span>
|
||||
<p>No encontramos rutas que coincidan con tu búsqueda.</p>
|
||||
<button @click="originSearch = ''; destinationSearch = ''; handleSearch()" class="reset-btn">Ver todas las rutas</button>
|
||||
</div>
|
||||
|
||||
<div v-else class="routes-list">
|
||||
<div
|
||||
v-for="route in routeStore.allRoutes"
|
||||
:key="route.id"
|
||||
class="route-card"
|
||||
@click="goToSchedules(route)"
|
||||
>
|
||||
<div class="route-header">
|
||||
<div class="route-name">
|
||||
<span class="dot" :style="{ backgroundColor: route.color || '#fee715' }"></span>
|
||||
<h3>{{ route.name }}</h3>
|
||||
<!-- Search Panel -->
|
||||
<div class="bg-slate-50 dark:bg-card-dark rounded-[2.5rem] p-6 shadow-xl border border-slate-200 dark:border-white/10">
|
||||
<div v-if="activeTab === 'routes'" class="space-y-4">
|
||||
<div class="relative group">
|
||||
<div class="flex items-center gap-3 px-4 h-14 rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-input-dark">
|
||||
<span class="material-icons text-primary font-bold">location_on</span>
|
||||
<input
|
||||
v-model="originSearch"
|
||||
@keyup.enter="handleBusSearch"
|
||||
class="bg-transparent border-none focus:ring-0 text-sm font-semibold w-full placeholder:text-slate-400 dark:placeholder:text-gray-500"
|
||||
placeholder="Ciudad de Origen"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="route-actions">
|
||||
<FavoriteButton
|
||||
item-type="route"
|
||||
:item-id="route.id"
|
||||
:item-name="route.name"
|
||||
/>
|
||||
<span class="material-icons chevron">chevron_right</span>
|
||||
<div class="relative group">
|
||||
<div class="flex items-center gap-3 px-4 h-14 rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-input-dark">
|
||||
<span class="material-icons text-primary font-bold">flag</span>
|
||||
<input
|
||||
v-model="destinationSearch"
|
||||
@keyup.enter="handleBusSearch"
|
||||
class="bg-transparent border-none focus:ring-0 text-sm font-semibold w-full placeholder:text-slate-400 dark:placeholder:text-gray-500"
|
||||
placeholder="Ciudad de Destino"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<button @click="handleBusSearch" class="w-full bg-primary py-4 rounded-2xl text-slate-900 font-bold uppercase tracking-widest text-xs shadow-lg active:scale-95 transition-all">
|
||||
Buscar Rutas
|
||||
</button>
|
||||
</div>
|
||||
<div class="route-details">
|
||||
<div class="city-flow">
|
||||
<span>{{ route.origin_city }}</span>
|
||||
<span class="material-icons">arrow_forward</span>
|
||||
<span>{{ route.destination_city }}</span>
|
||||
|
||||
<div v-else class="flex gap-4">
|
||||
<div class="flex-1 space-y-4">
|
||||
<div class="relative">
|
||||
<div class="flex items-center gap-3 px-4 h-14 rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-input-dark">
|
||||
<span class="material-icons text-primary font-bold">near_me</span>
|
||||
<select
|
||||
v-model="selectedCorregimiento"
|
||||
@change="handleTaxiFilter"
|
||||
class="bg-transparent border-none focus:ring-0 text-sm font-semibold w-full dark:text-gray-200 appearance-none cursor-pointer"
|
||||
>
|
||||
<option value="">Todos los corregimientos</option>
|
||||
<option v-for="c in correlimientos" :key="c" :value="c">{{ c }}</option>
|
||||
</select>
|
||||
<span class="material-icons ml-auto text-gray-500 text-sm">unfold_more</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center px-2">
|
||||
<span class="text-[10px] font-black text-slate-400 dark:text-gray-400 mb-2 uppercase">Inglés</span>
|
||||
<div
|
||||
@click="englishOnly = !englishOnly; handleTaxiFilter()"
|
||||
class="size-10 rounded-lg border-2 border-primary flex items-center justify-center bg-transparent cursor-pointer transition-colors"
|
||||
:class="englishOnly ? 'bg-primary' : ''"
|
||||
>
|
||||
<span class="material-icons text-slate-900" v-if="englishOnly">check</span>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="route.distance_km" class="meta">
|
||||
{{ route.distance_km }} km • {{ route.estimated_duration_minutes }} min aprox.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Results Area -->
|
||||
<div class="flex-1 px-6 pt-8 space-y-4 pb-32">
|
||||
<h2 class="text-[11px] font-black text-slate-400 dark:text-gray-500 uppercase tracking-[0.15em] mb-4">
|
||||
{{ activeTab === 'routes' ? 'Rutas Disponibles' : 'Conductores Recomendados' }}
|
||||
</h2>
|
||||
|
||||
<!-- Loading Results -->
|
||||
<div v-if="routeStore.isLoadingRoutes || taxiStore.isLoading" class="flex justify-center py-10">
|
||||
<div class="w-10 h-10 border-4 border-primary/20 border-t-primary rounded-full animate-spin"></div>
|
||||
</div>
|
||||
|
||||
<!-- Bus Routes List -->
|
||||
<template v-else-if="activeTab === 'routes'">
|
||||
<div
|
||||
v-for="route in routeStore.allRoutes"
|
||||
:key="route.id"
|
||||
class="bg-slate-50 dark:bg-card-dark p-5 rounded-[2rem] shadow-sm border border-slate-200 dark:border-white/5 flex flex-col gap-4 active:scale-[0.98] transition-all cursor-pointer"
|
||||
@click="goToSchedules(route)"
|
||||
>
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="size-14 rounded-2xl bg-primary/10 flex items-center justify-center text-primary">
|
||||
<span class="material-icons text-[32px]">directions_bus</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="flex items-center gap-2">
|
||||
<p class="font-extrabold text-xl">{{ route.name }}</p>
|
||||
<span class="px-2 py-0.5 rounded-full bg-primary text-[9px] font-black uppercase tracking-wider text-slate-900">ACTIVA</span>
|
||||
</div>
|
||||
<p class="text-[11px] text-slate-500 dark:text-gray-400 font-bold uppercase tracking-tight">
|
||||
{{ route.origin_city }} → {{ route.destination_city }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<FavoriteButton
|
||||
item-type="route"
|
||||
:item-id="route.id"
|
||||
:item-name="route.name"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-2 bg-white dark:bg-input-dark px-3 py-2 rounded-xl border border-slate-200 dark:border-white/5">
|
||||
<span class="text-[10px] font-black dark:text-gray-200">{{ route.estimated_duration_minutes }} min • {{ route.distance_km }} km</span>
|
||||
</div>
|
||||
<button class="bg-primary px-8 py-3 rounded-2xl text-xs font-black uppercase tracking-widest shadow-sm hover:brightness-110 text-slate-900 transition-all">
|
||||
Ver Horarios
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="routeStore.allRoutes.length === 0" class="text-center py-10 opacity-50 italic">
|
||||
No se encontraron rutas para tu búsqueda.
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Taxis List -->
|
||||
<template v-else>
|
||||
<div
|
||||
v-for="taxi in taxiStore.taxis"
|
||||
:key="taxi.id"
|
||||
class="bg-slate-50 dark:bg-card-dark p-5 rounded-[2rem] shadow-sm border border-slate-200 dark:border-white/5 flex flex-col gap-4 active:scale-[0.98] transition-all"
|
||||
>
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="size-14 rounded-2xl bg-primary/10 flex items-center justify-center text-primary overflow-hidden">
|
||||
<img v-if="taxi.image_url" :src="taxi.image_url" class="w-full h-full object-cover">
|
||||
<span v-else class="material-icons text-[32px]">local_taxi</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="flex items-center gap-2">
|
||||
<p class="font-extrabold text-xl">{{ taxi.owner_name }}</p>
|
||||
<span class="px-2 py-0.5 rounded-full bg-primary text-[9px] font-black uppercase tracking-wider text-slate-900">PRO</span>
|
||||
</div>
|
||||
<p class="text-[11px] text-slate-500 dark:text-gray-400 font-bold uppercase tracking-tight">
|
||||
{{ taxi.corregimiento }} • {{ taxi.license_plate }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<p class="font-black text-xl text-primary">{{ taxi.shift }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-2 bg-white dark:bg-input-dark px-3 py-2 rounded-xl border border-slate-200 dark:border-white/5">
|
||||
<span class="text-[10px] font-black dark:text-gray-200">{{ taxi.rating || 5.0 }} ★</span>
|
||||
<span v-if="taxi.english_speaking" class="text-[10px] font-black text-blue-500 uppercase">EN</span>
|
||||
</div>
|
||||
<button
|
||||
@click="callTaxi(taxi.phone_number)"
|
||||
class="bg-primary px-8 py-3 rounded-2xl text-xs font-black uppercase tracking-widest shadow-sm hover:brightness-110 text-slate-900 transition-all"
|
||||
>
|
||||
Contactar
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="taxiStore.taxis.length === 0" class="text-center py-10 opacity-50 italic">
|
||||
No hay taxis disponibles en esta zona.
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.routes-view {
|
||||
padding: 24px;
|
||||
background: var(--bg-primary);
|
||||
min-height: 100vh;
|
||||
.transport-view {
|
||||
font-family: 'Plus Jakarta Sans', sans-serif;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin-bottom: 32px;
|
||||
.bg-background-dark {
|
||||
background-color: #0F1115;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
font-size: 28px;
|
||||
font-weight: 800;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 4px;
|
||||
.bg-card-dark {
|
||||
background-color: #1C1F26;
|
||||
}
|
||||
|
||||
.header p {
|
||||
color: var(--text-secondary);
|
||||
font-size: 16px;
|
||||
.bg-input-dark {
|
||||
background-color: #252932;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
background: var(--card-bg);
|
||||
border-radius: 24px;
|
||||
padding: 24px;
|
||||
box-shadow: 0 10px 30px var(--shadow);
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
background: var(--bg-secondary);
|
||||
padding: 12px 20px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.input-group input {
|
||||
border: none;
|
||||
background: transparent;
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
select {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.divider {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 8px 0;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.search-btn {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
background: var(--header-bg);
|
||||
color: var(--header-text);
|
||||
border: none;
|
||||
padding: 16px;
|
||||
border-radius: 16px;
|
||||
font-weight: 800;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.search-btn:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.routes-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.route-card {
|
||||
background: var(--card-bg);
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 4px 15px var(--shadow);
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.route-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 10px 25px rgba(0,0,0,0.08);
|
||||
}
|
||||
|
||||
.route-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.route-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.route-name h3 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.city-flow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.route-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.chevron {
|
||||
color: #ced4da;
|
||||
}
|
||||
|
||||
.loading, .no-results {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 4px solid #f3f3f3;
|
||||
border-top: 4px solid #fee715;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto 16px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.reset-btn {
|
||||
margin-top: 16px;
|
||||
background: transparent;
|
||||
border: 1px solid #dee2e6;
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user