|
@@ -12,7 +12,7 @@ import PreGame from '../pre-game.component';
|
|
import PreRound from '../pre-round.component';
|
|
import PreRound from '../pre-round.component';
|
|
import GamePanel from "../game-panel.component";
|
|
import GamePanel from "../game-panel.component";
|
|
import RoundSummary from '../round-summary.component';
|
|
import RoundSummary from '../round-summary.component';
|
|
-import PlayerScores from "../player-scores.component";
|
|
|
|
|
|
+import PlayerScoresContainer from "../player-scores.component";
|
|
import {
|
|
import {
|
|
getGoogleApiKey,
|
|
getGoogleApiKey,
|
|
createGame,
|
|
createGame,
|
|
@@ -21,6 +21,7 @@ import {
|
|
getGuesses,
|
|
getGuesses,
|
|
sendGuess
|
|
sendGuess
|
|
} from "../../services/ggsh.service";
|
|
} from "../../services/ggsh.service";
|
|
|
|
+import Loading from "../loading.component";
|
|
|
|
|
|
// TODO I want to break this down into some smaller container components that can handle making the API calls
|
|
// TODO I want to break this down into some smaller container components that can handle making the API calls
|
|
|
|
|
|
@@ -37,7 +38,6 @@ class Game extends React.Component {
|
|
selectedPoint: null,
|
|
selectedPoint: null,
|
|
lastScore: null,
|
|
lastScore: null,
|
|
totalScore: null,
|
|
totalScore: null,
|
|
- players: null,
|
|
|
|
roundTimer: null,
|
|
roundTimer: null,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -67,19 +67,18 @@ class Game extends React.Component {
|
|
this.setState({ gameState: LOADING })
|
|
this.setState({ gameState: LOADING })
|
|
const { gameId, playerName } = this.state;
|
|
const { gameId, playerName } = this.state;
|
|
const { currentRound } = await getGuesses(gameId, playerName);
|
|
const { currentRound } = await getGuesses(gameId, playerName);
|
|
- const { coords, players, timer } = await gameInfo(gameId);
|
|
|
|
if (currentRound) {
|
|
if (currentRound) {
|
|
|
|
+ const { coords, timer } = await gameInfo(gameId);
|
|
const targetPoint = coords[currentRound];
|
|
const targetPoint = coords[currentRound];
|
|
this.setState({
|
|
this.setState({
|
|
gameState: IN_ROUND,
|
|
gameState: IN_ROUND,
|
|
currentRound,
|
|
currentRound,
|
|
targetPoint,
|
|
targetPoint,
|
|
selectedPoint: null,
|
|
selectedPoint: null,
|
|
- players,
|
|
|
|
roundTimer: timer,
|
|
roundTimer: timer,
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
- this.setState({ gameState: POST_GAME, players });
|
|
|
|
|
|
+ this.setState({ gameState: POST_GAME });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -100,7 +99,7 @@ class Game extends React.Component {
|
|
}
|
|
}
|
|
|
|
|
|
renderLoading() {
|
|
renderLoading() {
|
|
- return <p>Loading...</p>
|
|
|
|
|
|
+ return <Loading/>
|
|
}
|
|
}
|
|
|
|
|
|
renderPreGame() {
|
|
renderPreGame() {
|
|
@@ -159,10 +158,10 @@ class Game extends React.Component {
|
|
}
|
|
}
|
|
|
|
|
|
renderPostGame() {
|
|
renderPostGame() {
|
|
- const { players } = this.state;
|
|
|
|
- return <PlayerScores
|
|
|
|
- players={players}
|
|
|
|
- onReturnToStart={() => this.setState({ gameState: PRE_GAME })}
|
|
|
|
|
|
+ const { gameId } = this.state;
|
|
|
|
+ return <PlayerScoresContainer
|
|
|
|
+ gameId={gameId}
|
|
|
|
+ onReturnToStart={() => this.setState({ gameState: PRE_GAME })}
|
|
/>
|
|
/>
|
|
}
|
|
}
|
|
|
|
|