<commit_before>import React, { Component } from 'react';
import _ from 'lodash';
import SearchBar from './search_bar';
import OfficeList from './office_list';
import OfficeDetail from './office_detail';
import offices from '../data/offices.json';

class App extends Component {
  constructor(props) {
    super(props);
    this.state ={
      activeOffice: null,
      offices: []
    };
  }
  onSearchTermChange(term) {
    console.log('search term change:', term);
    if (!term) {
      this.setState({ activeOffice:null });
      this.setState({ offices:[] });
      return;
    }
    const matchedOffices = _.filter(offices, (office) => {
      return office.name.indexOf(term) > -1;
    });
    if (matchedOffices.length > 0) {
      this.setState({ activeOffice:matchedOffices[0] });
    }
    this.setState({ offices:matchedOffices });
  }
  render() {
    return (
      <div>
        <div className="row search-header">
          <h4 className="col-md-12">办公室查询</h4>
          <div className="col-md-6">
          <SearchBar onSearchTermChange={ this.onSearchTermChange.bind(this) } />
          </div>
        </div>
        <div className="row content-body">
          <div className="col-md-8">
            <OfficeDetail office={ this.state.activeOffice } />
          </div>
          <div className="col-md-4">
            <OfficeList />
          </div><commit_msg>comment out state in app.js; as offices and activeOffice are through reducers<commit_after>import React, { Component } from 'react';
import _ from 'lodash';
import SearchBar from './search_bar';
import OfficeList from './office_list';
import OfficeDetail from './office_detail';
import offices from '../data/offices.json';

class App extends Component {
  constructor(props) {
    super(props);
    /*
    this.state ={
      activeOffice: null,
      offices: []
    };
    */
  }
  onSearchTermChange(term) {
    console.log('search term change:', term);
    /*
    if (!term) {
      this.setState({ activeOffice:null });
      this.setState({ offices:[] });
      return;
    }
    const matchedOffices = _.filter(offices, (office) => {
      return office.name.indexOf(term) > -1;
    });
    if (matchedOffices.length > 0) {
      this.setState({ activeOffice:matchedOffices[0] });
    }
    this.setState({ offices:matchedOffices });
    */
  }
  render() {
    return (
      <div>
        <div className="row search-header">
          <h4 className="col-md-12">办公室查询</h4>
          <div className="col-md-6">
          <SearchBar onSearchTermChange={ this.onSearchTermChange.bind(this) } />
          </div>
        </div>
        <div className="row content-body">
          <div className="col-md-8">
            <OfficeDetail />
          </div>
          <div className="col-md-4">
            <OfficeList />
          </div>
{'fraction_non_alphanumeric': 0.15076268180205746, 'fraction_numerical': 0.0070947144377438804, 'mean_word_length': 2.4057971014492754, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 39, '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': '1033262', 'n_tokens_mistral': 867, 'n_tokens_neox': 858, 'n_words': 184}