summaryrefslogtreecommitdiff
path: root/frontend/src/containers
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/containers')
-rw-r--r--frontend/src/containers/gameBrowser.js4
-rw-r--r--frontend/src/containers/lobby.js14
2 files changed, 13 insertions, 5 deletions
diff --git a/frontend/src/containers/gameBrowser.js b/frontend/src/containers/gameBrowser.js
index 6a6b3ce2..5db3c1cb 100644
--- a/frontend/src/containers/gameBrowser.js
+++ b/frontend/src/containers/gameBrowser.js
@@ -30,7 +30,7 @@ class GameBrowser extends Component {
>
</InlineForm>
<Space auto />
- <Text><b>Username:</b> {this.props.currentPlayer.get('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}/>
@@ -43,7 +43,7 @@ import { getCurrentPlayer } from '../redux/players'
import { getAllGames, actions } from '../redux/games'
const mapStateToProps = (state) => ({
- currentPlayer: getCurrentPlayer(state),
+ currentPlayer: getCurrentPlayer(state) || {displayName: '[ERROR]'},
games: getAllGames(state)
})
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