<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import Comments from './Comments'
import { sortVote} from "../actions/index"


/**
 * @description Creates a list of all posts ordered by voteScore (highest score first)
 * @constructor
 */
class Posts extends Component {

    sortPostsByVote = () => {
        this.props.dispatch(sortVote())
    };

    render() {
        return (
            <div id="post-view">
                <div className="row">
                    <div className="col-sm-6">Title</div>
                    <div className="col-sm">Category</div>
                    <div className="col-sm"><a onClick={this.sortPostsByVote()}>Vote Score</a></div>
                </div>
                {/*{*/}
                {/*this.props.postsArray.map( (post) => (*/}
                    {/*<div className="post-listing container-fluid" >*/}
                        {/*<div className="row">*/}
                            {/*<div className="col-sm-8">{post.title}</div>*/}
                            {/*<div className="col-sm">{post.category}</div>*/}
                            {/*<div className="col-sm">{post.voteScore}</div>*/}
                        {/*</div>*/}
                    {/*</div>*/}
                {/*))*/}
                {/*}*/}


            </div>
    )
    }
}


function mapStateToProps({ posts, categories }) {
    console.log( posts );
    // https://stackoverflow.com/questions/6857468/converting-a-js-object-to-an-array#26166303
    let postsArray =  Object.keys( posts ).map(key => posts[key]);
    console.log( typeof postsArray )
    // posts.posts.map((post) => postsArray.push(post));
<commit_msg>fea: Posts componenst maps on props.items<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import Comments from './Comments'
import { sortVote} from "../actions/index"


/**
 * @description Creates a list of all posts ordered by voteScore (highest score first)
 * @constructor
 */
class Posts extends Component {

    sortPostsByVote = () => {
        this.props.dispatch(sortVote())
    };

    render() {
        return (
            <div id="post-view">
                <div className="row">
                    <div className="col-sm-6">Title</div>
                    <div className="col-sm">Category</div>
                    <div className="col-sm"><a onClick={this.sortPostsByVote()}>Vote Score</a></div>
                </div>
                {
                this.props.items.map( (post) => (
                    <div className="post-listing container-fluid" >
                        <div className="row">
                            <div className="col-sm-8">{post.title}</div>
                            <div className="col-sm">{post.category}</div>
                            <div className="col-sm">{post.voteScore}</div>
                        </div>
                    </div>
                ))
                }


            </div>
    )
    }
}


function mapStateToProps({ posts, categories }) {
    console.log( posts );
    // https://stackoverflow.com/questions/6857468/converting-a-js-object-to-an-array#26166303
    let postsArray =  Object.keys( posts ).map(key => posts[key]);
    console.log( typeof postsArray )
    // posts.posts.map((post) => postsArray.push(post));

{'fraction_non_alphanumeric': 0.16232053911514796, 'fraction_numerical': 0.009961910342806914, 'mean_word_length': 1.7377706495589416, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 55, 'https://': 2, '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': '626660', 'n_tokens_mistral': 1020, 'n_tokens_neox': 944, 'n_words': 185}