Mailspring/internal_packages/message-list/lib/sidebar-thread-participants.cjsx
Evan Morikawa 564ecca8e0 feat(sidebar): add more Salesforce states
Summary:
add more Salesforce states

more salesforce sidebar

extract focused contacts into its own store

fullcontact store fixes

extract thread participants to own module

typo

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://review.inboxapp.com/D1326
2015-03-20 16:31:35 -07:00

49 lines
1.2 KiB
CoffeeScript

_ = require 'underscore-plus'
React = require "react"
{Actions, FocusedContactsStore} = require("inbox-exports")
module.exports =
SidebarThreadParticipants = React.createClass
displayName: 'SidebarThreadParticipants'
getInitialState: ->
sortedContacts: []
focusedContact: null
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.id}>
{contact.name}
</div>
)
return contacts
_onSelectContact: (contact) ->
Actions.focusContact(contact)
_onChange: ->
@setState(@_getStateFromStores())
_getStateFromStores: ->
sortedContacts: FocusedContactsStore.sortedContacts()
focusedContact: FocusedContactsStore.focusedContact()