<commit_before>require('materialize-loader');

import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { browserHistory } from 'react-router'

import { fetchBing } from '../actions/bing.jsx'
import { fetchReddit } from '../actions/reddit.jsx'
import { fetchTwitter } from '../actions/twitter.jsx'
import BingList from './BingList.jsx'

class SearchBar extends React.Component {
  constructor(props) {
    super(props);

    this.state = { term: '' };

    this.onInputChange = this.onInputChange.bind(this);
    this.onFormSubmit = this.onFormSubmit.bind(this);
    this.bingListClick = this.bingListClick.bind(this);
  }

  onInputChange(event) {
    this.setState({ term: event.target.value });
    this.props.fetchBing(event.target.value);
  }

  onFormSubmit(event) {
    event.preventDefault();

    this.props.fetchReddit(this.state.term);
    this.props.fetchTwitter(this.state.term);
    this.setState({ term: '' });

    const path = `/${this.state.term}`.replace(/\W/g, '-');
    browserHistory.push(path);
  }

  bingListClick(suggestion) {
    this.setState({term: suggestion});
  }

  render() {
    return (
      <div style={{position: 'fixed', marginTop: '90px', left: 0, right: 0}} className="v-align-wrapper">
        <form onSubmit={this.onFormSubmit} className="container">
          <div className="input-field v-align">
            <div className="row">
              <div className="col s8 offset-s2 m6 offset-m3">
                <input type='text' value={this.state.term} onChange={this.onInputChange} /><commit_msg>[fix] extra - in url<commit_after>require('materialize-loader');

import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { browserHistory } from 'react-router'

import { fetchBing } from '../actions/bing.jsx'
import { fetchReddit } from '../actions/reddit.jsx'
import { fetchTwitter } from '../actions/twitter.jsx'
import BingList from './BingList.jsx'

class SearchBar extends React.Component {
  constructor(props) {
    super(props);

    this.state = { term: '' };

    this.onInputChange = this.onInputChange.bind(this);
    this.onFormSubmit = this.onFormSubmit.bind(this);
    this.bingListClick = this.bingListClick.bind(this);
  }

  onInputChange(event) {
    this.setState({ term: event.target.value });
    this.props.fetchBing(event.target.value);
  }

  onFormSubmit(event) {
    event.preventDefault();

    this.props.fetchReddit(this.state.term);
    this.props.fetchTwitter(this.state.term);
    this.setState({ term: '' });

    const path = `${this.state.term}`.replace(/\W/g, '-');
    browserHistory.push(path);
  }

  bingListClick(suggestion) {
    this.setState({term: suggestion});
  }

  render() {
    return (
      <div style={{position: 'fixed', marginTop: '90px', left: 0, right: 0}} className="v-align-wrapper">
        <form onSubmit={this.onFormSubmit} className="container">
          <div className="input-field v-align">
            <div className="row">
              <div className="col s8 offset-s2 m6 offset-m3">
                <input type='text' value={this.state.term} onChange={this.onInputChange} />
{'fraction_non_alphanumeric': 0.15769944341372913, 'fraction_numerical': 0.004947433518862091, 'mean_word_length': 3.4868238557558944, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2219354', 'n_tokens_mistral': 1036, 'n_tokens_neox': 1017, 'n_words': 195}