diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-05-13 22:18:56 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-05-13 22:18:56 +0200 |
commit | e7606b72118f71097a0a7f75fb735750f905c24a (patch) | |
tree | 6cf01487cf2c669e6231c2c16ea3d50093319b0b /frontend/src/containers/lobby.js | |
parent | Fix getPlayers that in fact takes an immutable List instead of JS array (diff) | |
download | seven-wonders-e7606b72118f71097a0a7f75fb735750f905c24a.tar.gz seven-wonders-e7606b72118f71097a0a7f75fb735750f905c24a.tar.bz2 seven-wonders-e7606b72118f71097a0a7f75fb735750f905c24a.zip |
Migrate to seamless immutable
Resolves:
https://github.com/luxons/seven-wonders/issues/6
Diffstat (limited to 'frontend/src/containers/lobby.js')
-rw-r--r-- | frontend/src/containers/lobby.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/frontend/src/containers/lobby.js b/frontend/src/containers/lobby.js index c36c3263..f0df0c44 100644 --- a/frontend/src/containers/lobby.js +++ b/frontend/src/containers/lobby.js @@ -1,15 +1,23 @@ import React, { Component } from 'react' import { connect } from 'react-redux' -import { List } from 'immutable' +import Immutable from 'seamless-immutable' import { Text } from 'rebass' import PlayerList from '../components/playerList' class Lobby extends Component { + getTitle() { + if (this.props.currentGame) { + return this.props.currentGame.name + } else { + return 'What are you doing here? You haven\'t joined a game yet!' + } + } + render() { return ( <div> - {this.props.currentGame && <Text>{this.props.currentGame.name}</Text>} + <Text>{this.getTitle()}</Text> <PlayerList players={this.props.players}/> </div> ) @@ -23,7 +31,7 @@ const mapStateToProps = (state) => { const game = getCurrentGame(state) return ({ currentGame: game, - players: game ? getPlayers(state, game.get('players')) : List() + players: game ? getPlayers(state, game.players) : Immutable([]) }) } |