summaryrefslogtreecommitdiff
path: root/frontend/src/containers/lobby.js
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2017-05-13 22:18:56 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2017-05-13 22:18:56 +0200
commite7606b72118f71097a0a7f75fb735750f905c24a (patch)
tree6cf01487cf2c669e6231c2c16ea3d50093319b0b /frontend/src/containers/lobby.js
parentFix getPlayers that in fact takes an immutable List instead of JS array (diff)
downloadseven-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.js14
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([])
})
}
bgstack15