quality update:
- calculator - result screens - some fixes
This commit is contained in:
+51
-7
@@ -683,17 +683,12 @@
|
||||
|
||||
<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="/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>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if settings.tournament_active %}
|
||||
<div class="settings-group">
|
||||
<a href="/results/calculator" class="nav-link tournament-btn">🎯 <span data-i18n="scoring.results_calculator">Calculator</span></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Tournaments Section -->
|
||||
<div class="settings-group">
|
||||
<h4 data-i18n="league.tournaments">Turnirji</h4>
|
||||
@@ -771,7 +766,7 @@
|
||||
|
||||
<!-- Version Information -->
|
||||
<div class="version-info" style="margin-top: 30px; padding: 15px; text-align: center; border-top: 1px solid #e9ecef; color: #6c757d; font-size: 0.85rem;">
|
||||
Version 1.0.0
|
||||
Version 1.0.1
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1466,11 +1461,60 @@
|
||||
}, { once: true });
|
||||
});
|
||||
|
||||
// TV Display Auto-Update Polling
|
||||
// (Separate from remote control polling)
|
||||
let lastDashboardStateHash = null;
|
||||
let dashboardPollingInterval = null;
|
||||
|
||||
async function pollDashboardState() {
|
||||
// Only poll when page is visible
|
||||
if (document.visibilityState !== 'visible') {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/dashboard/state');
|
||||
if (!response.ok) return;
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
// Create a hash of the state to detect changes
|
||||
const stateHash = JSON.stringify(data);
|
||||
|
||||
// If state changed, reload the page
|
||||
if (lastDashboardStateHash !== null && stateHash !== lastDashboardStateHash) {
|
||||
console.log('🔄 Tournament state changed, reloading TV display...');
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
lastDashboardStateHash = stateHash;
|
||||
} catch (error) {
|
||||
console.error('Dashboard polling error:', error);
|
||||
// Silent failure - keep polling
|
||||
}
|
||||
}
|
||||
|
||||
// Start dashboard polling (every 3 seconds)
|
||||
dashboardPollingInterval = setInterval(pollDashboardState, 3000);
|
||||
|
||||
// Initial poll
|
||||
pollDashboardState();
|
||||
|
||||
// Pause polling when page is hidden
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.visibilityState === 'visible') {
|
||||
pollDashboardState();
|
||||
}
|
||||
});
|
||||
|
||||
// Cleanup on page unload
|
||||
window.addEventListener('beforeunload', function() {
|
||||
if (remotePollingInterval) {
|
||||
clearInterval(remotePollingInterval);
|
||||
}
|
||||
if (dashboardPollingInterval) {
|
||||
clearInterval(dashboardPollingInterval);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user