{"size": 1278, "ext": "js", "max_stars_repo_path": "src/components/gamepadPhases/EndPhase.js", "max_stars_repo_name": "3StackGames/subtle-scheme-frontend", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/gamepadPhases/EndPhase.js", "max_issues_repo_name": "3StackGames/subtle-scheme-frontend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/gamepadPhases/EndPhase.js", "max_forks_repo_name": "3StackGames/subtle-scheme-frontend", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.2363636364, "max_line_length": 93, "alphanum_fraction": 0.6392801252}
import React, { Component, PropTypes } from 'react'
import ReactDOM, { render } from 'react-dom'
import cx from 'classname'
import autobind from 'autobind-decorator'

export default class EndPhase extends Component {
  constructor(props) {
    super(props)
    this.state = {}

    localStorage.removeItem('gamepad.user');
    localStorage.removeItem('gamepad.timestamp');
  }

  render() {
    const { gameState, currentPlayer } = this.props

    if(gameState.players[0].displayName === currentPlayer.displayName) {
      return (
        <div>
          <div className="small-header">GameOver</div>
          <button onClick={this.restartGame} className="btn btn-danger">Restart Game</button>
        </div>
      )
    }

    return (
      <div>
        <div className="small-header">GameOver</div>
      </div>
    )
  }

  @autobind
  keepPlaying() {
    const { gameState, engine, currentPlayer } = this.props

    engine.gamepadInput({
      gameCode: gameState.gameCode,
      player: currentPlayer.displayName,
      moveOn: true
    })
  }

  @autobind
  restartGame() {
    const { gameState, engine, currentPlayer } = this.props

    engine.gamepadInput({
      gameCode: gameState.gameCode,
      player: currentPlayer.displayName,
      restart: true
    })
  }
}