<commit_before>import React from 'react'

import Icon from 'components/Icon'

import { toMinSecs } from 'components/util'

const REWIND_FF_SECS = 10
const VERY_FF_SECS = 60

export default class TimeSeeker extends React.PureComponent {
  handleRestart() {
    let {onChange} = this.props

    if (typeof onChange !== 'undefined') {
      onChange(0)
    }
  }

  handleRewind() {
    let {value, onChange} = this.props

    if (typeof onChange !== 'undefined') {
      onChange(Math.max(0, value - REWIND_FF_SECS))
    }
  }

  handleChange({target: {value}}) {
    let {onChange} = this.props

    let [mins, secs] = value.split(':').map(n => parseInt(n, 10))

    if (typeof onChange !== 'undefined') {
      onChange(mins * 60 + secs)
    }
  }

  handleFastForward() {
    let {value, onChange} = this.props

    if (typeof onChange !== 'undefined') {
      onChange(value + REWIND_FF_SECS)
    }
  }

  handleVeryFastForward() {
    let {value, onChange} = this.props

    if (typeof onChange !== 'undefined') {
      onChange(value + VERY_FF_SECS)
    }
  }

  render() {
    let {value, onChange} = this.props

    return <div className='Musika-TimeSeeker'>
      <button className='color-purple' onClick={this.handleRestart.bind(this)}>
        <Icon name='undo' title='Restart' />
      </button>
      <button className='color-green' onClick={this.handleRewind.bind(this)}>
        <Icon name='backward' title={`-${REWIND_FF_SECS} seconds`} />
      </button>
      <input className='color-yellow' type='time' value={toMinSecs(value)} required
        onChange={this.handleChange.bind(this)}
      />
      <button className='color-blue' onClick={this.handleFastForward.bind(this)}>
        <Icon name='forward' title={`+${REWIND_FF_SECS} seconds`} />
      </button>
      <button className='color-red' onClick={this.handleVeryFastForward.bind(this)}>
        <Icon name='fast-forward' title={`+${VERY_FF_SECS} seconds`} />
      </button>
    </div>
  }
}

TimeSeeker.propTypes = {
  value: React.PropTypes.number,
  onChange: React.PropTypes.func,
}

TimeSeeker.defaultProps = {
  value: 0,
}<commit_msg>Change player icons<commit_after>import React from 'react'

import { Icon, IconStack } from 'components/Icon'

import { toMinSecs } from 'components/util'

const REWIND_FF_SECS = 10
const VERY_FF_SECS = 60

export default class TimeSeeker extends React.PureComponent {
  handleRestart() {
    let {onChange} = this.props

    if (typeof onChange !== 'undefined') {
      onChange(0)
    }
  }

  handleRewind() {
    let {value, onChange} = this.props

    if (typeof onChange !== 'undefined') {
      onChange(Math.max(0, value - REWIND_FF_SECS))
    }
  }

  handleChange({target: {value}}) {
    let {onChange} = this.props

    let [mins, secs] = value.split(':').map(n => parseInt(n, 10))

    if (typeof onChange !== 'undefined') {
      onChange(mins * 60 + secs)
    }
  }

  handleFastForward() {
    let {value, onChange} = this.props

    if (typeof onChange !== 'undefined') {
      onChange(value + REWIND_FF_SECS)
    }
  }

  handleVeryFastForward() {
    let {value, onChange} = this.props

    if (typeof onChange !== 'undefined') {
      onChange(value + VERY_FF_SECS)
    }
  }

  render() {
    let {value, onChange} = this.props

    return <div className='Musika-TimeSeeker'>
      <button className='color-purple' onClick={this.handleRestart.bind(this)}>
        <Icon name='fast-backward' title='Restart' />
      </button>
      <button className='color-green' onClick={this.handleRewind.bind(this)}>
        <Icon name='backward' title={`-${REWIND_FF_SECS} seconds`} />
      </button>
      <input className='color-yellow' type='time' value={toMinSecs(value)} required
        onChange={this.handleChange.bind(this)}
      />
      <button className='color-blue' onClick={this.handleFastForward.bind(this)}>
        <Icon name='forward' title={`+${REWIND_FF_SECS} seconds`} />
      </button>
      <button className='color-red' onClick={this.handleVeryFastForward.bind(this)}>
        <IconStack title={`+${VERY_FF_SECS} seconds`} style={{top: '-2px', left: '1px'}} icons={[
            {name: 'forward', style: {left: '-0.2em'}},
            {name: 'forward', style: {left: '0.2em'}},
          ]}
        />
      </button>
    </div>
  }
}

TimeSeeker.propTypes = {
  value: React.PropTypes.number,
  onChange: React.PropTypes.func,
}

TimeSeeker.defaultProps = {
  value: 0,
}
{'fraction_non_alphanumeric': 0.1575141242937853, 'fraction_numerical': 0.006327683615819209, 'mean_word_length': 3.1794145420207744, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, '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': '4527114', 'n_tokens_mistral': 1520, 'n_tokens_neox': 1482, 'n_words': 295}