From 70ceb2da251d3db22dbcee81e0d04e33b5d9fbc5 Mon Sep 17 00:00:00 2001 From: Carsten Graf Date: Mon, 8 Sep 2025 19:14:17 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20Add=20privacy=20settings=20for?= =?UTF-8?q?=20leaderboard=20visibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ 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 --- public/css/dashboard.css | 116 +++++++++++++++++++++++++++++++++++++++ public/dashboard.html | 43 ++++++++++++++- public/js/dashboard.js | 99 +++++++++++++++++++++++++++++++++ routes/api.js | 49 +++++++++++++++++ 4 files changed, 304 insertions(+), 3 deletions(-) diff --git a/public/css/dashboard.css b/public/css/dashboard.css index 9d99218..c7898db 100644 --- a/public/css/dashboard.css +++ b/public/css/dashboard.css @@ -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%; + } +} diff --git a/public/dashboard.html b/public/dashboard.html index 9e60177..2791969 100644 --- a/public/dashboard.html +++ b/public/dashboard.html @@ -101,9 +101,10 @@

Verfolge deine Leistung und überwache wichtige Metriken. Dieser Abschnitt wird detaillierte Analysen anzeigen, sobald wir die Funktion implementieren.

-
-

⚡ Quick Actions

-

Hier findest du häufige Aufgaben und Schnellzugriffe. Wir werden Buttons für das Erstellen neuer Aufzeichnungen, das Verwalten von Einstellungen und mehr hinzufügen.

+
+

⚙️ Settings

+

Verwalte deine Privatsphäre-Einstellungen und andere Optionen.

+
@@ -296,6 +297,42 @@
+ + +