<commit_before>'use strict';
import React from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import TextField from 'material-ui/TextField';
import Paper from 'material-ui/Paper';
import RefreshIndicator from 'material-ui/RefreshIndicator';
import {deepOrange500} from 'material-ui/styles/colors';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';

import Dictionary from '../api/Dictionary';

const styles = {
  container: {
    textAlign: 'center',
    paddingTop: 50,
  },
  paper: {
    width: 600,
    margin: '0 auto',
    marginTop: 50,
    padding: 5,
    fontSize: 15
  },
  refresh: {
    position: 'relative',
  },
  entryStyle: {
    textAlign: 'left'
  }
};

// Different search states
const EMPTY_STATE = "empty";
const DONE_STATE = "done";
const IN_PROGRESS_STATE = "inprogress";

const muiTheme = getMuiTheme();

class Main extends React.Component {
  constructor(props, context) {
    super(props, context);
    this.dictionaryObj = new Dictionary();
    this.handleTouchTap = this.handleTouchTap.bind(this);

    // Setting state
    this.state = {searchState: EMPTY_STATE, searchResponse: "", inputWord: ""};
  }

  handleTouchTap() {
    // Setting searchState to true to show the loading circle
    this.setState({searchState: IN_PROGRESS_STATE});
    let word = this.refs.searchText.input.value;

    // Making the API call
    this.dictionaryObj.lookupWord(word, (err, response) => {
      if (err) {
        return console.error(err);
      }
      this.setState({
        searchState: DONE_STATE,
        searchResponse: response,
        inputWord: word
      });
    });
    this.refs.searchText.input.value = "";
  }

  render() {
    // Creating the meaning and example section if the state is properly set<commit_msg>Focussing on the text box on page load<commit_after>'use strict';
import React from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import TextField from 'material-ui/TextField';
import Paper from 'material-ui/Paper';
import RefreshIndicator from 'material-ui/RefreshIndicator';
import {deepOrange500} from 'material-ui/styles/colors';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';

import Dictionary from '../api/Dictionary';

const styles = {
  container: {
    textAlign: 'center',
    paddingTop: 50,
  },
  paper: {
    width: 600,
    margin: '0 auto',
    marginTop: 50,
    padding: 5,
    fontSize: 15
  },
  refresh: {
    position: 'relative',
  },
  entryStyle: {
    textAlign: 'left'
  }
};

// Different search states
const EMPTY_STATE = "empty";
const DONE_STATE = "done";
const IN_PROGRESS_STATE = "inprogress";

const muiTheme = getMuiTheme();

class Main extends React.Component {
  constructor(props, context) {
    super(props, context);
    this.dictionaryObj = new Dictionary();
    this.handleTouchTap = this.handleTouchTap.bind(this);

    // Setting state
    this.state = {searchState: EMPTY_STATE, searchResponse: "", inputWord: ""};
  }

  componentDidMount() {
    // Focussing on the text box on page load
    setTimeout(() => {
      // Giving a 100 ms delay for a more visual transition effect
      this.refs.searchText.input.focus();
    }, 100);
  }

  handleTouchTap() {
    // Setting searchState to true to show the loading circle
    this.setState({searchState: IN_PROGRESS_STATE});
    let word = this.refs.searchText.input.value;

    // Making the API call
    this.dictionaryObj.lookupWord(word, (err, response) => {
      if (err) {
        return console.error(err);
      }
      this.setState({
        searchState: DONE_STATE,
        searchResponse: response,
        inputWord: word
      });
    });
    this.refs.searchText.input.value = "";
  }

  render() {
    // Creating the meaning and example section if the state is properly set
{'fraction_non_alphanumeric': 0.11961234378984953, 'fraction_numerical': 0.008671257332313186, 'mean_word_length': 3.3529411764705883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '756025', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1188, 'n_words': 319}