React = require 'react' classNames = require 'classnames' {Actions, Utils, UnreadCountStore, WorkspaceStore, AccountStore, FocusedMailViewStore, ChangeLabelsTask, ChangeFolderTask, CategoryStore} = require 'nylas-exports' {RetinaImg, DropZone} = require 'nylas-component-kit' class AccountSidebarMailViewItem extends React.Component @displayName: 'AccountSidebarMailViewItem' @propTypes: select: React.PropTypes.bool mailView: React.PropTypes.object.isRequired constructor: (@props) -> @state = unreadCount: UnreadCountStore.count() ? 0 componentWillMount: => @_usub = UnreadCountStore.listen @_onUnreadCountChange componentWillUnmount: => @_usub() _onUnreadCountChange: => @setState unreadCount: UnreadCountStore.count() shouldComponentUpdate: (nextProps, nextState) => !Utils.isEqualReact(@props, nextProps) or !Utils.isEqualReact(@state, nextState) render: => unread = [] if @props.mailView.category?.name is "inbox" and @state.unreadCount > 0 unread =