var PlayerList = React.createClass({
  propTypes: {
    players: React.PropTypes.array,
    game_id: React.PropTypes.number
  },

  playerNodes: function() {
    var playerList = this;
    var playerNodes = this.props.game.players.map(function (player) {
      return (
        <Player
          key={player.id}
          onPlayHandSubmit={playerList.props.onPlayHandSubmit}
          user_id={player.user_id}
          game={playerList.props.game}
          {...player} />
      );
    });
    return playerNodes;
  },

  render: function() {
    return (
      <div id="playerList">
        <div id="top">
          {this.playerNodes()[0]}
        </div>
        <div id="mid">
          {this.playerNodes()[1]}
          <div id="play-to-beat">Hand to beat: {this.props.game.play_to_beat_string}</div>
          {this.playerNodes()[2]}
        </div>
        <div id="bot">
          {this.playerNodes()[3]}
        </div>
      </div>
    );
  }

});
