From 3f6ecb84fc486a1bad20560a730f0930b0b03ea9 Mon Sep 17 00:00:00 2001 From: sepia Date: Sun, 27 Jul 2025 19:51:35 -0500 Subject: [PATCH] Restyle button box to remove text from buttons --- public/style.css | 12 +++++++++--- src/web-socket-handler.tsx | 29 ++++++++++++++--------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/public/style.css b/public/style.css index 52ce73f..7acea16 100755 --- a/public/style.css +++ b/public/style.css @@ -208,7 +208,8 @@ body { justify-content: center; align-items: center; transition: opacity 0.3s ease; - padding: 8px 15px; + padding: 15px 8px; + margin: 0px 6px; border-radius: 5px; white-space: nowrap; border: none; @@ -220,13 +221,18 @@ body { #button-box { display: flex; - flex-direction: row; - flex-wrap: nowrap; + flex-direction: column; justify-content: center; gap: 10px; margin-top: 20px; } +#button-box-buttons { + display: flex; + flex-direction: row; + flex-wrap: nowrap; +} + #resign-button { background-color: var(--color-primary); color: var(--color-on-primary); diff --git a/src/web-socket-handler.tsx b/src/web-socket-handler.tsx index cf8e705..4b7f4ab 100755 --- a/src/web-socket-handler.tsx +++ b/src/web-socket-handler.tsx @@ -154,10 +154,12 @@ class GameServer { public broadcastButtonsToPlayer(conn: PlayerConnection) { const buttons: JSX.Element[] = []; + let title: string | undefined; if (this.gomoku.status == 'playing' && this.getPlayerColor(conn)) { if (this.takebackRequesterId) { if (this.takebackRequesterId === conn.id) { + title = 'You requested a takeback'; buttons.push( , ); } else { + title = 'Your opponent requests a takeback'; buttons.push( , ); buttons.push( @@ -192,12 +193,12 @@ class GameServer { - Decline Takeback , ); } } else if (this.drawRequesterId) { if (this.drawRequesterId === conn.id) { + title = 'You requested a draw'; buttons.push( , ); } else { + title = 'Your opponent offers a draw'; buttons.push( , ); buttons.push( @@ -232,7 +232,6 @@ class GameServer { - Decline Draw , ); } @@ -242,7 +241,6 @@ class GameServer { - Resign , ); buttons.push( @@ -250,7 +248,6 @@ class GameServer { - Takeback , ); buttons.push( @@ -258,13 +255,13 @@ class GameServer { - Draw , ); } } else if (this.gomoku.status === 'finished') { if (this.rematchRequesterId) { if (this.rematchRequesterId === conn.id) { + title = 'You requested a rematch'; buttons.push( , ); } else { + title = 'Your opponent requests a rematch'; buttons.push( , ); buttons.push( @@ -299,7 +295,6 @@ class GameServer { - Decline Rematch , ); } @@ -309,7 +304,6 @@ class GameServer { - Rematch , ); } @@ -319,12 +313,17 @@ class GameServer { - Click to copy game link! + Copy Link , ); } - conn.ws.send(
{buttons}
); + conn.ws.send( +
+
{title}
+
{buttons}
+
, + ); console.log(`Sent buttons for game ${this.id} to player ${conn.id}`); }