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

import CurrencyForm from 'components/CurrencyForm';
import CurrencyLine from 'components/CurrencyLine';
import { load, add, remove, edit } from 'redux/modules/currencies';

class HomePage extends Component {
  componentWillMount() {
    const { currencies, dispatch } = this.props;
    if (!currencies.loading && !currencies.data) {
      dispatch(load());
    }
  }

  addCurrency = ({ code }) => {
    const { currencies, dispatch } = this.props;
    const prymary = !currencies.data || Object.keys(currencies.data).length === 0;
    dispatch(add({ code, prymary }));
  }

  removeCurrency = ({ currencyId }) => {
    const { dispatch } = this.props;
    dispatch(remove({ currencyId }));
  }

  editCurrency = ({ currencyId }) => {
    const { dispatch } = this.props;
    dispatch(edit({ currencyId }));
  }

  render() {
    const { user, currencies } = this.props;
    return (
      <div>
        Hello, {user.email} !
        {currencies.data && Object.values(currencies.data).map(currency =>
          <CurrencyLine
            key={currency.id}
            currency={currency}
            editable={currency.id == currencies.currentEditableValue}
            onEdit={this.editCurrency}
            onRemove={this.removeCurrency}
          />
        )}
        <CurrencyForm onSubmit={this.addCurrency} />
      </div>
    );
  }
}

HomePage.propTypes = {
  currencies: PropTypes.object,
  user: PropTypes.object.isRequired,
  dispatch: PropTypes.func.isRequired,
};

export default connect(
  state => ({
    user: state.auth.user,
    currencies: state.currencies,
  })
)(HomePage);<commit_msg>change method editCurrency, add menhods changeCurrency, updateCurrency<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';

import CurrencyForm from 'components/CurrencyForm';
import CurrencyLine from 'components/CurrencyLine';
import { load, add, update, remove, edit, change} from 'redux/modules/currencies';

class HomePage extends Component {
  componentWillMount() {
    const { currencies, dispatch } = this.props;
    if (!currencies.loading && !currencies.data) {
      dispatch(load());
    }
  }

  addCurrency = ({ code }) => {
    const { currencies, dispatch } = this.props;
    const prymary = !currencies.data || Object.keys(currencies.data).length === 0;
    dispatch(add({ code, prymary }));
  }

  removeCurrency = ({ currencyId }) => {
    const { dispatch } = this.props;
    dispatch(remove({ currencyId }));
  }

  editCurrency = ({ currencyId, code }) => {
    const { dispatch } = this.props;
    dispatch(edit({ currencyId, code }));
  }

  changeCurrency = ({ code }) => {
    const { dispatch } = this.props;
    dispatch(change({ code }));
  }

  updateCurrency = ({ currencyId, code }) => {
    const { dispatch } = this.props;
    dispatch(update({ currencyId, code }));
  }

  render() {
    const { user, currencies } = this.props;

    return (
      <div>
        Hello, {user.email} !
        {currencies.data && Object.values(currencies.data).map(currency =>
          <CurrencyLine
            key={currency.id}
            currency={currency}
            editable={currency.id == currencies.currentEditableId}
            currentEditableValue={currencies.currentEditableValue}
            onEdit={this.editCurrency}
            onChange={this.changeCurrency}
            onUpdate={this.updateCurrency}
            onRemove={this.removeCurrency}
          />
        )}
        <CurrencyForm onSubmit={this.addCurrency} />
      </div>
    );
  }
}

HomePage.propTypes = {
  currencies: PropTypes.object,
  user: PropTypes.object.isRequired,
  dispatch: PropTypes.func.isRequired,
};

export default connect(
  state => ({
    user: state.auth.user,
    currencies: state.currencies,
  })
)(HomePage);
{'fraction_non_alphanumeric': 0.14033290653008962, 'fraction_numerical': 0.0005121638924455825, 'mean_word_length': 2.933534743202417, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, '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': '5365502', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1155, 'n_words': 234}