summaryrefslogtreecommitdiff
path: root/frontend/src/containers/lobby.js
blob: c36c326305c850c30880b36740c111c215ba3e40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { List } from 'immutable'
import { Text } from 'rebass'
import PlayerList from '../components/playerList'

class Lobby extends Component {

  render() {
    return (
      <div>
        {this.props.currentGame && <Text>{this.props.currentGame.name}</Text>}
        <PlayerList players={this.props.players}/>
      </div>
    )
  }
}

import { getPlayers } from '../redux/players'
import { getCurrentGame } from '../redux/games'

const mapStateToProps = (state) => {
  const game = getCurrentGame(state)
  return ({
    currentGame: game,
    players: game ? getPlayers(state, game.get('players')) : List()
  })
}

const mapDispatchToProps = {}

export default connect(mapStateToProps, mapDispatchToProps)(Lobby)
bgstack15