Files
Sdk_TV_app/templates/results_display.html
T
bl3kunja-FW 5c7f255a02 Add tournament archives and results for multiple events
- Created JSON files for tournament archives on 2025-07-28 and 2025-07-29, including detailed player scores and shot results.
- Added a new tournament results file summarizing the outcomes of the tournament held on 2025-07-29, including participant scores and completion status.
2025-08-02 15:27:32 +02:00

872 lines
20 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Tournament Results</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
height: 100vh;
overflow: hidden; /* Prevent scrolling for TV display */
color: #333;
}
.navbar {
background: white;
border-bottom: 1px solid #e1e5e9;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
padding: 15px 25px;
display: flex;
align-items: center;
justify-content: space-between;
}
.navbar-logo {
height: 40px;
max-width: 120px;
object-fit: contain;
}
.navbar-title {
font-size: 1.8rem;
font-weight: bold;
color: #333;
margin-left: 15px;
}
.navbar-brand {
display: flex;
align-items: center;
}
.navbar-controls {
display: flex;
gap: 12px;
align-items: center;
}
.nav-btn {
background: #f8f9fa;
border: 2px solid #e9ecef;
cursor: pointer;
padding: 12px 20px;
border-radius: 8px;
transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
color: #333;
text-decoration: none;
font-weight: bold;
font-size: 0.9rem;
}
.nav-btn:hover {
background: #e9ecef;
border-color: #007bff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
transform: translateY(-1px);
color: #007bff;
}
.nav-btn.primary {
background: #007bff;
border-color: #0056b3;
color: white;
}
.nav-btn.primary:hover {
background: #0056b3;
color: white;
}
/* Main TV Layout */
.tv-container {
height: calc(100vh - 90px); /* Adjusted for consistent navbar size */
display: grid;
grid-template-columns: 2fr 3fr;
gap: 20px;
padding: 20px;
}
/* Left Column - Header & Podium */
.left-column {
display: flex;
flex-direction: column;
gap: 20px;
}
.results-header {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
padding: 25px;
text-align: center;
flex-shrink: 0;
color: white;
position: relative;
overflow: hidden;
}
.results-header::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%, rgba(255, 255, 255, 0.05) 100%);
pointer-events: none;
}
.results-header * {
position: relative;
z-index: 2;
}
.header-logo {
height: 70px;
max-width: 180px;
object-fit: contain;
margin-bottom: 20px;
filter: brightness(1.2) contrast(1.1);
background-color: white;
padding: 10px;
border-radius: 8px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.results-title {
font-size: 2.2rem;
font-weight: 700;
color: rgb(255, 255, 255);
margin-bottom: 10px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.results-subtitle {
font-size: 1.1rem;
color: rgba(255, 255, 255, 0.95);
margin-bottom: 20px;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.results-meta {
display: flex;
justify-content: space-around;
gap: 30px;
}
.meta-item {
text-align: center;
}
.meta-number {
font-size: 1.8rem;
font-weight: 700;
color: #ffffff;
display: block;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.meta-label {
font-size: 0.8rem;
color: rgba(255, 255, 255, 0.9);
text-transform: uppercase;
letter-spacing: 0.5px;
font-weight: 500;
}
/* Modern Podium Design */
.podium-section {
background: white;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
padding: 25px;
flex: 1;
display: flex;
flex-direction: column;
}
.podium-title {
text-align: center;
font-size: 1.4rem;
font-weight: 700;
color: #2c3e50;
margin-bottom: 20px;
}
.podium-container {
display: flex;
flex-direction: column;
gap: 15px;
flex: 1;
}
.podium-card {
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
padding: 20px;
display: flex;
align-items: center;
gap: 20px;
transition: all 0.2s ease;
position: relative;
overflow: hidden;
border-left: 5px solid;
}
.podium-card:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.podium-card.rank-1 {
border-left-color: #ffd700;
background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
}
.podium-card.rank-2 {
border-left-color: #c0c0c0;
background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
}
.podium-card.rank-3 {
border-left-color: #cd7f32;
background: linear-gradient(135deg, #fdf6f0 0%, #ffffff 100%);
}
.rank-display {
display: flex;
flex-direction: column;
align-items: center;
min-width: 60px;
}
.rank-number {
font-size: 1.8rem;
font-weight: bold;
color: #333;
line-height: 1;
}
.podium-card.rank-1 .rank-number { color: #b8860b; }
.podium-card.rank-2 .rank-number { color: #696969; }
.podium-card.rank-3 .rank-number { color: #8b4513; }
.rank-suffix {
font-size: 0.7rem;
color: #666;
text-transform: uppercase;
font-weight: bold;
}
.medal {
font-size: 1.5rem;
margin-top: 3px;
}
.participant-info {
flex: 1;
min-width: 0;
}
.participant-name {
font-size: 1.3rem;
font-weight: bold;
color: #333;
margin-bottom: 5px;
word-wrap: break-word;
}
.participant-id {
background: #007bff;
color: white;
padding: 3px 10px;
border-radius: 12px;
font-size: 0.8rem;
font-weight: bold;
display: inline-block;
}
.score-display {
text-align: right;
min-width: 80px;
}
.score-number {
font-size: 2rem;
font-weight: bold;
color: #28a745;
line-height: 1;
}
.score-label {
font-size: 0.8rem;
color: #666;
text-transform: uppercase;
font-weight: bold;
}
/* Right Column - Full Results Table */
.right-column {
background: white;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
display: flex;
flex-direction: column;
}
.table-header {
background: #f8f9fa;
padding: 15px 20px;
border-bottom: 1px solid #dee2e6;
flex-shrink: 0;
}
.table-title {
font-size: 1.25rem;
font-weight: 600;
color: #2c3e50;
margin: 0;
}
.table-container {
flex: 1;
overflow-y: auto;
}
.results-table {
width: 100%;
border-collapse: collapse;
}
.results-table th,
.results-table td {
padding: 10px 15px;
text-align: left;
border-bottom: 1px solid #f1f3f4;
}
.results-table th {
background: #f8f9fa;
font-weight: 600;
color: #495057;
text-transform: uppercase;
font-size: 0.7rem;
letter-spacing: 0.5px;
position: sticky;
top: 0;
z-index: 10;
}
.results-table tbody tr:hover {
background: #f8f9fa;
}
.results-table tbody tr:nth-child(1) {
background: #fff9e6;
}
.results-table tbody tr:nth-child(1):hover {
background: #fff3cd;
}
.results-table tbody tr:nth-child(2) {
background: #f5f5f5;
}
.results-table tbody tr:nth-child(2):hover {
background: #e9ecef;
}
.results-table tbody tr:nth-child(3) {
background: #fdf6f0;
}
.results-table tbody tr:nth-child(3):hover {
background: #f8f1e6;
}
.rank-cell {
font-size: 1rem;
font-weight: 700;
width: 60px;
text-align: center;
}
.rank-1 { color: #b8860b; }
.rank-2 { color: #6c757d; }
.rank-3 { color: #8b4513; }
.name-cell {
font-size: 0.9rem;
font-weight: 600;
color: #2c3e50;
word-break: keep-all;
overflow-wrap: break-word;
hyphens: none;
}
.id-cell {
background: #007bff;
color: white;
padding: 3px 8px;
border-radius: 8px;
font-size: 0.7rem;
font-weight: 500;
display: inline-block;
}
.score-cell {
font-size: 1rem;
font-weight: 700;
color: #28a745;
text-align: center;
width: 80px;
}
.status-cell {
text-align: center;
width: 80px;
}
.status-badge {
padding: 3px 8px;
border-radius: 8px;
font-size: 0.7rem;
font-weight: 500;
text-transform: uppercase;
}
.status-completed {
background: #d1ecf1;
color: #0c5460;
}
/* Tournament Stats Footer */
.stats-footer {
background: white;
border-top: 1px solid #dee2e6;
padding: 10px 20px;
display: flex;
justify-content: space-around;
font-size: 0.8rem;
color: #6c757d;
flex-shrink: 0;
}
.stat-item {
text-align: center;
}
.stat-value {
font-weight: 600;
color: #007bff;
}
/* Large Screen Optimization */
@media (min-width: 1200px) {
.tv-container {
grid-template-columns: 1fr 2fr;
}
.results-title {
font-size: 2.5rem;
}
.medal {
font-size: 1.8rem;
}
.results-table th,
.results-table td {
padding: 12px 18px;
}
}
/* Ultra-wide screens (TVs) */
@media (min-width: 1600px) {
.tv-container {
grid-template-columns: 1fr 2.5fr;
gap: 30px;
padding: 30px;
}
.results-title {
font-size: 3rem;
}
.medal {
font-size: 2.2rem;
}
}
/* Prevent scrolling on small screens by scaling down */
@media (max-height: 800px) {
.results-title {
font-size: 1.5rem;
}
.medal {
font-size: 1.2rem;
}
.results-table th,
.results-table td {
padding: 8px 12px;
font-size: 0.85rem;
}
}
/* Mobile responsive - keep consistent navbar size from other pages */
@media (max-width: 768px) {
.navbar {
padding: 10px 15px;
}
.navbar-title {
font-size: 1.4rem;
}
.navbar-logo {
height: 30px;
max-width: 90px;
}
.tv-container {
grid-template-columns: 1fr;
grid-template-rows: auto 1fr;
}
.podium-section {
padding: 20px 15px;
}
.podium-title {
font-size: 1.3rem;
margin-bottom: 20px;
}
/* Mobile podium - keep the same structure */
.podium-container {
flex-direction: column;
gap: 12px;
}
.podium-card {
padding: 15px 20px;
gap: 15px;
}
.rank-display {
min-width: 50px;
}
.rank-number {
font-size: 1.6rem;
}
.medal {
font-size: 1.3rem;
}
.participant-name {
font-size: 1.1rem;
}
.score-number {
font-size: 1.6rem;
}
}
@media (max-width: 480px) {
.navbar-logo {
height: 28px;
max-width: 80px;
}
.navbar-title {
font-size: 1.2rem;
}
.podium-section {
padding: 15px 10px;
}
.podium-card {
padding: 12px 15px;
gap: 12px;
}
.rank-display {
min-width: 45px;
}
.rank-number {
font-size: 1.4rem;
}
.medal {
font-size: 1.2rem;
}
.participant-name {
font-size: 1rem;
}
.score-number {
font-size: 1.4rem;
}
.rank-suffix {
font-size: 0.65rem;
}
}
/* Auto-refresh indicator for TV */
.tv-refresh-indicator {
position: fixed;
top: 100px; /* Adjusted for consistent navbar */
right: 20px;
background: rgba(40, 167, 69, 0.9);
color: white;
padding: 5px 10px;
border-radius: 15px;
font-size: 0.7rem;
font-weight: bold;
opacity: 0;
transition: opacity 0.3s ease;
z-index: 1000;
}
.tv-refresh-indicator.show {
opacity: 1;
}
</style>
</head>
<body>
<div class="navbar">
<div class="navbar-brand">
<div class="navbar-title">🏆 Tournament Results</div>
</div>
<div class="navbar-controls">
<a href="/" class="nav-btn">← Dashboard</a>
<a href="/tournament/draft" class="nav-btn">📋 Draft</a>
<a href="/results/calculator" class="nav-btn primary">🎯 Calculator</a>
<button class="nav-btn" onclick="window.print()">🖨️ Print</button>
</div>
</div>
<div class="tv-container">
<!-- Left Column -->
<div class="left-column">
<!-- Header Section -->
<div class="results-header">
<img src="/static/logo.png" alt="Logo" class="header-logo" onerror="this.style.display='none'" />
<div class="results-title">Tournament Results</div>
<div class="results-subtitle">Final Rankings & Scores</div>
<div class="results-meta">
<div class="meta-item">
<span class="meta-number">{{ participants|length }}</span>
<span class="meta-label">Participants</span>
</div>
<div class="meta-item">
<span class="meta-number">{{ (participants|length * 40) if participants else 0 }}</span>
<span class="meta-label">Total Shots</span>
</div>
<div class="meta-item">
<span class="meta-number">{% if participants and participants|length > 0 %}{{ participants[0].total_score }}{% else %}0{% endif %}</span>
<span class="meta-label">Highest Score</span>
</div>
</div>
</div>
{% if participants and participants|length >= 3 %}
<!-- Podium Section -->
<div class="podium-section">
<div class="podium-title">🏆 Top 3 Winners</div>
<div class="podium-container">
{% for i in range(3) %}
{% set participant = participants[i] %}
<div class="podium-card rank-{{ participant.rank }}">
<div class="rank-display">
<div class="rank-number">{{ participant.rank }}</div>
<div class="rank-suffix">
{% if participant.rank == 1 %}st
{% elif participant.rank == 2 %}nd
{% elif participant.rank == 3 %}rd
{% else %}th
{% endif %}
</div>
<div class="medal">
{% if participant.rank == 1 %}🥇
{% elif participant.rank == 2 %}🥈
{% elif participant.rank == 3 %}🥉
{% endif %}
</div>
</div>
<div class="participant-info">
<div class="participant-name">{{ participant.name }}</div>
<div class="participant-id">ID: {{ participant.id }}</div>
</div>
<div class="score-display">
<div class="score-number">{{ participant.total_score }}</div>
<div class="score-label">Points</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
<!-- Right Column -->
<div class="right-column">
<div class="table-header">
<h3 class="table-title">📊 Complete Rankings</h3>
</div>
<div class="table-container">
<table class="results-table">
<thead>
<tr>
<th>Rank</th>
<th>Participant</th>
<th>ID</th>
<th>Score</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for participant in participants %}
<tr>
<td class="rank-cell rank-{{ participant.rank if participant.rank <= 3 else 'other' }}">
{{ participant.rank }}
{% if participant.rank == 1 %}🥇
{% elif participant.rank == 2 %}🥈
{% elif participant.rank == 3 %}🥉
{% endif %}
</td>
<td class="name-cell">{{ participant.name }}</td>
<td><span class="id-cell">{{ participant.id }}</span></td>
<td class="score-cell">{{ participant.total_score }}</td>
<td class="status-cell">
<span class="status-badge status-{{ 'completed' if participant.completed else 'incomplete' }}">
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="stats-footer">
<div class="stat-item">
<div class="stat-value">{{ participants|length if participants else 0 }}</div>
<div>Participants</div>
</div>
<div class="stat-item">
<div class="stat-value">{% if participants and participants|length > 0 %}{{ participants[0].total_score }}{% else %}0{% endif %}</div>
<div>Highest Score</div>
</div>
<div class="stat-item">
<div class="stat-value">{% if participants %}{{ "%.0f"|format(participants|map(attribute='total_score')|sum / participants|length) }}{% else %}0{% endif %}</div>
<div>Average Score</div>
</div>
<div class="stat-item">
<div class="stat-value">{{ results.created_at[:10] if results and results.created_at else 'Today' }}</div>
<div>Tournament Date</div>
</div>
</div>
</div>
</div>
<script>
const participants = {{ participants|tojson }};
const results = {{ results|tojson }};
// TV-optimized auto-refresh
function setupTVRefresh() {
setInterval(() => {
if (document.visibilityState === 'visible') {
// Show refresh indicator
const indicator = document.getElementById('tvRefreshIndicator');
indicator.textContent = '🔄 Updating...';
indicator.classList.add('show');
setTimeout(() => {
window.location.reload();
}, 1500);
}
}, 30000); // 30 seconds for TV display
}
// Subtle winner highlight for TV
function showTVWinnerHighlight() {
if (participants && participants.length > 0) {
setTimeout(() => {
const firstPlace = document.querySelector('.podium-card.rank-1');
if (firstPlace) {
firstPlace.style.boxShadow = '0 4px 15px rgba(255, 215, 0, 0.4)';
setTimeout(() => {
firstPlace.style.boxShadow = '';
}, 3000);
}
}, 1000);
}
}
// Keyboard shortcuts for TV operation
document.addEventListener('keydown', function(event) {
if (event.key === 'r' || event.key === 'R') {
event.preventDefault();
window.location.reload();
} else if (event.key === 'p' || event.key === 'P') {
event.preventDefault();
window.print();
}
});
// Initialize TV mode
document.addEventListener('DOMContentLoaded', function() {
setupTVRefresh();
showTVWinnerHighlight();
// Show TV mode indicator
setTimeout(() => {
const indicator = document.getElementById('tvRefreshIndicator');
indicator.classList.add('show');
setTimeout(() => {
indicator.classList.remove('show');
}, 4000);
}, 1000);
// Log TV mode
console.log(`🏆 ${participants ? participants.length : 0} participants displayed`);
});
// Handle screen size changes
window.addEventListener('resize', function() {
// Force recalculation of layout
document.body.style.display = 'none';
document.body.offsetHeight; // Trigger reflow
document.body.style.display = '';
});
</script>
</body>
</html>