<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as PostAction from '../actions/PostAction';
import moment from 'moment-timezone';
import CommentList from '../components/CommentList';

class PostPage extends Component {
  constructor(props) {
    super(props);
    this.PostAction = bindActionCreators(PostAction, props.dispatch);
  }

  componentWillMount() {
    document.title = 'Posts';
  }
  componentDidMount() {
    if(this.props.match.params){
      const {id }= this.props.match.params;
      this.PostAction.fetchPost(id);
      this.PostAction.fetchPostComments(id)
    }
  }

  voteAction(option) {
    const id = this.props.PostReducer.currentPost.id;
    option === 'up' ?
      this.PostAction.voteUp(id) :
      this.PostAction.voteDown(id)
  }
  hideArg = 'hide';
  render() {
    const {currentPost, activeSortType, comments, inputComment} = this.props.PostReducer;
    if(currentPost) {
      document.title =`${currentPost.title} Post ${currentPost.category}`;
    }
    return (
      <div className='container post-contanainer'>
        <button onClick={()=>console.log(this.props.PostReducer)}>test</button>
        <section className='post-header'>
          <div className='row'>
            <h3><em>{currentPost.title}</em></h3>
          </div>
          <div className='row'>
            <i className='post-basic'>Category: {currentPost.category}</i>
            <i className='post-basic'>Author: {currentPost.author}</i>
            <i className='post-basic'>Time: {moment(currentPost.timestamp).format('MM/DD/YYYY  hh:mm:ss')}</i>
          </div>
        </section>
        <hr/>
        <section className='post-body'>
          <div className='row post-content'>{currentPost.body}</div>
          <div className='row'>
            <div className='vote col-sm-1'>Votes: {currentPost.voteScore}</div>
            <div className='col-sm-2'>
              <button className="fa fa-thumbs-o-up vote-pointer" aria-hidden="true" onClick={this.voteAction.bind(this, 'up')}></button>
              <button className="fa fa-thumbs-o-down vote-pointer" aria-hidden="true" onClick={this.voteAction.bind(this, 'down')}></button>
            </div>
          </div>
        </section>
        <hr/>
        <section className='post-body'>
          <div className='row'>
            <span>
              <i className='comment-thumb'>{comments.length} {comments.length>0?'comments':'comment'}: </i>
              {comments.length>0 && <span><commit_msg>add button foe edit delete post<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as PostAction from '../actions/PostAction';
import moment from 'moment-timezone';
import CommentList from '../components/CommentList';
import {Link} from 'react-router-dom';

class PostPage extends Component {
  constructor(props) {
    super(props);
    this.PostAction = bindActionCreators(PostAction, props.dispatch);
  }

  componentWillMount() {
    document.title = 'Posts';
  }
  componentDidMount() {
    if(this.props.match.params){
      const {id }= this.props.match.params;
      this.PostAction.fetchPost(id);
      this.PostAction.fetchPostComments(id)
    }
  }

  voteAction(option) {
    const id = this.props.PostReducer.currentPost.id;
    option === 'up' ?
      this.PostAction.voteUp(id) :
      this.PostAction.voteDown(id)
  }
  hideArg = 'hide';
  render() {
    const {currentPost, activeSortType, comments, inputComment} = this.props.PostReducer;
    if(currentPost) {
      document.title =`${currentPost.title} Post ${currentPost.category}`;
    }
    return (
      <div className='container post-contanainer'>
        <button onClick={()=>console.log(this.props.PostReducer)}>test</button>
        <section className='post-header'>
          <div className='row'>
            <h3><em>{currentPost.title}</em></h3>
          </div>
          <div className='row'>
            <span className='col-sm-8'>
              <i className='post-basic'>Category: {currentPost.category}</i>
              <i className='post-basic'>Author: {currentPost.author}</i>
              <i className='post-basic'>Time: {moment(currentPost.timestamp).format('MM/DD/YYYY  hh:mm:ss')}</i>
            </span>
            <span className='col-sm-4'>
              <i to='' className="fa fa-pencil vote-pointer" aria-hidden="true">
                Edit
              </i>
              <i to='' className="fa fa-trash vote-pointer" aria-hidden="true">
                Delete
              </i>
            </span>
          </div>
        </section>
        <hr/>
        <section className='post-body'>
          <div className='row post-content'>{currentPost.body}</div>
          <div className='row'>
            <div className='vote col-sm-1'>Votes: {currentPost.voteScore}</div>
            <div className='col-sm-2'>
              <button className="fa fa-thumbs-o-up vote-pointer" aria-hidden="true" onClick={this.voteAction.bind(this, 'up')}></button>
              <button className="fa fa-thumbs-o-down vote-pointer" aria-hidden="true" onClick={this.voteAction.bind(this, 'down')}></button>
            </div>
          </div>
        </section>
        <hr/>
        <section className='post-body'>
          <div className='row'>
            <span>
              <i className='comment-thumb'>{comments.length} {comments.length>0?'comments':'comment'}: </i>
              {comments.length>0 && <span>
{'fraction_non_alphanumeric': 0.1596623563218391, 'fraction_numerical': 0.002514367816091954, 'mean_word_length': 2.644633507853403, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 99, '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': '1953834', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1649, 'n_words': 302}