<commit_before>import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { actions as commentsActions } from '../../redux/modules/comments';
import ReactDOM from 'react-dom';
import {Button, Card, Content, Header, Column, Image, Reveal, Segment, Icon} from 'react-semantify';
import moment from 'moment';

type
Props = {
  fetchFromServer: Function,
  sendComment: Function,
  comments: Object
};

var Avatar = React.createClass({

  render: function() {
    if(this.props.comment.authorPicture){
      return (
        <img src={'user-images/' + this.props.comment.authorPicture}>
        </img>
      )
    } else {
      return(
        <object type="image/svg+xml" data={'user-images/' + this.props.comment.authorAvatar}>
        </object>
      );
    }
  }
});

var CommentsList =  React.createClass({
  render: function() {

    var comments = this.props.comments.comments.map(function (comment) {
      return (
        <div className="comment" key={comment._id}>
          <a className="avatar">
              <Avatar comment={comment}/>
          </a>
          <div className="content">
            <a href={ '#/people/' + comment.author} className="author">
              {comment.authorDisplay}
            </a>
            <div className="metadata">
              <span className="date">{moment(comment.date).format('lll')}</span>
            </div>
              <pre className="text">
                <p> {comment.content}</p>
              </pre>
          </div>
          <p></p>
        </div>
      );
    });

    return(
      <div className="ui comments">
        <h5 className="ui header">Comments</h5>
        {comments}
      </div>
    );
  }

});

var CommentInput = React.createClass ({
  getInitialState: function() {
    return {
      value: ''
    };
  },
  handleChange: function(event) {
    this.setState({
      value: event.target.value
    });
  },

  handleSubmit: function(val) {
    this.props.sendComment(this.props.hackId, {'content': this.state.value});
    this.setState({
      value: ''
    })
  },

  render: function() {
    return (
      <div className="field"><commit_msg>Prevents empty comment from being added<commit_after>import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { actions as commentsActions } from '../../redux/modules/comments';
import ReactDOM from 'react-dom';
import {Button, Card, Content, Header, Column, Image, Reveal, Segment, Icon} from 'react-semantify';
import moment from 'moment';

type
Props = {
  fetchFromServer: Function,
  sendComment: Function,
  comments: Object
};

var Avatar = React.createClass({

  render: function() {
    if(this.props.comment.authorPicture){
      return (
        <img src={'user-images/' + this.props.comment.authorPicture}>
        </img>
      )
    } else {
      return(
        <object type="image/svg+xml" data={'user-images/' + this.props.comment.authorAvatar}>
        </object>
      );
    }
  }
});

var CommentsList =  React.createClass({
  render: function() {

    var comments = this.props.comments.comments.map(function (comment) {
      return (
        <div className="comment" key={comment._id}>
          <a className="avatar">
              <Avatar comment={comment}/>
          </a>
          <div className="content">
            <a href={ '#/people/' + comment.author} className="author">
              {comment.authorDisplay}
            </a>
            <div className="metadata">
              <span className="date">{moment(comment.date).format('lll')}</span>
            </div>
              <pre className="text">
                <p> {comment.content}</p>
              </pre>
          </div>
          <p></p>
        </div>
      );
    });

    return(
      <div className="ui comments">
        <h5 className="ui header">Comments</h5>
        {comments}
      </div>
    );
  }

});

var CommentInput = React.createClass ({
  getInitialState: function() {
    return {
      value: ''
    };
  },
  handleChange: function(event) {
    this.setState({
      value: event.target.value
    });
  },

  handleSubmit: function(val) {
    if(!this.state.value) {
      return;
    }
    this.props.sendComment(this.props.hackId, {'content': this.state.value});
    this.setState({
      value: ''
    })
  },

  render: function() {
    return (
      <div className="field">
{'fraction_non_alphanumeric': 0.1573187414500684, 'fraction_numerical': 0.0009119927040583675, 'mean_word_length': 2.240029542097489, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '6633725', 'n_tokens_mistral': 1306, 'n_tokens_neox': 1301, 'n_words': 274}