Fix: bug in timer

This commit is contained in:
Dorian Zedler 2023-01-05 13:01:38 +01:00
parent f42e8478e1
commit bf922ead94
Signed by: dorian
GPG key ID: 989DE36109AFA354
2 changed files with 1 additions and 8 deletions

View file

@ -25,15 +25,8 @@
</hgroup>
<div x-data="Timer">
<div x-show="!time">
<div class="timer loading" href="#" aria-busy="true">
please wait
</div>
</div>
<div x-show="time">
<p :class="'timer' + ($store.remoteState.isMyTurn ? ' my-turn':'') + (time < 0 ? ' over':'')"
x-text="time + 's'"></p>
</div>
</div>
<button @click="$store.remoteState.giveTurnToNextPlayer()"

View file

@ -47,7 +47,7 @@ function Timer() {
if (!lastPlayerSwitch) {
this.time = null;
} else {
this.time = parseInt(
this.time = Math.floor(
((Alpine.store("remoteState").interval * 1000) - (new Date().getTime() - lastPlayerSwitch)) / 1000
);
}