chore: build and UI fixes
This commit is contained in:
@ -65,6 +65,7 @@ export function useParadaCercana() {
|
|||||||
|
|
||||||
if (response.routes && response.routes.length > 0) {
|
if (response.routes && response.routes.length > 0) {
|
||||||
const route = response.routes[0];
|
const route = response.routes[0];
|
||||||
|
if (!route) continue;
|
||||||
let distTotal = 0;
|
let distTotal = 0;
|
||||||
let durTotal = 0;
|
let durTotal = 0;
|
||||||
|
|
||||||
@ -89,8 +90,8 @@ export function useParadaCercana() {
|
|||||||
|
|
||||||
// 3. Fallback a la más cercana lineal si falla API
|
// 3. Fallback a la más cercana lineal si falla API
|
||||||
if (!mejorParada) {
|
if (!mejorParada) {
|
||||||
mejorParada = top5[0];
|
mejorParada = top5[0] || null;
|
||||||
minimaDistanciaCalles = paradasConDistLineal[0].distancia * 1000;
|
minimaDistanciaCalles = (paradasConDistLineal[0]?.distancia || 0) * 1000;
|
||||||
mejorDuracion = (minimaDistanciaCalles / 1000) / 5 * 60 * 60; // asumiendo caminata a 5km/h
|
mejorDuracion = (minimaDistanciaCalles / 1000) / 5 * 60 * 60; // asumiendo caminata a 5km/h
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/** analyticsService — stub. Analytics via Supabase can be implemented in v3 */
|
/** analyticsService — stub. Analytics via Supabase can be implemented in v3 */
|
||||||
export const analyticsService = {
|
export const analyticsService = {
|
||||||
logEvent(_event: { event_name: string; properties?: Record<string, any> }) {
|
logEvent(_event: any) {
|
||||||
// no-op
|
// no-op
|
||||||
},
|
},
|
||||||
async getDashboardStats() {
|
async getDashboardStats() {
|
||||||
|
|||||||
@ -26,6 +26,13 @@ export const reportsService = {
|
|||||||
if (error) throw new Error(error.message)
|
if (error) throw new Error(error.message)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async sendReport(message: string): Promise<void> {
|
||||||
|
const { error } = await supabase.from('reports').insert([
|
||||||
|
{ message, status: 'pending' }
|
||||||
|
]);
|
||||||
|
if (error) throw new Error(error.message);
|
||||||
|
},
|
||||||
|
|
||||||
async getRoutesReport() {
|
async getRoutesReport() {
|
||||||
const { data, error } = await supabase.from('routes').select('*')
|
const { data, error } = await supabase.from('routes').select('*')
|
||||||
if (error) throw new Error(error.message)
|
if (error) throw new Error(error.message)
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import { supabase } from '@/supabase';
|
|
||||||
|
|
||||||
/** telemetryService — Previously sent GPS data to the Python backend.
|
/** telemetryService — Previously sent GPS data to the Python backend.
|
||||||
* Now it's a no-op stub since we don't have a custom backend.
|
* Now it's a no-op stub since we don't have a custom backend.
|
||||||
* Realtime GPS tracking can be implemented via Supabase Realtime in the future. */
|
* Realtime GPS tracking can be implemented via Supabase Realtime in the future. */
|
||||||
|
|||||||
@ -178,7 +178,7 @@ const lastRefreshed = ref('')
|
|||||||
async function loadStats() {
|
async function loadStats() {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
try {
|
try {
|
||||||
stats.value = await analyticsService.getStats()
|
stats.value = await analyticsService.getDashboardStats() || {}
|
||||||
lastRefreshed.value = new Date().toLocaleTimeString()
|
lastRefreshed.value = new Date().toLocaleTimeString()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error loading stats')
|
console.error('Error loading stats')
|
||||||
|
|||||||
@ -152,7 +152,7 @@ async function startService() {
|
|||||||
// Throttling updates to save battery/bandwidth
|
// Throttling updates to save battery/bandwidth
|
||||||
if (now - lastUpdate.value >= minUpdateInterval) {
|
if (now - lastUpdate.value >= minUpdateInterval) {
|
||||||
try {
|
try {
|
||||||
await telemetryService.sendTelemetry({
|
await telemetryService.sendLocation({
|
||||||
latitude: position.coords.latitude,
|
latitude: position.coords.latitude,
|
||||||
longitude: position.coords.longitude,
|
longitude: position.coords.longitude,
|
||||||
speed: position.coords.speed || undefined,
|
speed: position.coords.speed || undefined,
|
||||||
@ -192,7 +192,7 @@ function stopService() {
|
|||||||
localStorage.setItem('driver_in_service', 'false')
|
localStorage.setItem('driver_in_service', 'false')
|
||||||
|
|
||||||
// Optionally notify backend that we are offline
|
// Optionally notify backend that we are offline
|
||||||
telemetryService.sendTelemetry({
|
telemetryService.sendLocation({
|
||||||
latitude: 0,
|
latitude: 0,
|
||||||
longitude: 0,
|
longitude: 0,
|
||||||
status: 'offline'
|
status: 'offline'
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useI18n } from 'vue-i18n'
|
|
||||||
import { useFavoritesStore } from '@/stores/favorites'
|
import { useFavoritesStore } from '@/stores/favorites'
|
||||||
import { getImageUrl as utilGetImageUrl } from '@/utils/imageUrl'
|
import { getImageUrl as utilGetImageUrl } from '@/utils/imageUrl'
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const favoritesStore = useFavoritesStore()
|
const favoritesStore = useFavoritesStore()
|
||||||
const selectedFilter = ref('all')
|
const selectedFilter = ref('all')
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { businessService } from '@/services/businessService'
|
|||||||
import { couponsService } from '@/services/couponsService'
|
import { couponsService } from '@/services/couponsService'
|
||||||
import { shuttlesService } from '@/services/shuttlesService'
|
import { shuttlesService } from '@/services/shuttlesService'
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
import { SUPABASE_URL, supabase } from '@/supabase'
|
import { supabase } from '@/supabase'
|
||||||
import type { Coupon, Business, Shuttle } from '@/types'
|
import type { Coupon, Business, Shuttle } from '@/types'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|||||||
@ -4,10 +4,8 @@ import { useRouter } from 'vue-router'
|
|||||||
import { useRouteStore } from '@/stores/route'
|
import { useRouteStore } from '@/stores/route'
|
||||||
import { useTaxiStore } from '@/stores/taxi'
|
import { useTaxiStore } from '@/stores/taxi'
|
||||||
import { analyticsService } from '@/services/analyticsService'
|
import { analyticsService } from '@/services/analyticsService'
|
||||||
import { useI18n } from 'vue-i18n'
|
|
||||||
import FavoriteButton from '@/components/FavoriteButton.vue'
|
import FavoriteButton from '@/components/FavoriteButton.vue'
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const routeStore = useRouteStore()
|
const routeStore = useRouteStore()
|
||||||
const taxiStore = useTaxiStore()
|
const taxiStore = useTaxiStore()
|
||||||
@ -59,10 +57,7 @@ const correlimientos = computed(() => {
|
|||||||
return Array.from(set).sort()
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@ -27,7 +27,7 @@ function getBusStatus(timeStr: string): 'departing' | 'ontime' | 'upcoming' {
|
|||||||
const now = new Date()
|
const now = new Date()
|
||||||
const [h, m] = timeStr.split(':').map(Number)
|
const [h, m] = timeStr.split(':').map(Number)
|
||||||
const schedDate = new Date()
|
const schedDate = new Date()
|
||||||
schedDate.setHours(h, m, 0, 0)
|
schedDate.setHours(h || 0, m || 0, 0, 0)
|
||||||
const diffMin = (schedDate.getTime() - now.getTime()) / 60000
|
const diffMin = (schedDate.getTime() - now.getTime()) / 60000
|
||||||
if (diffMin >= 0 && diffMin <= 10) return 'departing'
|
if (diffMin >= 0 && diffMin <= 10) return 'departing'
|
||||||
if (diffMin > 10 && diffMin <= 60) return 'ontime'
|
if (diffMin > 10 && diffMin <= 60) return 'ontime'
|
||||||
|
|||||||
Reference in New Issue
Block a user