<commit_before>import React from 'react';
import AvailableCharacters from './Components/AvailableCharacters';
import MyFavoriteCharacters from './Components/MyFavoriteCharacters';
import getAvailableCharacters from './getAvailableCharacters';
const availableCharacters = getAvailableCharacters();
require('./Styles/App.css');

const App = React.createClass({
    propTypes: {
        title: React.PropTypes.string.isRequired
    },

    getInitialState() {
        return {
            availableCharacters,
            myFavoriteCharacters: {},
            filteredAvailableCharacters: availableCharacters,
            filterText: ''
        };
    },

    onFilterTextChange(event) {
        const filterText = event.target.value;
        const filteredAvailableCharacters = this.state.availableCharacters.filter((character) =>
            character.name.toLowerCase()
                .indexOf(filterText) >= 0
        );
        this.setState({
            filterText,
            filteredAvailableCharacters
        });
    },

    setAsFavoriteSeries(characterId, seriesName) {
        const updatedCharacter = Object.assign(
            {},
            this.state.myFavoriteCharacters[characterId],
            { favoriteSeriesName: seriesName }
        );

        const myFavoriteCharacters = Object.assign(
            {},
            this.state.myFavoriteCharacters,
            { [updatedCharacter.id]: updatedCharacter }
        );
        this.setState({ myFavoriteCharacters });
    },

    addToFavoriteCharacters(character) {
        const myFavoriteCharacters = Object.assign(
            {},
            this.state.myFavoriteCharacters,
            { [character.id]: character }
        );
        this.setState({ myFavoriteCharacters });
    },


    render() {
        return (
            <div>
                <div class="available-hero-container">
                    <div className="available-hero-container__search-bar">
                        <h4 className="container-header">{this.props.title}</h4>
                        <input
                            value={this.state.filterText}
                            onChange={this.onFilterTextChange}
                        />
                    </div>
                    <AvailableCharacters<commit_msg>Used helper function to set favorite series<commit_after>import React from 'react';
import AvailableCharacters from './Components/AvailableCharacters';
import MyFavoriteCharacters from './Components/MyFavoriteCharacters';
import getAvailableCharacters from './getAvailableCharacters';
import getCharacterWithUpdatedFavoriteSeries from './getCharacterWithUpdatedFavoriteSeries';
const availableCharacters = getAvailableCharacters();
require('./Styles/App.css');

const App = React.createClass({
    propTypes: {
        title: React.PropTypes.string.isRequired
    },

    getInitialState() {
        return {
            availableCharacters,
            myFavoriteCharacters: {},
            filteredAvailableCharacters: availableCharacters,
            filterText: ''
        };
    },

    onFilterTextChange(event) {
        const filterText = event.target.value;
        const filteredAvailableCharacters = this.state.availableCharacters.filter((character) =>
            character.name.toLowerCase()
                .indexOf(filterText) >= 0
        );
        this.setState({
            filterText,
            filteredAvailableCharacters
        });
    },

    setAsFavoriteSeries(characterId, favoriteSeriesName) {
        getCharacterWithUpdatedFavoriteSeries(
            this.state.myFavoriteCharacters,
            characterId,
            favoriteSeriesName
        );
    },

    addToFavoriteCharacters(character) {
        const myFavoriteCharacters = Object.assign(
            {},
            this.state.myFavoriteCharacters,
            { [character.id]: character }
        );
        this.setState({ myFavoriteCharacters });
    },


    render() {
        return (
            <div>
                <div className="available-hero-container">
                    <div className="available-hero-container__search-bar">
                        <h4 className="container-header">{this.props.title}</h4>
                        <input
                            value={this.state.filterText}
                            onChange={this.onFilterTextChange}
                        />
                    </div>
                    <AvailableCharacters
{'fraction_non_alphanumeric': 0.09501347708894879, 'fraction_numerical': 0.0013477088948787063, 'mean_word_length': 1.956839309428951, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '3977821', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1043, 'n_words': 169}