From 8f6bf9ea2c4008e303e8a3b02f2dcfb113a4cfbf Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 6 Jun 2020 04:54:39 -0700 Subject: [PATCH] Subtle refinement of the status message. This distinguishes the message based on how many opponents are in the game so there's a different message whether we are waiting for an opponent to move or else to join in the first place. Also, we use "either player" if there are two players in the game, or else "any player" if there are mroe than two players in the game. --- tictactoe/tictactoe.jsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tictactoe/tictactoe.jsx b/tictactoe/tictactoe.jsx index ca0bce3..3e75573 100644 --- a/tictactoe/tictactoe.jsx +++ b/tictactoe/tictactoe.jsx @@ -342,7 +342,17 @@ class Game extends React.Component { } else if (first_move) { - status = "Either player can make the first move."; + if (state.opponent_info.length == 0) { + status = "You can make the first move or wait for an opponent to join."; + } else { + let qualifier; + if (state.opponent_info.length == 1) { + qualifier = "Either"; + } else { + qualifier = "Any"; + } + status = `${qualifier} player can make the first move.`; + } board_active = true; } else if (my_team === "") @@ -357,7 +367,12 @@ class Game extends React.Component { } else { - status = "Waiting for your opponent to move."; + status = "Waiting for your opponent to "; + if (state.opponent_info.length == 0) { + status += "join."; + } else { + status += "move."; + } board_active = false; } -- 2.43.0