M7: Frontend - HTML/JS/CSS mit dunklem Design, Vollbild, WebSocket-Updates, embed.FS-Integration

- Frontend: index.html, style.css, app.js
  - Dunkles Kontrast-Design mit Team-Farben (Rot/Grün)
  - Vollbild-Toggle, Responsive Design
  - Echtzeit-Updates über WebSocket + Polling-Fallback
  - Tastatur-Shortcuts (R/G für Punkte, N für nächste Runde)
  - Rundenverlauf mit Farbcodierung

- Go-Integration:
  - frontend.go: embed.FS für statische Dateien
  - websocket.go: WebSocket-Handler (/ws) für State-Broadcast
  - httpapi.go: broadcastState() nach jeder Mutation, /ws-Route
  - main.go: api.SetupFrontend() für Frontend-Einbettung
  - Frontend unter '/' verfügbar, API unter '/api/'

- Tests: 17 End-to-End-Tests bestanden
  - Alle HTTP-Endpunkte funktionsfähig
  - Frontend-Assets korrekt eingebettet
  - Persistenz (state.json) funktioniert
This commit is contained in:
2026-07-14 16:32:21 +02:00
parent ac9d7eff1d
commit bd05edfb9c
9 changed files with 1669 additions and 30 deletions
+100
View File
@@ -0,0 +1,100 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#0a0a1a">
<title>SportPunktetafel</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="app" class="fullscreen-container">
<!-- Header -->
<header class="app-header">
<div class="header-left">
<h1 class="app-title">⚡ SPORTPUNKTETAFEL</h1>
<span id="fullscreen-toggle" class="fullscreen-btn" title="Vollbild (F11)">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="15 3 21 3 21 9"></polyline>
<polyline points="9 21 3 21 3 15"></polyline>
<line x1="21" y1="3" x2="14" y2="10"></line>
<line x1="3" y1="21" x2="10" y2="14"></line>
</svg>
</span>
</div>
<div class="header-center">
<div id="round-display" class="round-display">Runde 1 von 0</div>
</div>
<div class="header-right">
<button id="reset-btn" class="reset-btn" title="Reset (Escape)">
<svg class="icon icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="1 4 1 10 7 10"></polyline>
<path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path>
</svg>
<span>Reset</span>
</button>
</div>
</header>
<!-- Error Banner -->
<div id="error-banner" class="error-banner hidden">
<span id="error-message">Verbindungsfehler</span>
</div>
<!-- Scoreboard -->
<main class="scoreboard">
<!-- Red Team -->
<section class="team-panel red-team" id="red-panel">
<div class="team-color-bar" aria-hidden="true"></div>
<div class="team-info">
<span class="team-label" id="red-label">ROT</span>
</div>
<div class="score-display">
<span class="score-value" id="red-score" aria-live="polite" aria-atomic="true">0</span>
</div>
<div class="last-points" id="red-points">Punkte: 0</div>
</section>
<!-- Green Team -->
<section class="team-panel green-team" id="green-panel">
<div class="team-color-bar" aria-hidden="true"></div>
<div class="team-info">
<span class="team-label" id="green-label">GRÜN</span>
</div>
<div class="score-display">
<span class="score-value" id="green-score" aria-live="polite" aria-atomic="true">0</span>
</div>
<div class="last-points" id="green-points">Punkte: 0</div>
</section>
</main>
<!-- Round History -->
<footer class="round-history">
<div id="rounds-list" class="rounds-list" role="list" aria-label="Rundenverlauf">
<!-- Dynamically populated -->
</div>
</footer>
<!-- Connection Status -->
<div id="connection-status" class="connection-status">
<span class="status-dot" id="status-dot"></span>
<span id="status-text">Verbinde…</span>
</div>
</div>
<!-- Reset Confirmation Dialog -->
<div id="confirm-dialog" class="modal-overlay hidden">
<div class="modal-dialog">
<h2 class="modal-title">Punktestand zurücksetzen?</h2>
<p class="modal-text">Sollen alle Scores und Runden zurückgesetzt werden?</p>
<div class="modal-actions">
<button id="cancel-reset" class="modal-btn modal-btn-secondary">Abbrechen</button>
<button id="confirm-reset" class="modal-btn modal-btn-danger">Ja, Reset</button>
</div>
</div>
</div>
<script src="app.js"></script>
</body>
</html>