Veto-Timer als Leiste in Teamfarbe
Die verbleibende Zeit des Veto-Schritts erscheint als Leiste mit Sekundenanzeige, in den letzten 10 Sekunden rot. Der Server schickt die Schrittdauer mit, damit die Leiste zu VETO_STEP_SECONDS passt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
364c0b57c2
commit
d560c15fef
3 files changed
+20
-2
No files matched your search
@@ -39,7 +39,7 @@ export default function VetoBoard({ state, viewer, act, busy, compact = false })
|
||||
? 'Live-Ansicht – nur Captains können wählen.'
|
||||
: 'Das andere Team ist am Zug.'}
|
||||
</span>
|
||||
{left !== null && <span className="turn-timer">Noch {Math.ceil(left / 1000)} s</span>}
|
||||
{left !== null && <TimerBar left={left} totalMs={(veto.stepSeconds || 30) * 1000} />}
|
||||
</div>
|
||||
)}
|
||||
{!current && veto.done && !compact && <div className="turn turn-done">Veto abgeschlossen</div>}
|
||||
@@ -132,6 +132,18 @@ function statusText(m, teams) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Leiste für die verbleibende Zeit des Veto-Schritts. In den letzten 10 Sekunden wird sie rot. */
|
||||
function TimerBar({ left, totalMs }) {
|
||||
const seconds = Math.ceil(left / 1000);
|
||||
const percent = Math.max(0, Math.min(100, (left / totalMs) * 100));
|
||||
return (
|
||||
<div className={`turn-timer ${left <= 10_000 ? 'is-low' : ''}`} role="timer" aria-label={`Noch ${seconds} Sekunden`}>
|
||||
<div className="turn-bar"><span style={{ width: `${percent}%` }} /></div>
|
||||
<span className="turn-seconds">{seconds} s</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Verbleibende Zeit des Veto-Schritts: der Server setzt sie bei jeder Änderung, danach zählt die Anzeige lokal herunter. */
|
||||
function useCountdown(ms) {
|
||||
const [left, setLeft] = useState(ms ?? null);
|
||||
|
||||
Reference in new issue
Block a user