display current outcome

feature/modern-browsers
Inga 🏳‍🌈 1 month ago
parent 83e63f0538
commit 3dee4a10e4
  1. 25
      src/backend/components/boardgame.tsx

@ -60,9 +60,28 @@ export const getBoardgameHtml = (key: string, gameState: BoardgameStateType, rul
</tbody>
</table>
<button type="submit" name={key} value={gameState.withEmptyBoard().serialize()}>
Start game
</button>
<p>
<span class="outcome-winx" style={currentOutcome === CurrentOutcome.WinX ? {} : { display: "none" }}>
Player X won
</span>
<span class="outcome-winy" style={currentOutcome === CurrentOutcome.WinO ? {} : { display: "none" }}>
Player O won
</span>
<span class="outcome-draw" style={currentOutcome === CurrentOutcome.Draw ? {} : { display: "none" }}>
Draw
</span>
</p>
<p>
<button type="submit" name={key} value={gameState.withEmptyBoard().serialize()}>
<span class="start-new-game" style={gameState.board ? { display: "none" } : {}}>
Start game
</span>
<span class="start-clear-game" style={gameState.board ? {} : { display: "none" }}>
Restart game
</span>
</button>
</p>
</form>
</board-game>
);

Loading…
Cancel
Save