<commit_before>let React = require('react'),
  ReactRedux = require('react-redux'),
  steemConnect = require('steemconnect'),
  numeral = require('numeral'),
  actions = require('../actions'),
  Link = require('react-router').Link;

import Icon from '../widgets/Icon';

const Actions = React.createClass({
  getInitialState() {
    return {
      voted: false
    };
  },
  componentWillMount() {
    if (this.props.auth.isAuthenticated) {
      this.props.post.active_votes.forEach((entry, key) => {
        if (entry.voter === this.props.auth.user.name) {
          this.setState({ voted: true });
        }
      });
    }
  },
  vote(voter, author, permlink, weight) {
    if (this.props.auth.isAuthenticated) {
      steemConnect.vote(voter, author, permlink, weight, (err, result) => {
        if (!err) this.setState({ voted: true });
      });
    }
  },
  init() {

  },

  handleCommentBoxClick(e) {
    e.stopPropagation();
    if (!this.props.auth.isAuthenticated) {
      this.props.notify('You need to login in order to write comments.');
      return;
    }

    const { id, category, author, permlink } = this.props.post;
    this.props.onCommentRequest({
      parentAuthor: author,
      parentPermlink: permlink,
      category,
      id,
    });
  },

  handleCommentsTextClick(e) {
    e.stopPropagation();
    this.props.onShowCommentsRequest();
  },

  handleReblog() {
    const { auth, post, reblog, notify } = this.props;

    if (!auth.isAuthenticated) {
      notify('You need to login in order to reblog posts.');
      return;
    }
    reblog(post.id);
  },

  render() {
    const voter = (this.props.auth.isAuthenticated) ? this.props.auth.user.name : '';
    const post = this.props.post;
    const payout = parseFloat(post.total_payout_value) + parseFloat(post.total_pending_payout_value);
    return (
      <ul>
        <li><a onClick={() => this.vote(voter, post.author, post.permlink, 10000)} className={this.state.voted ? 'active' : ''}><i className="icon icon-sm material-icons">thumb_up</i></a> {numeral(post.net_votes).format('0,0')}<span className="hidden-xs"> Likes</span></li>
        <li><span className="hidden-xs"><i className="icon icon-sm material-icons">attach_money</i> </span>{numeral(payout).format('$0,0.00')}</li>

        <li>
          <a onClick={e => this.handleCommentBoxClick(e)}>
            <i className="icon icon-sm material-icons">reply</i>
          </a>
          { ' ' }
          <a onClick={e => this.handleCommentsTextClick(e)}>
            { numeral(post.children).format('0,0') }
            <span className="hidden-xs"> Comments</span>
          </a>
        </li>

        <li>
          <a
            onClick={() => this.handleReblog()}
            className={this.props.isReblogged ? 'active' : '' }
          >
            <Icon small name="repeat" />
            <span className="hidden-xs">
              { ' ' }
              Reblog
            </span>
          </a>
        </li>
      </ul>
    );
  }
});

const mapStateToProps = function (state) {
  return {
    auth: state.auth
  };
};

const mapDispatchToProps = function (dispatch) {
  return {};
};

module.exports = ReactRedux.connect(mapStateToProps, mapDispatchToProps)(Actions);<commit_msg>cleanup component into es7 style<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import steemConnect from 'steemconnect';
import numeral from 'numeral';
import action from '../actions';
import { Link } from 'react-router';

import Icon from '../widgets/Icon';

@connect(
  state => ({
    auth: state.auth,
  }),
  dispatch => ({})
)
export default class PostActionButtons extends Component {
  constructor() {
    this.state = {
      voted: false
    };
  }

  componentWillMount() {
    if (this.props.auth.isAuthenticated) {
      this.props.post.active_votes.forEach((entry, key) => {
        if (entry.voter === this.props.auth.user.name) {
          this.setState({ voted: true });
        }
      });
    }
  }

  vote(voter, author, permlink, weight) {
    if (this.props.auth.isAuthenticated) {
      steemConnect.vote(voter, author, permlink, weight, (err, result) => {
        if (!err) this.setState({ voted: true });
      });
    }
  }

  handleCommentBoxClick(e) {
    e.stopPropagation();
    if (!this.props.auth.isAuthenticated) {
      this.props.notify('You need to login in order to write comments.');
      return;
    }

    const { id, category, author, permlink } = this.props.post;
    this.props.onCommentRequest({
      parentAuthor: author,
      parentPermlink: permlink,
      category,
      id,
    });
  }

  handleCommentsTextClick(e) {
    e.stopPropagation();
    this.props.onShowCommentsRequest();
  }

  handleReblog() {
    const { auth, post, reblog, notify } = this.props;

    if (!auth.isAuthenticated) {
      notify('You need to login in order to reblog posts.');
      return;
    }
    reblog(post.id);
  }

  render() {
    const voter = (this.props.auth.isAuthenticated) ? this.props.auth.user.name : '';
    const post = this.props.post;
    const payout = parseFloat(post.total_payout_value) + parseFloat(post.total_pending_payout_value);
    return (
      <ul>
        <li>
          <a
            onClick={() => this.vote(voter, post.author, post.permlink, 10000)}
            className={this.state.voted ? 'active' : ''}
          >
            <i className="icon icon-sm material-icons">thumb_up</i>
          </a>
          { ' ' }
          { numeral(post.net_votes).format('0,0') }
          <span className="hidden-xs"> Likes</span>
        </li>
        <li>
          <span className="hidden-xs">
            <i className="icon icon-sm material-icons">
              attach_money
            </i>
            { ' ' }
          </span>
          { numeral(payout).format('$0,0.00') }
        </li>

        <li>
          <a onClick={e => this.handleCommentBoxClick(e)}>
            <i className="icon icon-sm material-icons">reply</i>
          </a>
          { ' ' }
          <a onClick={e => this.handleCommentsTextClick(e)}>
            { numeral(post.children).format('0,0') }
            <span className="hidden-xs"> Comments</span>
          </a>
        </li>

        <li>
          <a
            onClick={() => this.handleReblog()}
            className={this.props.isReblogged ? 'active' : '' }
          >
            <Icon small name="repeat" />
            <span className="hidden-xs">
              { ' ' }
              Reblog
            </span>
          </a>
        </li>
      </ul>
    );
  }
}
{'fraction_non_alphanumeric': 0.15895249695493302, 'fraction_numerical': 0.004110840438489647, 'mean_word_length': 2.228009828009828, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 83, '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': '3687221', 'n_tokens_mistral': 2105, 'n_tokens_neox': 2086, 'n_words': 391}