<commit_before>import React from 'react';
import AutoComplete from 'material-ui/AutoComplete';

class AutoCompleteTags extends React.Component {

  constructor(props) {
    super(props);

    this.state = {
      dataSource: [],
    };
  }

  handleUpdateInput = (value) => {
    this.setState({<commit_msg>refactored to class pattern, implemented proper dropdown values<commit_after>import React from 'react';
import AutoComplete from 'material-ui/AutoComplete';
import ReactFireMixin from 'reactfire';
import firebase from 'firebase';
import _ from 'lodash';

const AutoCompleteTags = React.createClass({
  mixins: [ReactFireMixin],

  getInitialState: function() {
    return {
      profile: undefined,
      tags: []
    };
  },

  componentWillMount: function() {
    this.bindAsArray(firebase.database().ref('tags'), 'tags');
    this.bindAsObject(firebase.database().ref('users/0'), 'profile');
  },

  mapAutomcompleteOptions: function () {
    return _.map(this.state.tags,(tag) => tag.en);
  },

  alreadyUsed: function (tag) {
    return _.find(this.getProfileTags(),(profileTag) => profileTag === this.state.tags.indexOf(tag));
  },

  removeAlreadyUsedOptions: function() {
    return _.filter(this.state.tags,(tag) => !this.getProfileTags().length === 0 && !this.alreadyUsed(tag));
  },

  getProfileTags: function () {
    return (this.state.profile && this.state.profile.tags ? this.state.profile.tags : [])
  },

  render: function () {
    return (
        <div>
          <AutoComplete
              hintText="Tag ..."
              dataSource={this.mapAutomcompleteOptions()}
          />
        </div>
    );
  }

});

class AutoCompleteTagsi extends React.Component {

  constructor(props) {
    super(props);

    this.state = {
      dataSource: [],
    };
  }

  handleUpdateInput = (value) => {
    this.setState({
{'fraction_non_alphanumeric': 0.1482084690553746, 'fraction_numerical': 0.0010857763300760044, 'mean_word_length': 3.30607476635514, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 11, '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': '117530', 'n_tokens_mistral': 559, 'n_tokens_neox': 543, 'n_words': 105}