hbx-luv / codetango

The best way to play Codenames online
https://play.hbx.vision/
GNU General Public License v3.0
2 stars 3 forks source link

Pause the timer when a clue is proposed #74

Open Matttaylor8910 opened 4 years ago

Matttaylor8910 commented 4 years ago

On the game itself, create a new property called pausedAt: number that holds onto a unix timestamp for when the game was paused. This should be set as soon as a spymaster proposes a clue so that they lose no time while the other spymaster is considering approving/denying the clue.

When the status of the proposed clue changes (including when a spymaster cancels their own clue), delete that field from the game and increment turnEnds by the amount of time the game was paused (Date.now() - pausedAt).

The timer component should just show the remaining time when pausedAt is set (turnEnds - pausedAt) and show a paused icon (maybe <ion-icon name="pause-circle"></ion-icon>?) next to the remaining time with a tooltip indicating that the spymaster is reviewing the clue.