187 lines
4.1 KiB
Vue
187 lines
4.1 KiB
Vue
<script setup lang="ts">
|
|
import { ref, onMounted, computed } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { useRoute } from 'vue-router'
|
|
|
|
const { t } = useI18n()
|
|
const route = useRoute()
|
|
|
|
// Solo mostrar el header con tabs en las vistas principales
|
|
const isMainView = computed(() => {
|
|
return route.name === 'TaxisLocales' || route.name === 'ViajesTuristicos'
|
|
})
|
|
const mountError = ref(false)
|
|
|
|
const reloadPage = () => {
|
|
window.location.reload()
|
|
}
|
|
|
|
onMounted(async () => {
|
|
try {
|
|
// Aquí iría cualquier inicialización global del layout si fuera necesaria
|
|
console.log('Transporte Hub mounted')
|
|
} catch (e) {
|
|
console.error('Error mounting Transporte Hub:', e)
|
|
mountError.value = true
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="taxi-view">
|
|
<header v-if="isMainView" class="header-main">
|
|
<h1 class="brand-title">{{ t('taxi.title') }}</h1>
|
|
<div class="hub-tabs">
|
|
<div class="tabs-background">
|
|
<router-link to="/transporte/taxis" class="hub-tab" active-class="active" exact-active-class="active">
|
|
<span class="material-icons">local_taxi</span>
|
|
{{ t('taxi.tabLocal') }}
|
|
</router-link>
|
|
<router-link to="/transporte/viajes-turisticos" class="hub-tab" active-class="active" :class="{ 'active': route.path.includes('viajes-turisticos') }">
|
|
<span class="material-icons">directions_bus</span>
|
|
{{ t('taxi.tabIntercity') }}
|
|
</router-link>
|
|
<div class="tab-slider" :style="{ left: route.path.includes('taxis') ? '4px' : 'calc(50% + 2px)' }"></div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<div v-if="mountError" class="error-container">
|
|
<span class="material-icons">error_outline</span>
|
|
<p>{{ t('taxi.errorLoading') }}</p>
|
|
<button @click="reloadPage" class="retry-btn">
|
|
<span class="material-icons">refresh</span>
|
|
{{ t('common.retry') }}
|
|
</button>
|
|
</div>
|
|
|
|
<router-view v-else v-slot="{ Component }">
|
|
<transition name="fade" mode="out-in">
|
|
<keep-alive>
|
|
<component :is="Component" />
|
|
</keep-alive>
|
|
</transition>
|
|
</router-view>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.taxi-view {
|
|
min-height: 100vh;
|
|
position: relative;
|
|
padding: 0 0 150px;
|
|
}
|
|
|
|
.header-main {
|
|
padding: 24px 16px;
|
|
text-align: center;
|
|
}
|
|
|
|
.brand-title {
|
|
color: var(--header-text);
|
|
font-size: 1.5rem;
|
|
font-weight: 800;
|
|
margin: 0;
|
|
}
|
|
|
|
/* Transport Hub Tabs */
|
|
.hub-tabs {
|
|
margin-top: 24px;
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
.tabs-background {
|
|
background: var(--bg-secondary);
|
|
padding: 4px;
|
|
border-radius: 16px;
|
|
display: flex;
|
|
position: relative;
|
|
border: 1px solid var(--border-color);
|
|
width: 100%;
|
|
max-width: 400px;
|
|
}
|
|
|
|
.hub-tab {
|
|
flex: 1;
|
|
padding: 12px;
|
|
border: none;
|
|
background: transparent;
|
|
color: var(--text-secondary);
|
|
font-weight: 700;
|
|
font-size: 0.9rem;
|
|
cursor: pointer;
|
|
z-index: 2;
|
|
transition: color 0.3s;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.hub-tab.active {
|
|
color: #101820 !important;
|
|
}
|
|
|
|
.hub-tab .material-icons {
|
|
font-size: 18px;
|
|
}
|
|
|
|
.tab-slider {
|
|
position: absolute;
|
|
top: 4px;
|
|
bottom: 4px;
|
|
width: calc(50% - 6px);
|
|
background: #FEE715;
|
|
border-radius: 12px;
|
|
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
z-index: 1;
|
|
box-shadow: 0 4px 15px rgba(254, 231, 21, 0.4);
|
|
}
|
|
|
|
.fade-enter-active,
|
|
.fade-leave-active {
|
|
transition: opacity 0.2s ease;
|
|
}
|
|
.fade-enter-from,
|
|
.fade-leave-to {
|
|
opacity: 0;
|
|
}
|
|
|
|
.error-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 40px 20px;
|
|
text-align: center;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.error-container .material-icons {
|
|
font-size: 48px;
|
|
color: #ef4444;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.retry-btn {
|
|
margin-top: 16px;
|
|
padding: 10px 24px;
|
|
background: var(--active-color);
|
|
color: #101820;
|
|
border: none;
|
|
border-radius: 12px;
|
|
font-weight: 800;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
transition: transform 0.2s;
|
|
}
|
|
|
|
.retry-btn:active {
|
|
transform: scale(0.95);
|
|
}
|
|
</style>
|