aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-03-08 15:43:25 +0100
committerlonkaars <l.leblansch@gmail.com>2021-03-08 15:43:25 +0100
commit2ab7cfe761b47eed848becbc9386f6a94ef44d3d (patch)
tree5b53e6b20069d74a3250d861533c73dc4a8cefac /pages
parentb56d17983facdbe29f397c08b7b14ac3ff783a88 (diff)
game/resign thingy
Diffstat (limited to 'pages')
-rw-r--r--pages/game.tsx26
1 files changed, 23 insertions, 3 deletions
diff --git a/pages/game.tsx b/pages/game.tsx
index 660156d..58eb639 100644
--- a/pages/game.tsx
+++ b/pages/game.tsx
@@ -51,6 +51,10 @@ class VoerGame extends Component<VoerGameProps> {
if (data.boardFull) outcome = 0;
this.setState({ outcome });
});
+
+ this.io.on("resign", () => {
+ alert("resign")
+ });
}
io: Socket;
@@ -93,9 +97,22 @@ class VoerGame extends Component<VoerGameProps> {
maxWidth: "100vh",
margin: "0 auto"
}}>
- <VoerBord width={this.width} height={this.height} onMove={m => this.move(m % this.width + 1)} active={this.props.active == true && this.state.outcome == -1}/>
- <GameBar turn={this.state.turn} player1={this.props.player1} active={this.props.active}/>
- <GameOutcomeDialog outcome={this.state.outcome} player={this.props.player1 ? 1 : 2} visible={this.state.outcome != -1}/>
+ <VoerBord
+ width={this.width} height={this.height}
+ onMove={m => this.move(m % this.width + 1)}
+ active={this.props.active == true && this.state.outcome == -1}
+ />
+ <GameBar
+ turn={this.state.turn}
+ player1={this.props.player1}
+ active={this.props.active}
+ resignFunction={() => {this.io.emit("resign", { game_id: this.props.gameID })}}
+ />
+ <GameOutcomeDialog
+ outcome={this.state.outcome}
+ player={this.props.player1 ? 1 : 2}
+ visible={this.state.outcome != -1}
+ />
</div>
}
}
@@ -167,6 +184,9 @@ var InviteButtonLabelStyle: CSSProperties = {
export default class GamePage extends Component {
constructor(props: {}) {
super(props);
+
+ if (typeof document === "undefined") return;
+ // gert
}
state: {