From 8dde30ebb683198a6f23887f6b78a355fa37648a Mon Sep 17 00:00:00 2001
From: Roan <29734170+14ROVI@users.noreply.github.com>
Date: Wed, 10 Dec 2025 22:51:14 +0000
Subject: [PATCH] Update game timer UI (#2577)
## Description:
- use hh:mm:ss for timer format or mm:ss if no hours are present
- refactor classes and code to be simpler
- move timer inline with the buttons so the whole ui is smaller for more
game space
- update fast forward icon to better represent what it does
- move replay controls below game time ui
### Before:
### After:
## Please complete the following:
- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
## Please put your Discord username so you can be contacted if a bug or
regression is found:
`rovi.`
---
.../images/FastForwardIconSolidWhite.svg | 6 ++
.../graphics/layers/GameRightSidebar.ts | 77 ++++++++-----------
src/client/graphics/layers/ReplayPanel.ts | 14 ++--
src/client/index.html | 4 +-
4 files changed, 45 insertions(+), 56 deletions(-)
create mode 100644 resources/images/FastForwardIconSolidWhite.svg
diff --git a/resources/images/FastForwardIconSolidWhite.svg b/resources/images/FastForwardIconSolidWhite.svg
new file mode 100644
index 000000000..28eb0867a
--- /dev/null
+++ b/resources/images/FastForwardIconSolidWhite.svg
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/src/client/graphics/layers/GameRightSidebar.ts b/src/client/graphics/layers/GameRightSidebar.ts
index 8074c9dc3..394668e03 100644
--- a/src/client/graphics/layers/GameRightSidebar.ts
+++ b/src/client/graphics/layers/GameRightSidebar.ts
@@ -1,10 +1,9 @@
import { html, LitElement } from "lit";
import { customElement, state } from "lit/decorators.js";
import exitIcon from "../../../../resources/images/ExitIconWhite.svg";
+import FastForwardIconSolid from "../../../../resources/images/FastForwardIconSolidWhite.svg";
import pauseIcon from "../../../../resources/images/PauseIconWhite.svg";
import playIcon from "../../../../resources/images/PlayIconWhite.svg";
-import replayRegularIcon from "../../../../resources/images/ReplayRegularIconWhite.svg";
-import replaySolidIcon from "../../../../resources/images/ReplaySolidIconWhite.svg";
import settingsIcon from "../../../../resources/images/SettingIconWhite.svg";
import { EventBus } from "../../../core/EventBus";
import { GameType } from "../../../core/game/Game";
@@ -74,13 +73,17 @@ export class GameRightSidebar extends LitElement implements Layer {
}
private secondsToHms = (d: number): string => {
+ const pad = (n: number) => (n < 10 ? `0${n}` : n);
+
const h = Math.floor(d / 3600);
const m = Math.floor((d % 3600) / 60);
const s = Math.floor((d % 3600) % 60);
- let time = d === 0 ? "-" : `${s}s`;
- if (m > 0) time = `${m}m` + time;
- if (h > 0) time = `${h}h` + time;
- return time;
+
+ if (h !== 0) {
+ return `${pad(h)}:${pad(m)}:${pad(s)}`;
+ } else {
+ return `${pad(m)}:${pad(s)}`;
+ }
};
private toggleReplayPanel(): void {
@@ -116,46 +119,31 @@ export class GameRightSidebar extends LitElement implements Layer {
render() {
if (this.game === undefined) return html``;
+ const timerColor =
+ this.game.config().gameConfig().maxTimerValue !== undefined &&
+ this.timer < 60
+ ? "text-red-400"
+ : "";
+
return html`