diff --git a/frontend/src/views/TournamentTab.vue b/frontend/src/views/TournamentTab.vue index b6de56e1..9d276c35 100644 --- a/frontend/src/views/TournamentTab.vue +++ b/frontend/src/views/TournamentTab.vue @@ -2644,8 +2644,9 @@ export default { } }); - const stages = stagesRes?.data?.stages; - if (Array.isArray(stages) && stages.length > 0) { + const stages = Array.isArray(stagesRes?.data?.stages) ? stagesRes.data.stages : []; + const advancements = Array.isArray(stagesRes?.data?.advancements) ? stagesRes.data.advancements : []; + if (stages.length > 0 && advancements.length > 0) { const normalizedStages = stages .map(s => ({ ...s, @@ -2680,6 +2681,7 @@ export default { if ((stage.type || stage.targetType || stage.target) === 'knockout') { await this.loadTournamentData(); + await this.scrollToKnockoutSection(); return; } @@ -2696,6 +2698,7 @@ export default { tournamentId: this.selectedDate }); await this.loadTournamentData(); + await this.scrollToKnockoutSection(); } catch (error) { console.error('Fehler beim Starten der K.o.-Runde:', error); await this.showInfo( @@ -2708,6 +2711,21 @@ export default { this.knockoutOperationInProgress = false; } }, + async scrollToKnockoutSection() { + await this.$nextTick(); + window.setTimeout(() => { + const knockoutSection = document.querySelector('.ko-round'); + if (knockoutSection && typeof knockoutSection.scrollIntoView === 'function') { + knockoutSection.scrollIntoView({ behavior: 'smooth', block: 'start' }); + return; + } + + const placementsSection = document.querySelector('.ranking'); + if (placementsSection && typeof placementsSection.scrollIntoView === 'function') { + placementsSection.scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + }, 120); + }, formatResult(match) { if (!match.tournamentResults?.length) return '-';