<commit_before>kd         = require 'kd'
React      = require 'kd-react'
immutable  = require 'immutable'
classnames = require 'classnames'
Link       = require 'app/components/common/link'


module.exports = class SidebarListItem extends React.Component

  getClassName: ->
    classnames
      SidebarListItem        : yes
      active                 : @props.active


  renderUnreadCount: ->
    return null  unless @props.unreadCount > 0

    return \
      <cite className='SidebarListItem-unreadCount'>
        {@props.unreadCount}
      </cite>


  render: ->

    <Link className={@getClassName()} href={@props.href} onClick={@props.onClick}>
      <cite className='SidebarListItem-icon' />
      <span className='SidebarListItem-title'>{@props.title}</span>
      {@renderUnreadCount()}
    </Link>

<commit_msg>activity: assign active class when a sidebar link is clicked<commit_after>kd         = require 'kd'
React      = require 'kd-react'
immutable  = require 'immutable'
classnames = require 'classnames'
Link       = require 'app/components/common/link'


module.exports = class SidebarListItem extends React.Component

  constructor: (props) ->
    super props

    @state = { clicked: no }


  getClassName: ->
    classnames
      SidebarListItem        : yes
      active                 : @props.active ? @state.clicked


  renderUnreadCount: ->
    return null  unless @props.unreadCount > 0

    return \
      <cite className='SidebarListItem-unreadCount'>
        {@props.unreadCount}
      </cite>


  onClick: (args...) ->

    @setState { clicked: yes }, => @props.onClick? args...


  render: ->

    <Link className={@getClassName()} href={@props.href} onClick={@bound 'onClick'}>
      <cite className='SidebarListItem-icon' />
      <span className='SidebarListItem-title'>{@props.title}</span>
      {@renderUnreadCount()}
    </Link>


{'fraction_non_alphanumeric': 0.12727272727272726, 'fraction_numerical': 0.0010695187165775401, 'mean_word_length': 2.7721774193548385, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 28, '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': '1691468', 'n_tokens_mistral': 567, 'n_tokens_neox': 558, 'n_words': 121}