<commit_before>import './NewTodo.scss';
import Component from 'react-pure-render/component';
import React, { PropTypes } from 'react';
import newTodoMessages from '../../common/todos/newTodoMessages';
import { FormattedMessage } from 'react-intl';
import { addTodo } from '../../common/todos/actions';
import { connect } from 'react-redux';
import { reduxForm } from 'redux-form';

class NewTodo extends Component {

  static propTypes = {
    addTodo: PropTypes.func.isRequired
  };

  constructor() {
    super();
    this.onInputKeyDown = this.onInputKeyDown.bind(this);
  }

  onInputKeyDown(e) {
    if (e.key !== 'Enter') return;
    const { addTodo, fields: {title} } = this.props;
    if (!title.value.trim()) return;
    addTodo(title.value);
    newTodo.restForm();
  }

  render() {
    const { fields: {title} } = this.props;

    return (
      <FormattedMessage {...newTodoMessages.placeholder}>
        {message =>
          <input
            {...title}
            autoFocus<commit_msg>Reseting the from works now<commit_after>import './NewTodo.scss';
import Component from 'react-pure-render/component';
import React, { PropTypes } from 'react';
import newTodoMessages from '../../common/todos/newTodoMessages';
import { FormattedMessage } from 'react-intl';
import { addTodo } from '../../common/todos/actions';
import { connect } from 'react-redux';
import { reduxForm } from 'redux-form';

class NewTodo extends Component {

  static propTypes = {
    addTodo: PropTypes.func.isRequired,
    fields: PropTypes.object.isRequired,
    resetForm: PropTypes.func.isRequired
  };

  constructor() {
    super();
    this.onInputKeyDown = this.onInputKeyDown.bind(this);
  }


  onInputKeyDown(e) {
    if (e.key !== 'Enter') return;
    const { addTodo, fields: {title}, resetForm } = this.props;
    if (!title.value.trim()) return;
    addTodo(title.value);
    resetForm();
  }

  render() {
    const { fields: {title} } = this.props;

    return (
      <FormattedMessage {...newTodoMessages.placeholder}>
        {message =>
          <input
            {...title}
            autoFocus
{'fraction_non_alphanumeric': 0.14800759013282733, 'fraction_numerical': 0.0, 'mean_word_length': 3.0402298850574714, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5696912', 'n_tokens_mistral': 668, 'n_tokens_neox': 664, 'n_words': 148}