<commit_before>import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { recordHit } from '../../actions'

const mapDispatchToProps = dispatch => ({
  onHitRecorded: (playerId, hit) => {
    dispatch(recordHit(playerId, hit));
  }
});

let HitRecorder = ({ onHitRecorded }) => {
  let playerId, hit;

  const onSubmit = e => {
    e.preventDefault();
    onHitRecorded(parseInt(playerId.value), parseInt(hit.value));
  }
  return (
    <form onSubmit={onSubmit}>
      <label htmlFor="playerId">Player ID: <input ref={n => playerId = n } name="playerId" type="number" defaultValue={0} min={0} /></label>
      <label htmlFor="hit">Number hit: <input ref={n => hit = n} name="hit" type="number" defaultValue={20} min={15} max={25}/></label>
      <button type="submit">Record Hit</button>
    </form>
  )

}


HitRecorder = connect(
  null,
  mapDispatchToProps
)(HitRecorder)

export default HitRecorder
<commit_msg>adding current player to HitRecorder<commit_after>import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { recordHit } from '../../actions'

const mapStateToProps = state => ({
  currentPlayerId: state.currentPlayerId
});

const mapDispatchToProps = dispatch => ({
  onHitRecorded: (playerId, hit) => {
    dispatch(recordHit(playerId, hit));
  }
});

let HitRecorder = ({ currentPlayerId, onHitRecorded }) => {
  let playerId, hit;

  const onSubmit = e => {
    e.preventDefault();
    onHitRecorded(parseInt(playerId.value), parseInt(hit.value));
  }
  return (
    <form onSubmit={onSubmit}>
      <label htmlFor="playerId">Player ID: <input ref={n => playerId = n } name="playerId" type="number" defaultValue={currentPlayerId} min={0} /></label>
      <label htmlFor="hit">Number hit: <input ref={n => hit = n} name="hit" type="number" defaultValue={20} min={15} max={25}/></label>
      <button type="submit">Record Hit</button>
    </form>
  )

}


HitRecorder = connect(
  mapStateToProps,
  mapDispatchToProps
)(HitRecorder)

export default HitRecorder

{'fraction_non_alphanumeric': 0.16429622363903876, 'fraction_numerical': 0.007356547327121138, 'mean_word_length': 4.326370757180157, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5308740', 'n_tokens_mistral': 664, 'n_tokens_neox': 659, 'n_words': 154}