🔒 Add privacy settings for leaderboard visibility

 Features:
- Added show_in_leaderboard column to players table (default: false)
- Replaced Quick Actions with Settings section in dashboard
- Added toggle switch for leaderboard visibility
- Created settings modal with privacy controls

🔧 API Changes:
- Added /api/v1/private/update-player-settings endpoint
- Updated best-times queries to filter by show_in_leaderboard
- Updated times-with-details to respect privacy settings
- Added updated_at column to players table

🎨 UI/UX:
- Modern toggle switch design
- Responsive settings modal
- Success/error notifications
- Clear privacy explanation

🔐 Privacy:
- Default: Times are NOT shown in global leaderboard
- Users can opt-in via settings
- Personal dashboard always shows own times
- Global leaderboard only shows opted-in users
This commit is contained in:
2025-09-08 19:14:17 +02:00
parent ecb6291c74
commit 70ceb2da25
4 changed files with 304 additions and 3 deletions

View File

@@ -1380,3 +1380,119 @@ body {
color: #b3e5fc;
font-size: 0.85rem;
}
/* Settings Modal Styles */
.settings-content {
padding: 1.5rem 0;
}
.setting-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem;
background: #1e293b;
border-radius: 0.75rem;
margin-bottom: 1rem;
border: 1px solid #334155;
}
.setting-info h3 {
color: #ffffff;
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 0.5rem;
}
.setting-info p {
color: #8892b0;
font-size: 0.9rem;
line-height: 1.4;
}
.setting-control {
margin-left: 1rem;
}
/* Toggle Switch Styles */
.toggle-switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
.toggle-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #334155;
transition: 0.3s;
border-radius: 34px;
}
.toggle-slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
transition: 0.3s;
border-radius: 50%;
}
input:checked + .toggle-slider {
background-color: #00d4ff;
}
input:checked + .toggle-slider:before {
transform: translateX(26px);
}
.setting-description {
margin-top: 1rem;
}
.settings-actions {
display: flex;
gap: 1rem;
margin-top: 2rem;
justify-content: flex-end;
}
.settings-actions .btn {
min-width: 120px;
}
/* Responsive Settings */
@media (max-width: 768px) {
.setting-item {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
}
.setting-control {
margin-left: 0;
align-self: flex-end;
}
.settings-actions {
flex-direction: column;
}
.settings-actions .btn {
width: 100%;
}
}