Mailspring/internal_packages/message-list/lib/sidebar-thread-participants.cjsx
Evan Morikawa 4619871e8d refactor(utils): switch to regular underscore
Summary:
Fixes: T1334

remove final InboxApp references

move out all underscore-plus methods

Mass find and replace of underscore-plus

sed -i '' -- 's/underscore-plus/underscore/g' **/*.coffee
sed -i '' -- 's/underscore-plus/underscore/g' **/*.cjsx

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D1534
2015-05-19 16:06:59 -07:00

56 lines
1.3 KiB
CoffeeScript

_ = require 'underscore'
React = require "react"
{Actions, FocusedContactsStore} = require("nylas-exports")
class SidebarThreadParticipants extends React.Component
@displayName: 'SidebarThreadParticipants'
@containerStyles:
order: 3
flexShrink: 0
constructor: (@props) ->
@state =
@_getStateFromStores()
componentDidMount: =>
@unsubscribe = FocusedContactsStore.listen @_onChange
componentWillUnmount: =>
@unsubscribe()
render: =>
<div className="sidebar-thread-participants">
<h2 className="sidebar-h2">Thread Participants</h2>
{@_renderSortedContacts()}
</div>
_renderSortedContacts: =>
contacts = []
@state.sortedContacts.forEach (contact) =>
if contact is @state.focusedContact
selected = "selected"
else selected = ""
contacts.push(
<div className="other-contact #{selected}"
onClick={=> @_onSelectContact(contact)}
key={contact.email+contact.name}>
{contact.name}
</div>
)
return contacts
_onSelectContact: (contact) =>
Actions.focusContact(contact)
_onChange: =>
@setState(@_getStateFromStores())
_getStateFromStores: =>
sortedContacts: FocusedContactsStore.sortedContacts()
focusedContact: FocusedContactsStore.focusedContact()
module.exports = SidebarThreadParticipants