{"size": 1296, "ext": "js", "max_stars_repo_path": "src/component/room/playerItem.js", "max_stars_repo_name": "liorsbg/react-against-humanity", "max_stars_repo_stars_event_min_datetime": "2016-07-26T18:10:07.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-25T20:11:24.000Z", "max_issues_repo_path": "src/component/room/playerItem.js", "max_issues_repo_name": "liorsbg/react-against-humanity", "max_issues_repo_issues_event_min_datetime": "2016-01-09T09:42:21.000Z", "max_issues_repo_issues_event_max_datetime": "2017-03-11T15:00:21.000Z", "max_forks_repo_path": "src/component/room/playerItem.js", "max_forks_repo_name": "liorsbg/react-against-humanity", "max_forks_repo_forks_event_min_datetime": "2020-11-25T09:20:10.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-25T09:20:10.000Z"}
{"max_stars_count": 3, "max_issues_count": 27, "max_forks_count": 1, "avg_line_length": 27.0, "max_line_length": 65, "alphanum_fraction": 0.5347222222}
import React, { Component, PropTypes } from 'react';

export default class PlayerItem extends Component {
  render() {
    const { user, isHost, canModerate, canLeave,
      onTransferHost = () => {}, onKick = () => {},
      onLeave = () => {}, showScore, score } = this.props;
    return (
      <div className='player-item-component'>
        <div className='name'>
          {user.name}
          {isHost && (
            <div className='icon host' />
          )}
        </div>
        <div className='action-bar'>
          {showScore && (
            <span className='score'>{score}</span>
          )}
          {canModerate && (
            <span>
              <button className='action transfer-host'
                onClick={onTransferHost}
              />
              <button className='action ban' onClick={onKick} />
            </span>
          )}
          {canLeave && (
            <button className='action leave' onClick={onLeave} />
          )}
        </div>
      </div>
    );
  }
}

PlayerItem.propTypes = {
  user: PropTypes.object,
  isHost: PropTypes.bool,
  canModerate: PropTypes.bool,
  canLeave: PropTypes.bool,
  onKick: PropTypes.func,
  onTransferHost: PropTypes.func,
  onLeave: PropTypes.func,
  showScore: PropTypes.bool,
  score: PropTypes.number
};
