feat: add tokens column to dashboard and update rendering logic
All checks were successful
Build and Push Docker Image / docker (push) Successful in 8s

This commit is contained in:
2025-09-05 15:21:48 +02:00
parent e70cbbb712
commit de2c7b0a3a
3 changed files with 107 additions and 91 deletions

View File

@@ -7,7 +7,6 @@ export const $nameDisplay = el('nameDisplay');
export const $status = el('status');
export const $guesser = el('guesser');
export const $timeline = el('timeline');
export const $tokens = el('tokens');
export const $audio = el('audio');
export const $np = el('nowPlaying');
export const $npTitle = el('npTitle');

View File

@@ -18,7 +18,6 @@ import {
$startGame,
$status,
$timeline,
$tokens,
} from './dom.js';
export function renderRoom(room) {
@@ -58,6 +57,7 @@ export function renderRoom(room) {
? '<span class="text-emerald-600">bereit</span>'
: '<span class="text-slate-400">-</span>';
const score = room.state.timeline?.[p.id]?.length ?? 0;
const tokens = room.state.tokens?.[p.id] ?? 0;
const isMe = p.id === state.playerId;
return `
<tr class="align-top">
@@ -71,6 +71,7 @@ export function renderRoom(room) {
<td class="py-2 pr-3">${connected}</td>
<td class="py-2 pr-3">${ready}</td>
<td class="py-2 pr-3 font-semibold tabular-nums">${score}</td>
<td class="py-2 pr-3 font-semibold tabular-nums">${tokens}</td>
</tr>`;
})
.join('');
@@ -93,7 +94,6 @@ export function renderRoom(room) {
`;
})
.join('');
$tokens.textContent = room.state.tokens?.[state.playerId] ?? 0;
if ($readyChk) {
const serverReady = !!me?.ready;
if (state.pendingReady === null || state.pendingReady === undefined) {