summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5eb93fb)
There's no reason to allow the user to select a square and send the
move to the server when the client can already know that the server is
just going to reject the move because it's not our turn anyway.
return (
<Square
value={value}
return (
<Square
value={value}
- active={! this.props.game_over && ! value}
+ active={this.props.active && ! value}
onClick={() => this.props.onClick(i)}
/>
);
onClick={() => this.props.onClick(i)}
/>
);
const history = state.history;
const current = history[state.step_number];
const winner = calculate_winner(current.squares);
const history = state.history;
const current = history[state.step_number];
const winner = calculate_winner(current.squares);
let status;
if (winner) {
status = "Winner: " + winner;
let status;
if (winner) {
status = "Winner: " + winner;
- status = "Next player: " + (Team.properties[state.next_to_play].name);
+ if (state.player_info.team === Team.properties[state.next_to_play].name) {
+ status = "Your turn. Make a move.";
+ board_active = true;
+ } else {
+ status = "Waiting for your opponent to move.";
+ board_active = false;
+ }
<div>{status}</div>
<div className="game-board">
<Board
<div>{status}</div>
<div className="game-board">
<Board
squares={current.squares}
onClick={i => this.handle_click(i)}
/>
squares={current.squares}
onClick={i => this.handle_click(i)}
/>