Fix UI overlapping, transport load error handling, and schedule filtering bugs

This commit is contained in:
2026-02-27 20:22:29 -05:00
parent 7c800a0551
commit a2d317d1bc
5 changed files with 171 additions and 21 deletions

View File

@ -22,14 +22,19 @@ const DAY_TYPES: Record<string, string> = {
}
// ── Calcular estado del bus según horario
function getBusStatus(timeStr: string): 'departing' | 'ontime' | 'upcoming' {
function getBusStatus(timeStr: string): 'departing' | 'ontime' | 'upcoming' | 'passed' {
if (!timeStr) return 'upcoming'
const now = new Date()
const [h, m] = timeStr.split(':').map(Number)
const schedDate = new Date()
schedDate.setHours(h || 0, m || 0, 0, 0)
const diffMin = (schedDate.getTime() - now.getTime()) / 60000
if (diffMin >= 0 && diffMin <= 10) return 'departing'
// Si el bus ya pasó (más de 2 minutos de margen de gracia)
if (diffMin < -2) return 'passed'
if (diffMin >= -2 && diffMin <= 10) return 'departing'
if (diffMin > 10 && diffMin <= 60) return 'ontime'
return 'upcoming'
}
@ -56,10 +61,20 @@ function getDayLabel(schedule: any): string {
// ── Filtrado de horarios
const filteredSchedules = computed(() => {
return scheduleStore.schedules.filter(s => {
if (dayFilter.value === 'all') return true
const d = getScheduleDay(s)
if (dayFilter.value === 'today') return d === 'today'
if (dayFilter.value === 'tomorrow') return d === 'tomorrow'
const status = getBusStatus(s.departure_time)
// Filtro Hoy: Solo buses de hoy que NO han pasado
if (dayFilter.value === 'today') {
return d === 'today' && status !== 'passed'
}
// Filtro Mañana: Solo buses de mañana
if (dayFilter.value === 'tomorrow') {
return d === 'tomorrow'
}
// Filtro Todos: Mostrar todo
return true
})
})
@ -269,7 +284,8 @@ onUnmounted(() => {
<div class="status-badge" :class="`status-badge--${getBusStatus(schedule.departure_time)}`">
<span class="material-icons status-icon">
{{ getBusStatus(schedule.departure_time) === 'departing' ? 'directions_run' :
getBusStatus(schedule.departure_time) === 'ontime' ? 'check_circle' : 'access_time' }}
getBusStatus(schedule.departure_time) === 'ontime' ? 'check_circle' :
getBusStatus(schedule.departure_time) === 'passed' ? 'history' : 'access_time' }}
</span>
</div>
</div>
@ -679,6 +695,28 @@ onUnmounted(() => {
50% { opacity: 0.6; }
}
/* Estado Pasado (Faded) */
.schedule-card--passed {
opacity: 0.5;
filter: grayscale(0.8);
border-left-color: #6b7280;
border-left-width: 3px;
transform: none !important; /* No hover effect for passed */
}
.schedule-card--passed .card-accent {
background: #6b7280;
}
.schedule-card--passed .time-big {
color: #6b7280;
}
.status-badge--passed {
background: rgba(107, 114, 128, 0.15);
color: #6b7280;
}
.route-name {
margin: 0;
font-size: 0.9375rem;