_ = require 'underscore' React = require "react" {Actions, FocusedContactsStore} = require("nylas-exports") {TimeoutTransitionGroup, InjectedComponentSet, Flexbox} = require("nylas-component-kit") class FocusedContactStorePropsContainer extends React.Component constructor: (@props) -> @state = @_getStateFromStores() componentDidMount: => @unsubscribe = FocusedContactsStore.listen(@_onChange) componentWillUnmount: => @unsubscribe() render: -> classname = "sidebar-section" if @state.focusedContact classname += " visible" inner = React.cloneElement(@props.children, @state)
{inner}
_onChange: => @setState(@_getStateFromStores()) _getStateFromStores: => sortedContacts: FocusedContactsStore.sortedContacts() focusedContact: FocusedContactsStore.focusedContact() class SidebarSpacer extends React.Component @displayName: 'SidebarSpacer' @containerStyles: order: 50 flex: 1 constructor: (@props) -> render: ->
class SidebarContactList extends React.Component @displayName: 'SidebarContactList' @containerStyles: order: 100 flexShrink: 0 constructor: (@props) -> render: -> class SidebarContactListInner extends React.Component constructor: (@props) -> render: ->

Thread Participants

{@_renderSortedContacts()}
_renderSortedContacts: => @props.sortedContacts.map (contact) => if contact.email is @props.focusedContact.email selected = "selected" else selected = ""
@_onSelectContact(contact)} key={contact.email + contact.name}> {contact.name}
_onSelectContact: (contact) => Actions.focusContact(contact) class SidebarContactCard extends React.Component @displayName: 'SidebarContactCard' @containerStyles: order: 0 flexShrink: 0 minWidth:200 maxWidth:300 constructor: (@props) -> render: -> class SidebarContactCardInner extends React.Component constructor: (@props) -> render: -> module.exports = {SidebarContactCard, SidebarSpacer, SidebarContactList}