diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2017-05-20 15:00:13 +0200 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2017-05-20 15:00:13 +0200 |
commit | 33e3b361d4e9758bbbab1d23ac6b51a2af21e781 (patch) | |
tree | 8670e3b4f4e76dc52a852a46d6c8170c982ec9f0 /frontend/src/containers/gameBrowser.js | |
parent | Fixed 'unused React' warning (diff) | |
download | seven-wonders-33e3b361d4e9758bbbab1d23ac6b51a2af21e781.tar.gz seven-wonders-33e3b361d4e9758bbbab1d23ac6b51a2af21e781.tar.bz2 seven-wonders-33e3b361d4e9758bbbab1d23ac6b51a2af21e781.zip |
Upgrade react-scripts to 1.0.1
Diffstat (limited to 'frontend/src/containers/gameBrowser.js')
-rw-r--r-- | frontend/src/containers/gameBrowser.js | 54 |
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); |