Newest Main page regreshing. Updated calculator. Removed unused stuff.

This commit is contained in:
2026-04-11 17:09:00 +02:00
parent d6f8ff78e1
commit 30d480f053
16 changed files with 1578 additions and 3705 deletions
+29 -4
View File
@@ -655,6 +655,12 @@
</div>
<div style="display: flex; align-items: center; gap: 15px;">
{% if settings.tournament_active %}
<div class="datetime" style="text-align: right;">
<div class="time" id="time"></div>
<div class="date" id="date"></div>
</div>
{% endif %}
<button class="hamburger-menu" id="menuButton" data-i18n-title="general.settings">
<div class="hamburger-line"></div>
<div class="hamburger-line"></div>
@@ -682,7 +688,7 @@
</div>
<div class="tournament-actions">
<a href="/tournament/draft" class="nav-link tournament-btn">📋 <span data-i18n="tournament.view_full_tournament_draft">Oglej si Celoten Žreb Turnirja</span></a>
<a href="/tournament/draft" class="nav-link tournament-btn">📋 Razpored Turnirja</a>
<a href="/results/calculator" class="nav-link tournament-btn">🎯 <span data-i18n="scoring.results_calculator">Calculator</span></a>
<a href="/tournament" class="nav-link tournament-btn" id="manageTournamentLink">⚙️ <span data-i18n="tournament.manage_tournament">Upravljaj Turnir</span></a>
</div>
@@ -693,7 +699,6 @@
<div class="settings-group">
<h4 data-i18n="league.tournaments">Turnirji</h4>
<a href="/tournament" class="nav-link" id="tournamentModeLink">🏆 <span data-i18n="tournament.tournament_mode">Način Turnirja</span></a>
<a href="/league/combine" class="nav-link">🔗 <span data-i18n="league.combine_leagues">Combine Leagues</span></a>
<a href="/archive/player-analysis" class="nav-link">👤 <span data-i18n="players.player_analysis">Analiza Igralcev</span></a>
<a href="/archive" class="nav-link">📚 <span data-i18n="navigation.archive">Arhiv</span></a>
</div>
@@ -809,7 +814,7 @@
const tournamentActive = {{ 'true' if settings.tournament_active else 'false' }};
let currentRound = {{ settings.current_round if settings.tournament_active else 1 }};
const totalRounds = {{ settings.total_rounds if settings.tournament_active else 1 }};
// Remote control state
const remoteControlled = {{ 'true' if settings.remote_controlled else 'false' }};
let remotePollingInterval = null;
@@ -1084,6 +1089,7 @@
}
}
// TV view toggle (cameras ↔ draft)
// Debounce function
function debounce(func, wait) {
let timeout;
@@ -1479,10 +1485,29 @@
const data = await response.json();
// If switched to draft view and tournament is active, follow it
if (data.tv_view === 'draft' && data.tournament_active) {
window.location.href = '/tournament/draft?tv=1';
return;
}
// If switched to results view, follow it (use explicit tv_url first, then fallback)
if (data.tv_view === 'results') {
if (data.tv_url) {
window.location.href = data.tv_url.includes('?') ? data.tv_url + '&tv=1' : data.tv_url + '?tv=1';
} else if (data.archive_filename) {
window.location.href = `/archive/tournament/${data.archive_filename}?tv=1`;
} else if (data.league_archive_filename) {
window.location.href = `/archive/league/${data.league_archive_filename}?tv=1`;
} else {
window.location.href = '/results?tv=1';
}
return;
}
// Create a hash of the state to detect changes
const stateHash = JSON.stringify(data);
// If state changed, reload the page
// If structural state changed, reload the page
if (lastDashboardStateHash !== null && stateHash !== lastDashboardStateHash) {
console.log('🔄 Tournament state changed, reloading TV display...');
window.location.reload();