diff --git a/apps/frontend/src/screens/Game.tsx b/apps/frontend/src/screens/Game.tsx
index e83fdabf..eba5c3a2 100644
--- a/apps/frontend/src/screens/Game.tsx
+++ b/apps/frontend/src/screens/Game.tsx
@@ -214,6 +214,9 @@ export const Game = () => {
const getTimer = (timeConsumed: number) => {
const timeLeftMs = GAME_TIME_MS - timeConsumed;
+ if (timeLeftMs <= 0) {
+ return
Time's up!
;
+ }
const minutes = Math.floor(timeLeftMs / (1000 * 60));
const remainingSeconds = Math.floor((timeLeftMs % (1000 * 60)) / 1000);
@@ -237,23 +240,15 @@ export const Game = () => {
gameResult={result}
>
)}
- {started && (
-
- {(user.id === gameMetadata?.blackPlayer?.id ? 'b' : 'w') ===
- chess.turn()
- ? 'Your turn'
- : "Opponent's turn"}
-
- )}
-
+
{started && (
-
+
{
: gameMetadata?.whitePlayer?.name ?? ''
}
/>
+
+ {(user.id === gameMetadata?.blackPlayer?.id ? 'b' : 'w') ===
+ chess.turn()
+ ? 'Your turn'
+ : "Opponent's turn"}
+
+
{getTimer(
user.id === gameMetadata?.whitePlayer?.id
? player2TimeConsumed
@@ -287,7 +289,7 @@ export const Game = () => {
{started && (
-
);
-};
+};
\ No newline at end of file