<commit_before>'use strict'

var React = require('react')
var debounce = require('debounce')
var SearchApi = require ('../../api/searchApi')
var Store = require('../../stores/store')

function getStateFromStores () {
  return {
    results: Store.getAllResults()
  }
}

var SearchBar = React.createClass({
  getInitialState: function () {
    return {
      results: Store.getAllResults(),
      text: 'cat'
    }
  },

  onChange: function (event) {
    this.setState({text: event.target.value})
    this.setState(getStateFromStores())
  },

  componentDidMount: function () {
    Store.addChangeListener(this.onChange)
  },

  whenUserTypes: function () {
    console.log('type type type')
    debounce(getStateFromStores(), 2000)
  },

  handleSubmit: function (e) {
    e.preventDefault()
    var nextItems = []
    var nextText = ''
    this.setState({results: nextItems, text: nextText})
  },

  render: function () {
    return (
      <form
        action=''
        method='post'
        id='search-form'>

        <input
          type='text'
          id='search-bar'
          placeholder='Search for videos..'
          ref='searchTextInput'
          onChange={this.onChange}
          onInput={this.whenUserTypes}
          value={this.state.text} />

        <button
          className='icon'
          id='search-button'
          value='Search'>Search</button>

        </form>
      )
  }
})

module.exports = SearchBar

  // getInitialState: function () {
  //   return {results: [], text: 'cat'}
  // },
<commit_msg>Initial action fetch from YouTube Api through Flux is working.<commit_after>'use strict'

var React = require('react')
var debounce = require('debounce')
var SearchApi = require ('../../api/searchApi')
var Store = require('../../stores/store')

function getStateFromStores () {
  return {
    results: Store.getAllResults()
  }
}

var SearchBar = React.createClass({
  getInitialState: function () {
    return {
      results: Store.getAllResults(),
      text: 'cat'
    }
  },

  onChange: function (e) {
    this.setState({text: e.target.value})
    this.setState(getStateFromStores())
  },

  componentDidMount: function () {
    Store.addChangeListener(this.onChange)
  },

  whenUserTypes: function (e) {
    console.log('type type type')
    var text = e.target.value
    this.setState({text: text})
    debounce(getStateFromStores(), 2000)
  },

  handleSubmit: function (e) {
    e.preventDefault()
    var nextItems = []
    var nextText = ''
    this.setState({results: nextItems, text: nextText})
  },

  render: function () {
    return (
      <form
        action=''
        method='post'
        id='search-form'>

        <input
          type='text'
          id='search-bar'
          placeholder='Search for videos..'
          ref='searchTextInput'
          onChange={this.onChange}
          onInput={this.whenUserTypes}
          value={this.state.text} />

        <button
          className='icon'
          id='search-button'
          value='Search'>Search</button>

        </form>
      )
  }
})

module.exports = SearchBar

  // getInitialState: function () {
  //   return {results: [], text: 'cat'}
  // },

{'fraction_non_alphanumeric': 0.14779874213836477, 'fraction_numerical': 0.0025157232704402514, 'mean_word_length': 2.427801724137931, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5545388', 'n_tokens_mistral': 979, 'n_tokens_neox': 958, 'n_words': 191}