diff --git a/src/client/graphics/layers/OptionsMenu.ts b/src/client/graphics/layers/OptionsMenu.ts index 1c6d55c48..6872ac1bd 100644 --- a/src/client/graphics/layers/OptionsMenu.ts +++ b/src/client/graphics/layers/OptionsMenu.ts @@ -1,5 +1,5 @@ import { LitElement, html } from "lit"; -import { customElement, property, state } from "lit/decorators.js"; +import { customElement, state } from "lit/decorators.js"; import { EventBus } from "../../../core/EventBus"; import { PauseGameEvent } from "../../Transport"; import { GameType } from "../../../core/game/Game"; @@ -30,6 +30,16 @@ const button = ({ `; +const secondsToHms = (d: number): string => { + 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; +}; + @customElement("options-menu") export class OptionsMenu extends LitElement implements Layer { public game: GameView; @@ -141,11 +151,11 @@ export class OptionsMenu extends LitElement implements Layer { children: this.isPaused ? "▶️" : "⏸", })}
- ${this.timer} + ${secondsToHms(this.timer)}
${button({ onClick: this.onExitButtonClick, @@ -161,7 +171,7 @@ export class OptionsMenu extends LitElement implements Layer {
+ ${player.flag() + ? html`` + : ""} ${player.name()}
Type: ${playerType}
@@ -269,11 +275,11 @@ export class PlayerInfoOverlay extends LitElement implements Layer { return html`
e.preventDefault()} >
${this.player != null ? this.renderPlayerInfo(this.player) : ""} ${this.unit != null ? this.renderUnitInfo(this.unit) : ""} diff --git a/src/client/graphics/layers/StructureLayer.ts b/src/client/graphics/layers/StructureLayer.ts index 9e8fa4ea5..087644746 100644 --- a/src/client/graphics/layers/StructureLayer.ts +++ b/src/client/graphics/layers/StructureLayer.ts @@ -91,7 +91,7 @@ export class StructureLayer implements Layer { ); this.unitIcons.set(unitType, iconData); console.log( - `icond data width height: ${iconData.width}, ${iconData.height}`, + `icon data width height: ${iconData.width}, ${iconData.height}`, ); }; } diff --git a/src/client/index.html b/src/client/index.html index 22a7fce4e..f06eec12f 100644 --- a/src/client/index.html +++ b/src/client/index.html @@ -331,7 +331,7 @@