Turn history is now displaying turns as column instead of states

main
selim 2025-01-04 01:11:00 +01:00
parent 454157c278
commit f7f049606e
3 changed files with 19 additions and 14 deletions

View File

@ -1,11 +1,11 @@
.board-outer { .board-outer {
display: grid; display: grid;
grid-template-columns: 560px 500px; grid-template-columns: 560px 250px;
grid-template-rows: 480px 160px; grid-template-rows: 480px 160px;
grid-template-areas: grid-template-areas:
"board table" "board table"
"state action"; "state action";
width: 1060px; width: 810px;
border: 5px solid black; border: 5px solid black;
background-color: blue; background-color: blue;
margin-top: 30px; margin-top: 30px;
@ -39,7 +39,7 @@
} }
.action-button { .action-button {
width: 160px; width: 120px;
height: 60px; height: 60px;
font-size: larger; font-size: larger;
border: 3px solid black; border: 3px solid black;
@ -119,11 +119,10 @@ th, td {
width: 100%; width: 100%;
border: 3px solid black; border: 3px solid black;
background-color: lightgray; background-color: lightgray;
text-align: left; text-align: center;
} }
table .action-button{ table .action-button{
text-align: left;
font-size: medium; font-size: medium;
width: auto; width: auto;
height: 30px; height: 30px;

View File

@ -194,7 +194,7 @@ function TurnDisplay() {
<thead> <thead>
<tr> <tr>
<th>turn</th> <th>turn</th>
<th>state</th> <th>column</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -203,21 +203,27 @@ function TurnDisplay() {
<tr key={element}> <tr key={element}>
<td <td
className="action-button" className="action-button"
onClick={() => clickHandlerLoadBoard(self, element)} onClick={() =>
clickHandlerLoadBoard(self, element.split(" ")[0])
}
> >
{index + 1}
<br />
{self.gameMode === 2 {self.gameMode === 2
? index % 2 === 0 ? index % 2 === 0
? index + 1 + " (red)" ? "(red)"
: index + 1 + " (yellow)" : "(yellow)"
: index % 2 === 0 : index % 2 === 0
? index + 1 + " (bot)" ? "(bot)"
: index + 1 + " (player)"} : "(player)"}
</td> </td>
<td <td
className="action-button" className="action-button"
onClick={() => clickHandlerLoadBoard(self, element)} onClick={() =>
clickHandlerLoadBoard(self, element.split(" ")[0])
}
> >
{element} {element.split(" ")[1]}
</td> </td>
</tr> </tr>
); );

View File

@ -166,7 +166,7 @@ export const clickHandlerTurn = async (self, col, winStringPrefix) => {
} }
await self.setBoardDecimal(sepToDec(self.turnsMem).toString()); await self.setBoardDecimal(sepToDec(self.turnsMem).toString());
const memTurnsDisplay = self.turnsDisplay; const memTurnsDisplay = self.turnsDisplay;
memTurnsDisplay.push(self.boardDecimal); memTurnsDisplay.push(self.boardDecimal + " " + (parseInt(col) + 1));
await self.setTurnsDisplay(memTurnsDisplay); await self.setTurnsDisplay(memTurnsDisplay);
return true; return true;
} else { } else {