<commit_before>var Reader = React.createClass({
  render: function() {
    return (
      <div class="page">
        <RefreshButton source="/api/articles/refresh.json"/>
        <Articles source="/api/articles.json" />
      </div>
    );
  }
});

var Articles = React.createClass({
  getInitialState: function() {
    return { articles: [] };

  },

  componentDidMount: function() {
    $.get(this.props.source, function(result) {
      if (this.isMounted()) {
        this.setState({ articles: result });
      }
    }.bind(this));
  },

  render: function() {
    var articles = this.state["articles"];
    return (
      <div class="articles">{
        articles.map(function(article) {
          return ( <Article article={article} /> );
        })
      }</div>
    );
  }
});

var Article = React.createClass({
  render: function() {
    return (
      <div class="article">
        <h4>
          <a href={this.props.article["url"]}>
            {this.props.article["title"]}
          </a>
          <small class="text-muted">
            <em>&nbsp;{this.props.article["feed_title"]}</em>
          </small>
          <p><small class="text-muted">
            {this.props.article["published_at"]}
          </small></p>
        </h4>
      </div>
    );
  }
});

var RefreshButton = React.createClass({
  getInitialState: function() {
    return {liked: false};
  },
  handleClick: function(event) {
    $.get(this.props.source, function(result) {
      if (this.isMounted()) {
        this.setState({ articles: result });
      }
    }.bind(this));
  },
  render: function() {
    return (
      <button className={"btn btn-default"} onClick={this.handleClick}>
        <i className={"fa fa-refresh"}></i>
      </button>
    );
  }
});

React.render(
  <Reader />,
  document.getElementById("app")
);<commit_msg>refresh view<commit_after>var Reader = React.createClass({
  getInitialState: function() {
    return { articles: [] };
  },

  handleClick: function(event) {
    $.get(this.props.source, function(result) {
      console.log("handleclick called.")
      this.setState({ articles: result });
    }.bind(this));
  },

  componentDidMount: function() {
    $.get(this.props.source, function(result) {
      if (this.isMounted()) {
        this.setState({ articles: result });
      }
    }.bind(this));
  },

  render: function() {
    return (
      <div class="page">
        <RefreshButton source="/api/articles/refresh.json" onClick={this.handleClick} />
        <Articles articles={this.state["articles"]} />
      </div>
    );
  }
});

var Articles = React.createClass({
  render: function() {
    return (
      <div class="articles">{
        this.props.articles.map(function(article) {
          return ( <Article article={article} /> );
        })
      }</div>
    );
  }
});

var Article = React.createClass({
  render: function() {
    return (
      <div class="article">
        <h4>
          <a href={this.props.article["url"]}>
            {this.props.article["title"]}
          </a>
          <small class="text-muted">
            <em>&nbsp;{this.props.article["feed_title"]}</em>
          </small>
          <p><small class="text-muted">
            {this.props.article["published_at"]}
          </small></p>
        </h4>
      </div>
    );
  }
});

var RefreshButton = React.createClass({
  render: function() {
    return (
      <button className={"btn btn-default"} onClick={this.props.onClick}>
        <i className={"fa fa-refresh"}></i>
      </button>
    );
  }
});

React.render(
  <Reader source="/api/articles.json" />,
  document.getElementById("app")
);
{'fraction_non_alphanumeric': 0.1845600442722745, 'fraction_numerical': 0.0011068068622025456, 'mean_word_length': 2.313473877176902, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, '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': '6257758', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1125, 'n_words': 191}