From f7f049606e19ae8a63172ba4171dbce2bda06f3c Mon Sep 17 00:00:00 2001 From: selim Date: Sat, 4 Jan 2025 01:11:00 +0100 Subject: [PATCH] Turn history is now displaying turns as column instead of states --- src/components/Board/Board.css | 9 ++++----- src/components/Board/Board.jsx | 22 ++++++++++++++-------- src/components/Board/BoardFunctions.js | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/components/Board/Board.css b/src/components/Board/Board.css index 0b3bd3e..cda5b25 100644 --- a/src/components/Board/Board.css +++ b/src/components/Board/Board.css @@ -1,11 +1,11 @@ .board-outer { display: grid; - grid-template-columns: 560px 500px; + grid-template-columns: 560px 250px; grid-template-rows: 480px 160px; grid-template-areas: "board table" "state action"; - width: 1060px; + width: 810px; border: 5px solid black; background-color: blue; margin-top: 30px; @@ -39,7 +39,7 @@ } .action-button { - width: 160px; + width: 120px; height: 60px; font-size: larger; border: 3px solid black; @@ -119,11 +119,10 @@ th, td { width: 100%; border: 3px solid black; background-color: lightgray; - text-align: left; + text-align: center; } table .action-button{ - text-align: left; font-size: medium; width: auto; height: 30px; diff --git a/src/components/Board/Board.jsx b/src/components/Board/Board.jsx index eb6fcb6..8e4ab22 100644 --- a/src/components/Board/Board.jsx +++ b/src/components/Board/Board.jsx @@ -194,7 +194,7 @@ function TurnDisplay() { turn - state + column @@ -203,21 +203,27 @@ function TurnDisplay() { clickHandlerLoadBoard(self, element)} + onClick={() => + clickHandlerLoadBoard(self, element.split(" ")[0]) + } > + {index + 1} +
{self.gameMode === 2 ? index % 2 === 0 - ? index + 1 + " (red)" - : index + 1 + " (yellow)" + ? "(red)" + : "(yellow)" : index % 2 === 0 - ? index + 1 + " (bot)" - : index + 1 + " (player)"} + ? "(bot)" + : "(player)"} clickHandlerLoadBoard(self, element)} + onClick={() => + clickHandlerLoadBoard(self, element.split(" ")[0]) + } > - {element} + {element.split(" ")[1]} ); diff --git a/src/components/Board/BoardFunctions.js b/src/components/Board/BoardFunctions.js index c6352a8..a7ab9f8 100644 --- a/src/components/Board/BoardFunctions.js +++ b/src/components/Board/BoardFunctions.js @@ -166,7 +166,7 @@ export const clickHandlerTurn = async (self, col, winStringPrefix) => { } await self.setBoardDecimal(sepToDec(self.turnsMem).toString()); const memTurnsDisplay = self.turnsDisplay; - memTurnsDisplay.push(self.boardDecimal); + memTurnsDisplay.push(self.boardDecimal + " " + (parseInt(col) + 1)); await self.setTurnsDisplay(memTurnsDisplay); return true; } else {