<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';
import RelationshipReminder from './relationships-reminder.component';
import RelationshipsSingleBubble from './relationships-single-bubble.component';
import SortBy from '../sort-by/sort-by.component';
import FlipMove from 'react-flip-move';
import { sortRelationshipState } from './relationships.reducer';
import FilterSearch from '../filter-search/filter-search.component';

/* -----------------    COMPONENT     ------------------ */
class Relationships extends Component {
    constructor(props) {
    super(props);
    this.state = {
      enterLeaveAnimation: 'accordionHorizontal',
      order: 'asc',
      sortingMethod: 'chronological',
      filterStr: '',
      filteredRelationships: []
    };
    this.renderRelationships = this.renderRelationships.bind(this);
    this.sortAsc = this.sortAsc.bind(this);
    this.sortDesc = this.sortDesc.bind(this);
    this.sortSmallToLarge = this.sortSmallToLarge.bind(this);
    this.sortLargeToSmall = this.sortLargeToSmall.bind(this);
    this.filterSearch = this.filterSearch.bind(this);
  }

  sortAsc(){
    const sortAsc = (a, b) => a.name.localeCompare(b.name);
    const relationshipsCopy = this.props.relationships.slice(0);
    relationshipsCopy.sort(sortAsc);
    this.props.sortRelationships(relationshipsCopy);
  }

  sortDesc(){
    const sortDesc = (a, b) => b.name.localeCompare(a.name);
    const relationshipsCopy = this.props.relationships.slice(0);
    relationshipsCopy.sort(sortDesc);
    this.props.sortRelationships(relationshipsCopy);
  }

  sortSmallToLarge(){
    const sortAsc = (a, b) => a.score - b.score;
    const relationshipsCopy = this.props.relationships.slice(0);
    relationshipsCopy.sort(sortAsc);
    this.props.sortRelationships(relationshipsCopy);
  }

  sortLargeToSmall(){
    const sortDesc = (a, b) => b.score - a.score;
    const relationshipsCopy = this.props.relationships.slice(0);
    relationshipsCopy.sort(sortDesc);
    this.props.sortRelationships(relationshipsCopy);
  }

  filterSearch(evt){
    evt.preventDefault();
    this.setState({filterStr: evt.target.value});
    const relationshipsCopy = this.props.relationships.filter(relationship => {
      if (relationship.name.includes(evt.target.value)){
        return true;
      }
    });
    this.setState({filteredRelationships: relationshipsCopy});<commit_msg>chore: filter search is case insensitive<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import RelationshipReminder from './relationships-reminder.component';
import RelationshipsSingleBubble from './relationships-single-bubble.component';
import SortBy from '../sort-by/sort-by.component';
import FlipMove from 'react-flip-move';
import { sortRelationshipState } from './relationships.reducer';
import FilterSearch from '../filter-search/filter-search.component';

/* -----------------    COMPONENT     ------------------ */
class Relationships extends Component {
    constructor(props) {
    super(props);
    this.state = {
      enterLeaveAnimation: 'accordionHorizontal',
      order: 'asc',
      sortingMethod: 'chronological',
      filterStr: '',
      filteredRelationships: []
    };
    this.renderRelationships = this.renderRelationships.bind(this);
    this.sortAsc = this.sortAsc.bind(this);
    this.sortDesc = this.sortDesc.bind(this);
    this.sortSmallToLarge = this.sortSmallToLarge.bind(this);
    this.sortLargeToSmall = this.sortLargeToSmall.bind(this);
    this.filterSearch = this.filterSearch.bind(this);
  }

  sortAsc(){
    const sortAsc = (a, b) => a.name.localeCompare(b.name);
    const relationshipsCopy = this.props.relationships.slice(0);
    relationshipsCopy.sort(sortAsc);
    this.props.sortRelationships(relationshipsCopy);
  }

  sortDesc(){
    const sortDesc = (a, b) => b.name.localeCompare(a.name);
    const relationshipsCopy = this.props.relationships.slice(0);
    relationshipsCopy.sort(sortDesc);
    this.props.sortRelationships(relationshipsCopy);
  }

  sortSmallToLarge(){
    const sortAsc = (a, b) => a.score - b.score;
    const relationshipsCopy = this.props.relationships.slice(0);
    relationshipsCopy.sort(sortAsc);
    this.props.sortRelationships(relationshipsCopy);
  }

  sortLargeToSmall(){
    const sortDesc = (a, b) => b.score - a.score;
    const relationshipsCopy = this.props.relationships.slice(0);
    relationshipsCopy.sort(sortDesc);
    this.props.sortRelationships(relationshipsCopy);
  }

  filterSearch(evt){
    evt.preventDefault();
    this.setState({filterStr: evt.target.value});
    const relationshipsCopy = this.props.relationships.filter(relationship => {
      if (relationship.name.toLowerCase().includes(evt.target.value.toLowerCase())){
        return true;
      }
    });
    this.setState({filteredRelationships: relationshipsCopy});
{'fraction_non_alphanumeric': 0.14221587431136504, 'fraction_numerical': 0.0016323199347072026, 'mean_word_length': 3.8058823529411763, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '7389492', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1416, 'n_words': 244}