Files
Discord-ai-chatbot/templates/leaderboard.html
2025-08-18 15:16:21 +02:00

379 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Level Leaderboard</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
body {
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
min-height: 100vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #e0e0e0;
}
.leaderboard-container {
background: rgba(30, 30, 46, 0.95);
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
padding: 2rem;
margin-top: 2rem;
}
.leaderboard-header {
text-align: center;
margin-bottom: 2rem;
position: relative;
}
.leaderboard-title {
color: #f8f9fa;
font-weight: 700;
font-size: 2.5rem;
margin-bottom: 0.5rem;
text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}
.leaderboard-subtitle {
color: #a0a0a0;
font-size: 1.1rem;
font-weight: 400;
}
.trophy-icon {
font-size: 3rem;
color: #ffd700;
margin-bottom: 1rem;
animation: bounce 2s infinite;
text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
40% { transform: translateY(-10px); }
60% { transform: translateY(-5px); }
}
.profile-picture {
width: 50px;
height: 50px;
border-radius: 50%;
object-fit: cover;
border: 3px solid #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transition: transform 0.3s ease;
}
.profile-picture:hover {
transform: scale(1.1);
}
.table-container {
max-height: 700px;
overflow-y: auto;
border-radius: 15px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.table {
margin-bottom: 0;
background: rgba(40, 40, 56, 0.9);
color: #e0e0e0;
}
.table thead th {
background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
color: #f7fafc;
border: none;
padding: 1rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.9rem;
position: sticky;
top: 0;
z-index: 10;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.table tbody tr {
transition: all 0.3s ease;
border: none;
background: rgba(40, 40, 56, 0.5);
}
.table tbody tr:hover {
background: linear-gradient(135deg, rgba(74, 85, 104, 0.8) 0%, rgba(45, 55, 72, 0.8) 100%);
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.table tbody td {
padding: 1rem;
vertical-align: middle;
border: none;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
color: #e0e0e0;
}
.rank-badge {
display: inline-flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border-radius: 50%;
font-weight: bold;
color: white;
font-size: 1.1rem;
}
.rank-1 {
background: linear-gradient(135deg, #FFD700, #FFA500);
box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}
.rank-2 {
background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
}
.rank-3 {
background: linear-gradient(135deg, #CD7F32, #B8860B);
box-shadow: 0 0 15px rgba(205, 127, 50, 0.3);
}
.rank-other {
background: linear-gradient(135deg, #4a5568, #2d3748);
color: #cbd5e0;
}
.level-badge {
background: linear-gradient(135deg, #48bb78, #38a169);
color: white;
padding: 0.5rem 1rem;
border-radius: 25px;
font-weight: 600;
display: inline-block;
min-width: 60px;
text-align: center;
box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}
.xp-badge {
background: linear-gradient(135deg, #4299e1, #3182ce);
color: white;
padding: 0.5rem 1rem;
border-radius: 25px;
font-weight: 600;
display: inline-block;
min-width: 80px;
text-align: center;
box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}
.username {
font-weight: 600;
color: #f7fafc;
font-size: 1.1rem;
}
.join-date {
color: #a0aec0;
font-size: 0.9rem;
}
.no-users-message {
text-align: center;
padding: 3rem;
color: #a0aec0;
font-size: 1.2rem;
}
.no-users-icon {
font-size: 4rem;
color: #4a5568;
margin-bottom: 1rem;
}
.back-button {
background: linear-gradient(135deg, #4a5568, #2d3748);
border: none;
border-radius: 25px;
padding: 0.75rem 2rem;
color: #f7fafc;
font-weight: 600;
text-decoration: none;
display: inline-block;
transition: all 0.3s ease;
margin-top: 2rem;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.back-button:hover {
background: linear-gradient(135deg, #2d3748, #1a202c);
color: #f7fafc;
text-decoration: none;
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}
.stats-card {
background: rgba(45, 55, 72, 0.8);
border-radius: 15px;
padding: 1.5rem;
margin-bottom: 2rem;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.stats-title {
color: #cbd5e0;
font-weight: 600;
margin-bottom: 0.5rem;
}
.stats-value {
color: #f7fafc;
font-size: 2rem;
font-weight: 700;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Responsive Design */
@media (max-width: 768px) {
.leaderboard-title {
font-size: 2rem;
}
.table-container {
max-height: 500px;
}
.profile-picture {
width: 40px;
height: 40px;
}
.rank-badge {
width: 35px;
height: 35px;
font-size: 1rem;
}
.table thead th,
.table tbody td {
padding: 0.75rem 0.5rem;
font-size: 0.9rem;
}
.leaderboard-container {
padding: 1rem;
margin-top: 1rem;
}
}
</style>
</head>
<body>
{% include 'navigation.html' %}
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-lg-10 col-xl-8">
<div class="leaderboard-container">
<div class="leaderboard-header">
<i class="fas fa-trophy trophy-icon"></i>
<h1 class="leaderboard-title">Level Leaderboard</h1>
<p class="leaderboard-subtitle">{{ guild_name or 'Unknown Server' }} • Top Performers</p>
</div>
{% if leaderboard|length > 0 %}
<div class="row mb-4">
<div class="col-md-4">
<div class="stats-card text-center">
<div class="stats-title">Total Players</div>
<div class="stats-value">{{ leaderboard|length }}</div>
</div>
</div>
<div class="col-md-4">
<div class="stats-card text-center">
<div class="stats-title">Highest Level</div>
<div class="stats-value">{{ leaderboard[0].level if leaderboard else 0 }}</div>
</div>
</div>
<div class="col-md-4">
<div class="stats-card text-center">
<div class="stats-title">Total XP</div>
<div class="stats-value">{{ leaderboard|sum(attribute='xp') if leaderboard else 0 }}</div>
</div>
</div>
</div>
<div class="table-container">
<table class="table">
<thead>
<tr>
<th><i class="fas fa-medal"></i> Rank</th>
<th><i class="fas fa-user"></i> Profile</th>
<th><i class="fas fa-tag"></i> Nickname</th>
<th><i class="fas fa-layer-group"></i> Level</th>
<th><i class="fas fa-star"></i> XP</th>
<th><i class="fas fa-calendar"></i> Joined</th>
</tr>
</thead>
<tbody>
{% for index, user in enumerate(leaderboard, start=1) %}
<tr>
<td>
<span class="rank-badge {% if index == 1 %}rank-1{% elif index == 2 %}rank-2{% elif index == 3 %}rank-3{% else %}rank-other{% endif %}">
{% if index <= 3 %}
<i class="fas fa-crown"></i>
{% else %}
{{ index }}
{% endif %}
</span>
</td>
<td>
<img src="{{ user.profile_picture or '/static/default_profile.png' }}"
class="profile-picture"
alt="Profile Picture"
onerror="this.onerror=null; this.src='/static/default_profile.png';">
</td>
<td>
<span class="username">{{ user.nickname or 'Unknown User' }}</span>
</td>
<td>
<span class="level-badge">{{ user.level }}</span>
</td>
<td>
<span class="xp-badge">{{ "{:,}".format(user.xp) }}</span>
</td>
<td>
<span class="join-date">{{ user.join_date.strftime('%b %d, %Y') if user.join_date else 'N/A' }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="no-users-message">
<i class="fas fa-users no-users-icon"></i>
<h3>No Players Found</h3>
<p>Be the first to join this server's leaderboard!</p>
</div>
{% endif %}
<div class="text-center">
<a href="{{ url_for('user_dashboard', guild_id=guild_id) }}" class="back-button">
<i class="fas fa-arrow-left"></i> Back to Dashboard
</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>