summaryrefslogtreecommitdiff
path: root/frontend/src/containers/lobby.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/containers/lobby.js')
-rw-r--r--frontend/src/containers/lobby.js39
1 files changed, 19 insertions, 20 deletions
diff --git a/frontend/src/containers/lobby.js b/frontend/src/containers/lobby.js
index e326698f..8c3e5e4c 100644
--- a/frontend/src/containers/lobby.js
+++ b/frontend/src/containers/lobby.js
@@ -1,16 +1,18 @@
-import React, { Component } from 'react'
-import { connect } from 'react-redux'
-import Immutable from 'seamless-immutable'
-import { Button } from 'rebass'
-import PlayerList from '../components/playerList'
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import Immutable from "seamless-immutable";
+import { Button } from "rebass";
+import PlayerList from "../components/playerList";
-class Lobby extends Component {
+import { getPlayers } from "../redux/players";
+import { getCurrentGame, actions } from "../redux/games";
+class Lobby extends Component {
getTitle() {
if (this.props.currentGame) {
- return this.props.currentGame.name + ' — Lobby'
+ return this.props.currentGame.name + " — Lobby";
} else {
- return 'What are you doing here? You haven\'t joined a game yet!'
+ return "What are you doing here? You haven't joined a game yet!";
}
}
@@ -18,26 +20,23 @@ class Lobby extends Component {
return (
<div>
<h2>{this.getTitle()}</h2>
- <PlayerList players={this.props.players}/>
+ <PlayerList players={this.props.players} />
<Button onClick={this.props.startGame}>Start Game</Button>
</div>
- )
+ );
}
}
-import { getPlayers } from '../redux/players'
-import { getCurrentGame, actions } from '../redux/games'
-
-const mapStateToProps = (state) => {
- const game = getCurrentGame(state)
- return ({
+const mapStateToProps = state => {
+ const game = getCurrentGame(state);
+ return {
currentGame: game,
players: game ? getPlayers(state, game.players) : Immutable([])
- })
-}
+ };
+};
const mapDispatchToProps = {
startGame: actions.requestStartGame
-}
+};
-export default connect(mapStateToProps, mapDispatchToProps)(Lobby)
+export default connect(mapStateToProps, mapDispatchToProps)(Lobby);
bgstack15