<commit_before>var React = require('react');
var remote = window.require('remote');
var shell = remote.require('shell');

var apiRequests = require('../utils/api-requests');

var Notification = React.createClass({

  getInitialState: function () {
    return {
      readClass: 'row notification',
      read: false
    };
  },

  openBrowser: function () {
    var url = this.props.notification.subject.url.replace('api.github.com/repos', 'www.github.com');
    if (url.indexOf('/pulls/') != -1) {
      url = url.replace('/pulls/', '/pull/');
    }
    shell.openExternal(url);
  },

  markAsRead: function () {
    var self = this;
    if (this.state.read) { return; }
    apiRequests
      .patchAuth('https://api.github.com/notifications/threads/' + this.props.notification.id)
      .end(function (err, response) {
        if (response && response.ok) {
          // Notification Read
          self.setState({
            readClass: self.state.readClass + ' read',
            read: true
          });
        } else {
          // Error - Show messages.
          // Show appropriate message
        }
      });
  },

  render: function () {
    var typeIconClass;

    if (this.props.notification.subject.type == 'Issue') {
      typeIconClass = 'octicon octicon-issue-opened';
    } else if (this.props.notification.subject.type == 'PullRequest') {
      typeIconClass = 'octicon octicon-git-pull-request';
    } else if (this.props.notification.subject.type == 'Commit') {
      typeIconClass = 'octicon octicon-git-commit';
    } else {
      typeIconClass = 'octicon octicon-question';
    }

    return (
      <div className={this.state.readClass}>
        <div className='col-xs-1'><span className={typeIconClass} /></div>
        <div className='col-xs-10 subject' onClick={this.openBrowser}>
          {this.props.notification.subject.title}
        </div>
        <div className='col-xs-1 check-wrapper'>
          <span className='octicon octicon-check' onClick={this.markAsRead} />
        </div>
      </div>
    );
  }
});

module.exports = Notification;<commit_msg>Rename Notification to NotificationItem<commit_after>var React = require('react');
var remote = window.require('remote');
var shell = remote.require('shell');

var apiRequests = require('../utils/api-requests');

var NotificationItem = React.createClass({

  getInitialState: function () {
    return {
      readClass: 'row notification',
      read: false
    };
  },

  openBrowser: function () {
    var url = this.props.notification.subject.url.replace('api.github.com/repos', 'www.github.com');
    if (url.indexOf('/pulls/') != -1) {
      url = url.replace('/pulls/', '/pull/');
    }
    shell.openExternal(url);
  },

  markAsRead: function () {
    var self = this;
    if (this.state.read) { return; }
    apiRequests
      .patchAuth('https://api.github.com/notifications/threads/' + this.props.notification.id)
      .end(function (err, response) {
        if (response && response.ok) {
          // Notification Read
          self.setState({
            readClass: self.state.readClass + ' read',
            read: true
          });
        } else {
          // Error - Show messages.
          // Show appropriate message
        }
      });
  },

  render: function () {
    var typeIconClass;

    if (this.props.notification.subject.type == 'Issue') {
      typeIconClass = 'octicon octicon-issue-opened';
    } else if (this.props.notification.subject.type == 'PullRequest') {
      typeIconClass = 'octicon octicon-git-pull-request';
    } else if (this.props.notification.subject.type == 'Commit') {
      typeIconClass = 'octicon octicon-git-commit';
    } else {
      typeIconClass = 'octicon octicon-question';
    }

    return (
      <div className={this.state.readClass}>
        <div className='col-xs-1'><span className={typeIconClass} /></div>
        <div className='col-xs-10 subject' onClick={this.openBrowser}>
          {this.props.notification.subject.title}
        </div>
        <div className='col-xs-1 check-wrapper'>
          <span className='octicon octicon-check' onClick={this.markAsRead} />
        </div>
      </div>
    );
  }
});

module.exports = NotificationItem;
{'fraction_non_alphanumeric': 0.15479582146248813, 'fraction_numerical': 0.0023741690408357074, 'mean_word_length': 2.4933665008291874, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '4871774', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1242, 'n_words': 242}