<commit_before>import React, {Component} from 'react'
import user from 'lib/user/user'
import t from 't-component'
import tagImages from 'lib/tags-images'
import {Link} from 'react-router'

export default class ListItem extends Component {
  constructor (props) {
    super(props)
    this.onUserStateChange = this.onUserStateChange.bind(this)
  }

  componentWillMount () {
    user.on('loaded', this.onUserStateChange)
    user.on('unloaded', this.onUserStateChange)
  }

  componentWillUnmount () {
    user.off('loaded', this.onUserStateChange)
    user.off('unloaded', this.onUserStateChange)
  }

  onUserStateChange () {
    this.forceUpdate()
  }

  render () {
    const voted = user.logged() && this.props.item.voted

    return (
      <li className='sidebar-link' data-id={this.props.item.id}>
        <Link
          to={this.props.item.url}
          className={(voted ? 'voted' : '') + (this.props.active ? ' active' : '')}
          activeClassName='active'>
          <div className='item-tag'>
            <img
              className='tag-img'
              src={tagImages[this.props.item.tag.image].url} />
            <img
              className='hexagon'
              src='/lib/tags-images/hexagon.svg' />
          </div>
          <div className='item-text'>
            <span className='title'>
              {this.props.item.mediaTitle}
              {voted && <i className='icon-check' />}
            </span>
            <span className='created-by'>
              <CreatedBy item={this.props.item} />
            </span>
          </div>
        </Link>
      </li>
    )
  }
}

function CreatedBy (props) {
  const item = props.item

  if (item.participants.length > 0) {
    const cardinality = item.participants.length === 1 ? 'singular' : 'plural'
    const msg = t('proposal-article.participant.' + cardinality)
    return <span>{item.participants.length + ' ' + msg}</span>
  }

  if (item.closingAt) {
    const closed = Number(new Date(item.closingAt)) < Date.now()

    return (
      <span>
        <span
          className='time-ago-label'>
          {(closed ? t('common.closed') : t('common.close'))}
        </span>
        <span
          data-time={item.closingAt.toString()}
          className='meta-item meta-timeago ago' />
      </span>
    )<commit_msg>fix spacing of closed ago tag<commit_after>import React, {Component} from 'react'
import user from 'lib/user/user'
import t from 't-component'
import tagImages from 'lib/tags-images'
import {Link} from 'react-router'

export default class ListItem extends Component {
  constructor (props) {
    super(props)
    this.onUserStateChange = this.onUserStateChange.bind(this)
  }

  componentWillMount () {
    user.on('loaded', this.onUserStateChange)
    user.on('unloaded', this.onUserStateChange)
  }

  componentWillUnmount () {
    user.off('loaded', this.onUserStateChange)
    user.off('unloaded', this.onUserStateChange)
  }

  onUserStateChange () {
    this.forceUpdate()
  }

  render () {
    const voted = user.logged() && this.props.item.voted

    return (
      <li className='sidebar-link' data-id={this.props.item.id}>
        <Link
          to={this.props.item.url}
          className={(voted ? 'voted' : '') + (this.props.active ? ' active' : '')}
          activeClassName='active'>
          <div className='item-tag'>
            <img
              className='tag-img'
              src={tagImages[this.props.item.tag.image].url} />
            <img
              className='hexagon'
              src='/lib/tags-images/hexagon.svg' />
          </div>
          <div className='item-text'>
            <span className='title'>
              {this.props.item.mediaTitle}
              {voted && <i className='icon-check' />}
            </span>
            <span className='created-by'>
              <CreatedBy item={this.props.item} />
            </span>
          </div>
        </Link>
      </li>
    )
  }
}

function CreatedBy (props) {
  const item = props.item

  if (item.participants.length > 0) {
    const cardinality = item.participants.length === 1 ? 'singular' : 'plural'
    const msg = t('proposal-article.participant.' + cardinality)
    return <span>{item.participants.length + ' ' + msg}</span>
  }

  if (item.closingAt) {
    const closed = Number(new Date(item.closingAt)) < Date.now()

    return (
      <span>
        <span
          className='time-ago-label'>
          {(closed ? t('common.closed') : t('common.close'))}
        </span>
        &nbsp;
        <span
          data-time={item.closingAt.toString()}
          className='meta-item meta-timeago ago' />
      </span>
    )
{'fraction_non_alphanumeric': 0.14983853606027986, 'fraction_numerical': 0.000861141011840689, 'mean_word_length': 2.1975223675154854, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, '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': '6740704', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1405, 'n_words': 264}