<commit_before>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import _ from 'lodash';

import MessageList from '../../components/MessageList';
import { actions as messagesActions } from '../../redux/modules/messages';

class Home extends Component {
  constructor(props) {
    super(props);
    this.state = {
      filteredMessage: null,
    };
    this._handleSearchChange = this._handleSearchChange.bind(this);
  }

  componentWillMount() {
    this.props.dispatch(messagesActions.getMessages());
  }

  _handleSearchChange(evt) {
    const filteredMessage = [];
    _.forEach(this.props.items, (item) => {
      if (_.includes(item.title, evt.target.value)) {
        filteredMessage.push(item);
      }
    });
    this.setState({
      filteredMessage,
    });
  }

  render() {
    const { items, isFetching } = this.props;

    return (
      <main>
        {isFetching &&
          <h1>Loading...</h1> // TODO: change
        }
        <div className="page-logo col-12">
          <span>
            <i className="fa fa-files-o"></i>
          </span>
        </div>
        <h1 className="page-title">Questions / Réponses</h1>
        <div className="search-input col-12">
          <input
            type="text"
            placeholder="Rechercher ..."
            onChange={this._handleSearchChange}
          />
          <button>
            <span><i className="fa fa-search"></i></span>
          </button><commit_msg>search on content & tags<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import _ from 'lodash';

import MessageList from '../../components/MessageList';
import { actions as messagesActions } from '../../redux/modules/messages';

class Home extends Component {
  constructor(props) {
    super(props);
    this.state = {
      filteredMessage: null,
    };
    this._handleSearchChange = this._handleSearchChange.bind(this);
  }

  componentWillMount() {
    this.props.dispatch(messagesActions.getMessages());
  }

  _handleSearchChange(evt) {
    const filteredMessage = [];
    _.forEach(this.props.items, (item) => {
      if (_.includes(item.title, evt.target.value)) {
        filteredMessage.push(item);
      } else if (_.includes(item.content, evt.target.value)) {
        filteredMessage.push(item);
      } else if (_.includes(item.tags, evt.target.value)) {
        filteredMessage.push(item);
      }
    });
    this.setState({
      filteredMessage,
    });
  }

  render() {
    const { items, isFetching } = this.props;

    return (
      <main>
        {isFetching &&
          <h1>Loading...</h1> // TODO: change
        }
        <div className="page-logo col-12">
          <span>
            <i className="fa fa-files-o"></i>
          </span>
        </div>
        <h1 className="page-title">Questions / Réponses</h1>
        <div className="search-input col-12">
          <input
            type="text"
            placeholder="Rechercher ..."
            onChange={this._handleSearchChange}
          />
          <button>
            <span><i className="fa fa-search"></i></span>
          </button>
{'fraction_non_alphanumeric': 0.15075853350189633, 'fraction_numerical': 0.0050568900126422255, 'mean_word_length': 2.2262996941896023, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, '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': '4989079', 'n_tokens_mistral': 924, 'n_tokens_neox': 929, 'n_words': 176}