aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-03-09 10:46:48 +0100
committerlonkaars <l.leblansch@gmail.com>2021-03-09 10:46:48 +0100
commitf74ce7c288822fff5e40939d05b9371cef216e0b (patch)
treeb5409b09426dd482eff361dc524506a36a6eb82a
parentfa93562432f3876abb2af397e7c8d5a27c67812b (diff)
dialog buttons do something now
-rw-r--r--pages/game.tsx20
1 files changed, 15 insertions, 5 deletions
diff --git a/pages/game.tsx b/pages/game.tsx
index 1f316ac..d71c880 100644
--- a/pages/game.tsx
+++ b/pages/game.tsx
@@ -101,7 +101,13 @@ function GameOutcomeDialog(props: {
player: number;
visible: boolean;
}) {
- return <DialogBox title="Speluitkomst" style={{ display: props.visible ? "inline-block" : "none" }}>
+ return <DialogBox
+ title="Speluitkomst"
+ style={{ display: props.visible ? "inline-block" : "none" }}
+ onclick={() => {
+ window.history.replaceState(null, null, "/");
+ window.location.reload();
+ }}>
<div style={{
width: "100%",
textAlign: "center"
@@ -196,10 +202,13 @@ export default function GamePage() {
<NavBar/>
<CenteredPage width={900} style={{ height: "100vh" }}>
<VoerGame
- active={active}
- gameID={gameID}
- player1={player1}/>
- <DialogBox title="Nieuw spel" style={{ display: gameIDUrl || gameID ? "none" : "inline-block" }}>
+ active={active}
+ gameID={gameID}
+ player1={player1}/>
+ <DialogBox
+ title="Nieuw spel"
+ style={{ display: gameIDUrl || gameID ? "none" : "inline-block" }}
+ onclick={() => { window.history.go(-1); }}>
<CurrentGameSettings/>
<div style={{
marginTop: 24,
@@ -216,6 +225,7 @@ export default function GamePage() {
})
.then(response => {
setGameID(response.data.id);
+ window.history.replaceState(null, null, "?id=" + response.data.id);
setPlayer1(response.data.player_1);
io.emit("registerGameListener", { game_id: response.data.id });
if (response.data.game_started) setActive(true);