summaryrefslogtreecommitdiff
path: root/frontend/src/containers/gameBrowser.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/containers/gameBrowser.js')
-rw-r--r--frontend/src/containers/gameBrowser.js54
1 files changed, 26 insertions, 28 deletions
diff --git a/frontend/src/containers/gameBrowser.js b/frontend/src/containers/gameBrowser.js
index 5db3c1cb..d9d3d363 100644
--- a/frontend/src/containers/gameBrowser.js
+++ b/frontend/src/containers/gameBrowser.js
@@ -1,21 +1,19 @@
-import React, { Component } from 'react'
-import { connect } from 'react-redux'
-import {
- Space,
- InlineForm,
- Text
-} from 'rebass'
-import { Flex } from 'reflexbox'
-import GameList from '../components/gameList'
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import { Space, InlineForm, Text } from "rebass";
+import { Flex } from "reflexbox";
+import GameList from "../components/gameList";
-class GameBrowser extends Component {
+import { getCurrentPlayer } from "../redux/players";
+import { getAllGames, actions } from "../redux/games";
- createGame = (e) => {
- e.preventDefault()
+class GameBrowser extends Component {
+ createGame = e => {
+ e.preventDefault();
if (this._gameName !== undefined) {
- this.props.createGame(this._gameName)
+ this.props.createGame(this._gameName);
}
- }
+ };
render() {
return (
@@ -25,31 +23,31 @@ class GameBrowser extends Component {
buttonLabel="Create Game"
label="Game name"
name="game_name"
- onChange={(e) => this._gameName = e.target.value}
+ onChange={e => (this._gameName = e.target.value)}
onClick={this.createGame}
- >
- </InlineForm>
+ />
<Space auto />
- <Text><b>Username:</b> {this.props.currentPlayer && this.props.currentPlayer.displayName}</Text>
+ <Text>
+ <b>Username:</b>
+ {" "}
+ {this.props.currentPlayer && this.props.currentPlayer.displayName}
+ </Text>
<Space x={1} />
</Flex>
- <GameList games={this.props.games} joinGame={this.props.joinGame}/>
+ <GameList games={this.props.games} joinGame={this.props.joinGame} />
</div>
- )
+ );
}
}
-import { getCurrentPlayer } from '../redux/players'
-import { getAllGames, actions } from '../redux/games'
-
-const mapStateToProps = (state) => ({
- currentPlayer: getCurrentPlayer(state) || {displayName: '[ERROR]'},
+const mapStateToProps = state => ({
+ currentPlayer: getCurrentPlayer(state) || { displayName: "[ERROR]" },
games: getAllGames(state)
-})
+});
const mapDispatchToProps = {
createGame: actions.requestCreateGame,
joinGame: actions.requestJoinGame
-}
+};
-export default connect(mapStateToProps, mapDispatchToProps)(GameBrowser)
+export default connect(mapStateToProps, mapDispatchToProps)(GameBrowser);
bgstack15