🔒 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

@@ -101,9 +101,10 @@
<p>Verfolge deine Leistung und überwache wichtige Metriken. Dieser Abschnitt wird detaillierte Analysen anzeigen, sobald wir die Funktion implementieren.</p>
</div>
<div class="card">
<h3>⚡ Quick Actions</h3>
<p>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.</p>
<div class="card" onclick="showSettings()" style="cursor: pointer;">
<h3>⚙️ Settings</h3>
<p>Verwalte deine Privatsphäre-Einstellungen und andere Optionen.</p>
<button class="btn btn-primary" style="margin-top: 1rem;" onclick="event.stopPropagation(); showSettings();">Einstellungen öffnen</button>
</div>
<div class="card" onclick="showRFIDSettings()" style="cursor: pointer;">
@@ -296,6 +297,42 @@
</div>
</div>
<!-- Settings Modal -->
<div id="settingsModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">⚙️ Einstellungen</h2>
<span class="close" onclick="closeModal('settingsModal')">&times;</span>
</div>
<div class="settings-content">
<div class="setting-item">
<div class="setting-info">
<h3>🏆 Leaderboard Sichtbarkeit</h3>
<p>Bestimme, ob deine Zeiten im globalen Leaderboard angezeigt werden sollen.</p>
</div>
<div class="setting-control">
<label class="toggle-switch">
<input type="checkbox" id="showInLeaderboard" onchange="updateLeaderboardSetting()">
<span class="toggle-slider"></span>
</label>
</div>
</div>
<div class="setting-description">
<p style="color: #8892b0; font-size: 0.9rem; margin-top: 1rem; padding: 1rem; background: #1e293b; border-radius: 0.5rem;">
<strong>Hinweis:</strong> Wenn diese Option deaktiviert ist, werden deine Zeiten nur in deinem persönlichen Dashboard angezeigt, aber nicht im öffentlichen Leaderboard. Du kannst diese Einstellung jederzeit ändern.
</p>
</div>
<div class="settings-actions">
<button class="btn btn-primary" onclick="saveSettings()">Einstellungen speichern</button>
<button class="btn btn-secondary" onclick="closeModal('settingsModal')">Abbrechen</button>
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer class="footer">
<div class="footer-content">