display current outcome

main
Inga 🏳‍🌈 3 days 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> </tbody>
</table> </table>
<button type="submit" name={key} value={gameState.withEmptyBoard().serialize()}> <p>
Start game <span class="outcome-winx" style={currentOutcome === CurrentOutcome.WinX ? {} : { display: "none" }}>
</button> 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> </form>
</board-game> </board-game>
); );

Loading…
Cancel
Save