feat(mannschaften): align public pages with season query logic
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
<div class="w-24 h-1 bg-primary-600 mb-8" />
|
||||
|
||||
<p class="text-xl text-gray-600 mb-12">
|
||||
Unsere aktiven Mannschaften in der Saison 2025/26
|
||||
Unsere aktiven Mannschaften in der Saison {{ selectedSeasonLabel }}
|
||||
</p>
|
||||
|
||||
<MannschaftenUebersicht />
|
||||
<MannschaftenUebersicht :season="selectedSeason" />
|
||||
|
||||
<div class="mt-16">
|
||||
<div class="bg-primary-50 p-8 rounded-xl border border-primary-100">
|
||||
@@ -21,7 +21,7 @@
|
||||
Alle aktuellen Spielpläne und Ergebnisse unserer Mannschaften finden Sie hier.
|
||||
</p>
|
||||
<NuxtLink
|
||||
to="/mannschaften/spielplaene"
|
||||
:to="{ path: '/mannschaften/spielplaene', query: { season: selectedSeason } }"
|
||||
class="inline-flex items-center px-6 py-3 bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-lg transition-colors"
|
||||
>
|
||||
Zu den Spielplänen
|
||||
@@ -33,8 +33,29 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import MannschaftenUebersicht from '~/components/MannschaftenUebersicht.vue'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const getCurrentSeasonSlug = () => {
|
||||
const now = new Date()
|
||||
const year = now.getFullYear()
|
||||
const startYear = now.getMonth() >= 6 ? year : year - 1
|
||||
const endYear = startYear + 1
|
||||
return `${String(startYear).slice(-2)}--${String(endYear).slice(-2)}`
|
||||
}
|
||||
|
||||
const selectedSeason = computed(() => {
|
||||
const value = String(route.query.season || '').trim()
|
||||
return /^\d{2}--\d{2}$/.test(value) ? value : getCurrentSeasonSlug()
|
||||
})
|
||||
|
||||
const selectedSeasonLabel = computed(() => {
|
||||
const match = String(selectedSeason.value || '').match(/^(\d{2})--(\d{2})$/)
|
||||
return match ? `20${match[1]}/${match[2]}` : selectedSeason.value
|
||||
})
|
||||
|
||||
useHead({
|
||||
title: 'Mannschaften - Harheimer TC',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user