2026-02-21 09:53:31 -05:00
|
|
|
<template>
|
|
|
|
|
<div class="splash-screen">
|
|
|
|
|
<div class="splash-content">
|
|
|
|
|
<!-- Logo with animation -->
|
|
|
|
|
<div class="logo-container" :class="{ 'logo-visible': logoVisible }">
|
|
|
|
|
<div class="logo-box">
|
2026-03-09 12:19:37 -05:00
|
|
|
<img src="/icon-192.png" alt="SIB" class="logo-icon" />
|
2026-02-21 09:53:31 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Loading indicator -->
|
|
|
|
|
<div v-if="showLoading" class="loading-container" :class="{ 'loading-visible': loadingVisible }">
|
|
|
|
|
<div class="spinner"></div>
|
|
|
|
|
<p class="status-message">{{ statusMessage }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Version info -->
|
|
|
|
|
<div class="version-info">
|
2026-03-01 12:15:08 -05:00
|
|
|
<p class="app-subtitle">{{ t('splash.subtitle') }}</p>
|
2026-02-26 09:22:38 -05:00
|
|
|
<p class="app-version">Versión 2.0.1</p>
|
2026-02-21 09:53:31 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
|
import { useRouteStore } from '@/stores/route'
|
|
|
|
|
import { useBusStopStore } from '@/stores/busStop'
|
refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
2026-02-25 21:49:26 -05:00
|
|
|
import { supabase } from '@/supabase'
|
2026-03-01 12:15:08 -05:00
|
|
|
import { useI18n } from 'vue-i18n'
|
2026-02-21 09:53:31 -05:00
|
|
|
|
|
|
|
|
const router = useRouter()
|
2026-03-01 12:15:08 -05:00
|
|
|
const { t } = useI18n()
|
2026-02-21 09:53:31 -05:00
|
|
|
const routeStore = useRouteStore()
|
|
|
|
|
const busStopStore = useBusStopStore()
|
|
|
|
|
|
|
|
|
|
const logoVisible = ref(false)
|
|
|
|
|
const showLoading = ref(false)
|
|
|
|
|
const loadingVisible = ref(false)
|
2026-03-01 12:15:08 -05:00
|
|
|
const statusMessage = ref(t('splash.starting'))
|
2026-02-21 09:53:31 -05:00
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
logoVisible.value = true
|
|
|
|
|
showLoading.value = true
|
|
|
|
|
loadingVisible.value = true
|
|
|
|
|
|
2026-02-26 10:57:55 -05:00
|
|
|
// Timeout logic
|
2026-02-26 11:05:43 -05:00
|
|
|
const initTimeout = setTimeout(() => {
|
2026-02-21 09:53:31 -05:00
|
|
|
console.warn('Initialization taking too long, forcing navigation...')
|
2026-03-01 12:15:08 -05:00
|
|
|
statusMessage.value = t('splash.offline')
|
2026-02-26 11:05:43 -05:00
|
|
|
router.replace('/map')
|
2026-02-26 10:57:55 -05:00
|
|
|
}, 4000)
|
2026-02-21 09:53:31 -05:00
|
|
|
|
|
|
|
|
try {
|
2026-02-26 10:57:55 -05:00
|
|
|
// Start map background initialization without waiting
|
|
|
|
|
performInitializationTasks()
|
|
|
|
|
|
|
|
|
|
const resp = await supabase.auth.getSession()
|
2026-02-26 09:09:25 -05:00
|
|
|
|
2026-02-21 09:53:31 -05:00
|
|
|
clearTimeout(initTimeout)
|
2026-02-26 10:57:55 -05:00
|
|
|
navigate(resp.data.session)
|
2026-02-21 09:53:31 -05:00
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Initialization failed', error)
|
|
|
|
|
clearTimeout(initTimeout)
|
2026-02-26 09:22:38 -05:00
|
|
|
navigate(null, true)
|
2026-02-21 09:53:31 -05:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-26 09:22:38 -05:00
|
|
|
async function navigate(sessionData?: any, force = false) {
|
|
|
|
|
let session = sessionData;
|
|
|
|
|
|
|
|
|
|
if (!session && !force) {
|
|
|
|
|
try {
|
|
|
|
|
const resp = await supabase.auth.getSession()
|
|
|
|
|
session = resp.data.session
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.warn('Silent auth check failed', e)
|
|
|
|
|
}
|
|
|
|
|
}
|
refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
2026-02-25 21:49:26 -05:00
|
|
|
|
|
|
|
|
if (!session) {
|
2026-02-21 09:53:31 -05:00
|
|
|
router.replace('/map')
|
refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
2026-02-25 21:49:26 -05:00
|
|
|
return
|
2026-02-21 09:53:31 -05:00
|
|
|
}
|
refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
2026-02-25 21:49:26 -05:00
|
|
|
|
2026-02-26 09:09:25 -05:00
|
|
|
// Get the role directly from user metadata for speed
|
2026-02-25 23:25:07 -05:00
|
|
|
const role = session.user?.user_metadata?.role?.toUpperCase() || 'PASSENGER'
|
|
|
|
|
|
refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
2026-02-25 21:49:26 -05:00
|
|
|
if (role === 'ADMIN') router.replace('/admin')
|
|
|
|
|
else if (role === 'DRIVER') router.replace('/driver')
|
|
|
|
|
else if (role === 'PROMOTER') router.replace('/promoter')
|
|
|
|
|
else router.replace('/map')
|
2026-02-21 09:53:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function performInitializationTasks() {
|
2026-03-01 12:15:08 -05:00
|
|
|
statusMessage.value = t('splash.verifying')
|
2026-02-26 09:09:25 -05:00
|
|
|
console.log('Starting initialization tasks...')
|
2026-02-21 09:53:31 -05:00
|
|
|
|
2026-02-25 23:25:07 -05:00
|
|
|
// Load essential map data in parallel to save time
|
|
|
|
|
try {
|
2026-02-26 09:09:25 -05:00
|
|
|
const start = Date.now()
|
2026-02-25 23:25:07 -05:00
|
|
|
await Promise.all([
|
2026-02-26 09:09:25 -05:00
|
|
|
routeStore.loadRoutes().then(() => console.log('Routes loaded')),
|
|
|
|
|
busStopStore.loadBusStops().then(() => console.log('Bus stops loaded'))
|
2026-02-25 23:25:07 -05:00
|
|
|
])
|
2026-02-26 09:09:25 -05:00
|
|
|
console.log(`Initialization tasks finished in ${Date.now() - start}ms`)
|
2026-02-25 23:25:07 -05:00
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Error pre-loading map data', e)
|
|
|
|
|
}
|
2026-02-21 09:53:31 -05:00
|
|
|
|
2026-03-01 12:15:08 -05:00
|
|
|
statusMessage.value = t('splash.ready')
|
2026-02-21 09:53:31 -05:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.splash-screen {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
background-color: #101820;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
z-index: 9999;
|
|
|
|
|
}
|
|
|
|
|
.splash-content {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
.logo-container {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
transform: scale(0.8);
|
|
|
|
|
transition: opacity 0.6s ease-out, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
|
|
|
}
|
|
|
|
|
.logo-container.logo-visible {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
}
|
|
|
|
|
.logo-box {
|
|
|
|
|
width: 140px;
|
|
|
|
|
height: 140px;
|
|
|
|
|
background-color: #fee715;
|
|
|
|
|
border-radius: 28px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
|
|
|
|
|
}
|
|
|
|
|
.logo-icon {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
object-fit: contain;
|
|
|
|
|
display: block;
|
|
|
|
|
}
|
|
|
|
|
.loading-container {
|
|
|
|
|
margin-top: 48px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
transition: opacity 0.8s ease-in;
|
|
|
|
|
}
|
refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
2026-02-25 21:49:26 -05:00
|
|
|
.loading-container.loading-visible { opacity: 1; }
|
2026-02-21 09:53:31 -05:00
|
|
|
.spinner {
|
|
|
|
|
width: 32px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
border: 3px solid rgba(254, 231, 21, 0.3);
|
|
|
|
|
border-top-color: #fee715;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
animation: spin 0.8s linear infinite;
|
|
|
|
|
}
|
refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
2026-02-25 21:49:26 -05:00
|
|
|
@keyframes spin { to { transform: rotate(360deg); } }
|
2026-02-21 09:53:31 -05:00
|
|
|
.status-message {
|
|
|
|
|
margin-top: 16px;
|
|
|
|
|
color: rgba(255, 255, 255, 0.8);
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.version-info {
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 64px;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
.app-subtitle {
|
|
|
|
|
color: rgba(255, 255, 255, 0.6);
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.app-version {
|
|
|
|
|
color: rgba(255, 255, 255, 0.4);
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
@media (max-width: 480px) {
|
refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
2026-02-25 21:49:26 -05:00
|
|
|
.logo-box { width: 120px; height: 120px; border-radius: 24px; }
|
|
|
|
|
.loading-container { margin-top: 40px; }
|
|
|
|
|
.version-info { bottom: 48px; }
|
2026-02-21 09:53:31 -05:00
|
|
|
}
|
|
|
|
|
</style>
|