624 lines
20 KiB
HTML
624 lines
20 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{ player.name }} - Player Stats</title>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js"></script>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background: #f5f5f5;
|
|
height: 100vh;
|
|
color: #333;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* Enhanced Navigation Bar */
|
|
.navbar {
|
|
background: white;
|
|
color: black;
|
|
padding: 15px 25px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
border-bottom: 2px solid #ccc;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.navbar-title {
|
|
font-size: 1.5rem;
|
|
font-weight: bold;
|
|
color: #333;
|
|
}
|
|
|
|
.navbar-controls {
|
|
display: flex;
|
|
gap: 10px;
|
|
align-items: center;
|
|
}
|
|
|
|
.nav-btn {
|
|
background: #f8f9fa;
|
|
border: 2px solid #e9ecef;
|
|
cursor: pointer;
|
|
padding: 8px 16px;
|
|
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.85rem;
|
|
}
|
|
|
|
.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 Container */
|
|
.container {
|
|
height: calc(100vh - 60px);
|
|
padding: 15px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 15px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* Top Section - Stats and Chart */
|
|
.top-section {
|
|
display: grid;
|
|
grid-template-columns: 320px 1fr;
|
|
gap: 15px;
|
|
height: 50%;
|
|
min-height: 280px;
|
|
}
|
|
|
|
/* Stats Panel */
|
|
.stats-panel {
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
padding: 18px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.panel-title {
|
|
font-size: 1.1rem;
|
|
font-weight: bold;
|
|
color: #333;
|
|
margin-bottom: 15px;
|
|
border-bottom: 2px solid #007bff;
|
|
padding-bottom: 5px;
|
|
}
|
|
|
|
.stats-grid {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 10px;
|
|
flex: 1;
|
|
}
|
|
|
|
.stat-item {
|
|
text-align: center;
|
|
padding: 12px 8px;
|
|
background: #f8f9fa;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 1.4rem;
|
|
font-weight: bold;
|
|
color: #007bff;
|
|
margin-bottom: 3px;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 0.7rem;
|
|
color: #666;
|
|
text-transform: uppercase;
|
|
font-weight: 500;
|
|
}
|
|
|
|
/* Chart Panel */
|
|
.chart-panel {
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
padding: 18px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.chart-container {
|
|
position: relative;
|
|
flex: 1;
|
|
min-height: 180px;
|
|
}
|
|
|
|
/* Bottom Section - History */
|
|
.bottom-section {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 15px;
|
|
flex: 1;
|
|
min-height: 0;
|
|
}
|
|
|
|
.history-section {
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
padding: 18px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 0;
|
|
}
|
|
|
|
.history-list {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding-right: 8px;
|
|
min-height: 0;
|
|
}
|
|
|
|
/* Custom scrollbar */
|
|
.history-list::-webkit-scrollbar {
|
|
width: 6px;
|
|
}
|
|
|
|
.history-list::-webkit-scrollbar-track {
|
|
background: #f8f9fa;
|
|
border-radius: 3px;
|
|
}
|
|
|
|
.history-list::-webkit-scrollbar-thumb {
|
|
background: #dee2e6;
|
|
border-radius: 3px;
|
|
}
|
|
|
|
.history-list::-webkit-scrollbar-thumb:hover {
|
|
background: #adb5bd;
|
|
}
|
|
|
|
/* Tournament History Items */
|
|
.history-item {
|
|
background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
|
|
border-radius: 8px;
|
|
padding: 12px;
|
|
margin-bottom: 8px;
|
|
transition: all 0.3s ease;
|
|
border-left: 3px solid #2196f3;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.history-item:hover {
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
|
|
background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
|
|
}
|
|
|
|
.history-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.history-date {
|
|
font-size: 0.8rem;
|
|
color: #1976d2;
|
|
margin-bottom: 2px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.history-type {
|
|
font-size: 0.75rem;
|
|
font-weight: bold;
|
|
color: #0d47a1;
|
|
}
|
|
|
|
.history-score {
|
|
font-size: 1.2rem;
|
|
font-weight: bold;
|
|
color: #2e7d32;
|
|
text-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
/* League History Items */
|
|
.league-history-item {
|
|
background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
|
|
border-radius: 8px;
|
|
padding: 12px;
|
|
margin-bottom: 8px;
|
|
transition: all 0.3s ease;
|
|
border-left: 3px solid #9c27b0;
|
|
}
|
|
|
|
.league-history-item:hover {
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(156, 39, 176, 0.2);
|
|
background: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%);
|
|
}
|
|
|
|
.league-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: flex-start;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.league-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.league-score-display {
|
|
font-size: 1.3rem;
|
|
font-weight: bold;
|
|
color: #4a148c;
|
|
text-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.league-details {
|
|
background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
|
|
border: 1px solid #81c784;
|
|
border-radius: 6px;
|
|
padding: 8px;
|
|
font-size: 0.7rem;
|
|
}
|
|
|
|
.league-summary {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 6px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.league-final-score {
|
|
color: #1b5e20;
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.league-total-score {
|
|
color: #388e3c;
|
|
font-size: 0.75rem;
|
|
}
|
|
|
|
.tournament-results {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 4px;
|
|
}
|
|
|
|
.tournament-result {
|
|
padding: 4px 6px;
|
|
border-radius: 4px;
|
|
font-size: 0.65rem;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
transition: transform 0.2s ease;
|
|
}
|
|
|
|
.tournament-result:hover {
|
|
transform: scale(1.05);
|
|
}
|
|
|
|
.tournament-result.participated {
|
|
background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
|
|
color: #1b5e20;
|
|
border: 1px solid #81c784;
|
|
}
|
|
|
|
.tournament-result.joker {
|
|
background: linear-gradient(135deg, #fff3e0, #ffcc02);
|
|
color: #e65100;
|
|
border: 1px solid #ffb74d;
|
|
}
|
|
|
|
/* Empty State */
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 20px;
|
|
color: #666;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100%;
|
|
}
|
|
|
|
.empty-icon {
|
|
font-size: 2rem;
|
|
margin-bottom: 8px;
|
|
opacity: 0.5;
|
|
}
|
|
|
|
/* Responsive Design */
|
|
@media (max-width: 1200px) {
|
|
.top-section {
|
|
grid-template-columns: 1fr;
|
|
height: 55%;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.navbar {
|
|
padding: 10px 15px;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
height: auto;
|
|
}
|
|
|
|
.navbar-controls {
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
}
|
|
|
|
.container {
|
|
height: calc(100vh - 80px);
|
|
padding: 10px;
|
|
}
|
|
|
|
.top-section, .bottom-section {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.stats-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.top-section {
|
|
height: auto;
|
|
min-height: 200px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- Navigation Bar -->
|
|
<div class="navbar">
|
|
<div class="navbar-title">📊 {{ player.name }} - Stats</div>
|
|
<div class="navbar-controls">
|
|
<a href="/archive/player-analysis" class="nav-btn">👤 All Players</a>
|
|
<a href="/archive" class="nav-btn">📚 Archive</a>
|
|
<a href="/" class="nav-btn primary">🏠 Dashboard</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<!-- Top Section - Stats and Chart -->
|
|
<div class="top-section">
|
|
<!-- Stats Panel -->
|
|
<div class="stats-panel">
|
|
<div class="panel-title">📊 Statistics</div>
|
|
<div class="stats-grid">
|
|
<div class="stat-item">
|
|
<div class="stat-value">{{ stats.total_tournaments }}</div>
|
|
<div class="stat-label">Tournaments</div>
|
|
</div>
|
|
<div class="stat-item">
|
|
<div class="stat-value">{{ stats.total_leagues }}</div>
|
|
<div class="stat-label">Leagues</div>
|
|
</div>
|
|
<div class="stat-item">
|
|
<div class="stat-value">{{ stats.best_tournament_score }}</div>
|
|
<div class="stat-label">Best Score</div>
|
|
</div>
|
|
<div class="stat-item">
|
|
<div class="stat-value">{{ stats.average_tournament_score|round|int if stats.average_tournament_score > 0 else 0 }}</div>
|
|
<div class="stat-label">Average</div>
|
|
</div>
|
|
<div class="stat-item">
|
|
<div class="stat-value">{{ stats.total_shots_fired|default(0) }}</div>
|
|
<div class="stat-label">Total Shots</div>
|
|
</div>
|
|
<div class="stat-item">
|
|
<div class="stat-value">{{ stats.worst_tournament_score if stats.worst_tournament_score > 0 else 0 }}</div>
|
|
<div class="stat-label">Worst Score</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Performance Chart -->
|
|
<div class="chart-panel">
|
|
<div class="panel-title">📈 Performance Trend</div>
|
|
<div class="chart-container">
|
|
<canvas id="performanceChart"></canvas>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Bottom Section - History -->
|
|
<div class="bottom-section">
|
|
<!-- Tournament History -->
|
|
<div class="history-section">
|
|
<div class="panel-title">🎯 Tournament History</div>
|
|
{% if stats.tournament_history %}
|
|
<div class="history-list">
|
|
{% for tournament in stats.tournament_history[:10] %}
|
|
<div class="history-item">
|
|
<div class="history-info">
|
|
<div class="history-date">{{ tournament.date[:10] if tournament.date != 'Unknown' else 'Unknown Date' }}</div>
|
|
<div class="history-type">{{ tournament.tournament_type.replace('_', ' ')|title }} • {{ tournament.shots_fired }} shots</div>
|
|
</div>
|
|
<div class="history-score">{{ tournament.score }}</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% if stats.tournament_history|length > 10 %}
|
|
<div style="text-align: center; padding: 8px; color: #666; font-size: 0.8rem;">
|
|
... and {{ stats.tournament_history|length - 10 }} more
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<div class="empty-state">
|
|
<div class="empty-icon">🎯</div>
|
|
<div>No tournament history</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- League History -->
|
|
<div class="history-section">
|
|
<div class="panel-title">🏆 League History</div>
|
|
{% if stats.league_history %}
|
|
<div class="history-list">
|
|
{% for league in stats.league_history %}
|
|
<div class="league-history-item">
|
|
<div class="league-header">
|
|
<div class="league-info">
|
|
<div class="history-date">{{ league.date[:10] if league.date != 'Unknown' else 'Unknown Date' }}</div>
|
|
<div class="history-type">
|
|
League Championship • {{ league.tournaments_participated }}/6 tournaments
|
|
{% if league.joker_used %} • 🃏 Joker Used{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="league-score-display">{{ league.final_score }}</div>
|
|
</div>
|
|
|
|
<div class="league-details">
|
|
<div class="league-summary">
|
|
<span>Final Score: <span class="league-final-score">{{ league.final_score }}</span></span>
|
|
<span class="league-total-score">Total: {{ league.total_score }}</span>
|
|
</div>
|
|
<div class="tournament-results">
|
|
{% for result in league.tournament_results %}
|
|
<span class="tournament-result {{ 'participated' if result.participated else 'joker' }}">
|
|
T{{ result.tournament }}: {{ result.score if result.participated else 'Joker' }}
|
|
</span>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div class="empty-state">
|
|
<div class="empty-icon">🏆</div>
|
|
<div>No league history</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Player data from Flask
|
|
const playerStats = {{ stats|tojson }};
|
|
|
|
// Initialize page
|
|
function initializePage() {
|
|
createPerformanceChart();
|
|
}
|
|
|
|
// Create performance trend chart
|
|
function createPerformanceChart() {
|
|
const ctx = document.getElementById('performanceChart').getContext('2d');
|
|
const scores = playerStats.tournament_scores || [];
|
|
|
|
if (scores.length === 0) {
|
|
ctx.font = '14px Arial';
|
|
ctx.fillStyle = '#666';
|
|
ctx.textAlign = 'center';
|
|
ctx.fillText('No tournament data available', ctx.canvas.width / 2, ctx.canvas.height / 2);
|
|
return;
|
|
}
|
|
|
|
new Chart(ctx, {
|
|
type: 'line',
|
|
data: {
|
|
labels: scores.map((_, i) => `T${i + 1}`),
|
|
datasets: [{
|
|
label: 'Tournament Score',
|
|
data: scores,
|
|
borderColor: '#28a745',
|
|
backgroundColor: 'rgba(40, 167, 69, 0.15)',
|
|
borderWidth: 3,
|
|
fill: true,
|
|
tension: 0.4,
|
|
pointRadius: 5,
|
|
pointHoverRadius: 8,
|
|
pointBackgroundColor: '#28a745',
|
|
pointBorderColor: '#fff',
|
|
pointBorderWidth: 2,
|
|
pointHoverBackgroundColor: '#1e7e34',
|
|
pointHoverBorderColor: '#fff'
|
|
}]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
maintainAspectRatio: false,
|
|
plugins: {
|
|
legend: { display: false },
|
|
tooltip: {
|
|
backgroundColor: 'rgba(40, 167, 69, 0.9)',
|
|
titleColor: '#fff',
|
|
bodyColor: '#fff',
|
|
borderColor: '#28a745',
|
|
borderWidth: 2,
|
|
callbacks: {
|
|
title: function(context) {
|
|
return `Tournament ${context[0].dataIndex + 1}`;
|
|
},
|
|
label: function(context) {
|
|
return `Score: ${context.parsed.y}`;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true,
|
|
grid: { color: 'rgba(40, 167, 69, 0.1)' },
|
|
ticks: {
|
|
color: '#28a745',
|
|
font: { size: 11, weight: 'bold' }
|
|
}
|
|
},
|
|
x: {
|
|
grid: { color: 'rgba(40, 167, 69, 0.1)' },
|
|
ticks: {
|
|
color: '#28a745',
|
|
font: { size: 11, weight: 'bold' }
|
|
}
|
|
}
|
|
},
|
|
interaction: {
|
|
intersect: false,
|
|
mode: 'index'
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// Initialize page when DOM is loaded
|
|
document.addEventListener('DOMContentLoaded', initializePage);
|
|
</script>
|
|
</body>
|
|
</html> |