<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import css from './LastVotes.css';
import { voteWithNameSelector } from '../selectors/voting';

const LastVotes = ({ votes }) => (
  <div className={css.component}>
    <h3>Siste stemmer</h3>
    { votes.map(vote => (
      <div className={css.vote}>
        { vote.voter }:
        <span className={css.alternative}> { vote.alternative }</span>
      </div>
    ))}
  </div>
);

LastVotes.propTypes = {
  votes: PropTypes.shape({
    voter: PropTypes.string.isRequired,
    alternative: PropTypes.string.isRequired,
  }).isRequired,
};

const mapStateToProps = state => ({
  votes: voteWithNameSelector(state).slice(0, 5),
});

export default connect(mapStateToProps)(LastVotes);<commit_msg>Display text when no one has voted yet<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import css from './LastVotes.css';
import { voteWithNameSelector } from '../selectors/voting';

const LastVotes = ({ votes }) => (
  <div className={css.component}>
    <h3>Siste stemmer</h3>
    { votes.length > 0 ? votes.map(vote => (
      <div className={css.vote}>
        { vote.voter }: { vote.alternative }
      </div>
    ))
    : (
      <div>Ingen stemmer enda</div>
    )}
  </div>
);

LastVotes.propTypes = {
  votes: PropTypes.shape({
    voter: PropTypes.string.isRequired,
    alternative: PropTypes.string.isRequired,
  }).isRequired,
};

const mapStateToProps = state => ({
  votes: voteWithNameSelector(state).slice(0, 5),
});

export default connect(mapStateToProps)(LastVotes);
{'fraction_non_alphanumeric': 0.1588447653429603, 'fraction_numerical': 0.005415162454873646, 'mean_word_length': 3.6977401129943503, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 26, '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': '6795489', 'n_tokens_mistral': 538, 'n_tokens_neox': 547, 'n_words': 116}