From 2c352b23929699afff6c7b57d8df750d8e8df6ee Mon Sep 17 00:00:00 2001 From: orfelorfel23 Date: Thu, 16 Apr 2026 20:40:27 +0200 Subject: [PATCH] UI Refresh & Logic Updates: New answer color scheme, improved Boolean/Number handling for results, and localized formatting. --- public/index.html | 27 ++++++++++-------------- public/js/admin.js | 50 ++++++++++++++++++-------------------------- public/js/app.js | 9 +++++--- public/js/present.js | 2 +- public/present.html | 8 +++---- 5 files changed, 41 insertions(+), 55 deletions(-) diff --git a/public/index.html b/public/index.html index 9aaf440..c4bd41c 100644 --- a/public/index.html +++ b/public/index.html @@ -16,23 +16,22 @@ background: #111111 url('/img/bg.png') center/cover fixed; } - /* Answer button base colors */ .answer-a { - background: #dc2626; - } - - .answer-a:hover { - background: #b91c1c; - } - - .answer-b { background: #2563eb; } - .answer-b:hover { + .answer-a:hover { background: #1d4ed8; } + .answer-b { + background: #7c3aed; + } + + .answer-b:hover { + background: #6d28d9; + } + .answer-c { background: #d97706; } @@ -42,14 +41,13 @@ } .answer-d { - background: #16a34a; + background: #0891b2; } .answer-d:hover { - background: #15803d; + background: #0e7490; } - /* Selected state */ .answer-a.selected, .answer-b.selected, .answer-c.selected, @@ -58,7 +56,6 @@ transform: scale(1.03); } - /* Disabled state */ .answer-a.disabled, .answer-b.disabled, .answer-c.disabled, @@ -67,7 +64,6 @@ cursor: not-allowed; } - /* Ensure Tailwind doesn't override answer button styles */ button.answer-a, button.answer-b, button.answer-c, @@ -83,7 +79,6 @@ transform: scale(1.03); } - /* Fire gradient for headings */ .fire-gradient { background: linear-gradient(135deg, #dc2626, #f59e0b); -webkit-background-clip: text; diff --git a/public/js/admin.js b/public/js/admin.js index 7ba191a..879d0c0 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -158,8 +158,9 @@ function StatsPage() { const u = a['Nutzername'] || 'Unbekannt'; if (!users[u]) users[u] = { total: 0, correct: 0, points: 0 }; users[u].total++; - if (a['Richtig']) users[u].correct++; - users[u].points += a['Punkte'] || 0; + const richtig = a['Richtig']; + if (richtig === true || richtig === 'true' || richtig === 1) users[u].correct++; + users[u].points += Number(a['Punkte']) || 0; }); return ( @@ -167,21 +168,11 @@ function StatsPage() {

๐Ÿ“Š รœbersicht

-
-
{Object.keys(sessions).length}
-
Sessions
-
-
-
{Object.keys(users).length}
-
Teilnehmer
-
-
-
{data.answers.length}
-
Antworten
-
+
{Object.keys(sessions).length}
Sessions
+
{Object.keys(users).length}
Teilnehmer
+
{data.answers.length}
Antworten
-

๐Ÿ‘ค Pro Teilnehmer

setFilter(e.target.value)} /> @@ -189,28 +180,27 @@ function StatsPage() { - {Object.entries(users) - .filter(([u]) => !filter || u.toLowerCase().includes(filter.toLowerCase())) - .sort(([, a], [, b]) => b.points - a.points) - .map(([u, v]) => ( - - - - - - - - ))} + {Object.entries(users).filter(([u]) => !filter || u.toLowerCase().includes(filter.toLowerCase())).sort(([, a], [, b]) => b.points - a.points).map(([u, v]) => ( + + + + + + + + ))}
NameRichtigGesamtQuotePunkte
{u}{v.correct}{v.total}{Math.round((v.correct / v.total) * 100)}%{v.points}
{u}{v.correct}{v.total}{Math.round((v.correct / v.total) * 100)}%{v.points.toLocaleString('de')}
-

๐Ÿ“ Sessions

{Object.entries(sessions).reverse().map(([sid, s]) => { const total = s.answers.length; - const correct = s.answers.filter((a) => a['Richtig']).length; + const correct = s.answers.filter((a) => { + const v = a['Richtig']; + return v === true || v === 'true' || v === 1; + }).length; const uniqueUsers = new Set(s.answers.map((a) => a['Nutzername'])).size; return (
@@ -485,7 +475,7 @@ function LiveControlPage({ token, code, ws, initialSession }) { {result?.stats && (
{Object.entries(result.stats).map(([k, v]) => ( -
+
{k}: {v}
))} diff --git a/public/js/app.js b/public/js/app.js index 736a41b..85b6e71 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -705,8 +705,11 @@ function MyResultsPage({ navigate }) {
{Object.entries(sessions).reverse().map(([sid, s]) => { const total = s.answers.length; - const cor = s.answers.filter((a) => a['Richtig']).length; - const points = s.answers.reduce((sum, a) => sum + (a['Punkte'] || 0), 0); + const cor = s.answers.filter((a) => { + const v = a['Richtig']; + return v === true || v === 'true' || v === 1; + }).length; + const points = s.answers.reduce((sum, a) => sum + (Number(a['Punkte']) || 0), 0); return (
@@ -716,7 +719,7 @@ function MyResultsPage({ navigate }) {
{s.date ? new Date(s.date).toLocaleDateString('de') : ''}
-

{cor}/{total} richtig โ€” {points} Punkte

+

{cor}/{total} richtig โ€” {points.toLocaleString('de')} Punkte

); })} diff --git a/public/js/present.js b/public/js/present.js index bfb283d..051f0f3 100644 --- a/public/js/present.js +++ b/public/js/present.js @@ -113,7 +113,7 @@ function PresentApp() { {question?.typ?.toLowerCase() !== 'freitext' && (
{(question?.antworten || []).map((a) => { - const colors = { A: 'bg-red-600', B: 'bg-blue-600', C: 'bg-amber-600', D: 'bg-green-600' }; + const colors = { A: 'bg-blue-600', B: 'bg-purple-600', C: 'bg-amber-600', D: 'bg-cyan-600' }; return (
{a.text}
); diff --git a/public/present.html b/public/present.html index 13aacf6..2b53d1c 100644 --- a/public/present.html +++ b/public/present.html @@ -16,13 +16,12 @@ background: #111111 url('/img/bg.png') center/cover fixed; } - /* Answer colors for presentation view */ .answer-a { - background: #dc2626; + background: #2563eb; } .answer-b { - background: #2563eb; + background: #7c3aed; } .answer-c { @@ -30,10 +29,9 @@ } .answer-d { - background: #16a34a; + background: #0891b2; } - /* Fire gradient for headings */ .fire-gradient { background: linear-gradient(135deg, #dc2626, #f59e0b); -webkit-background-clip: text;