Mailspring/internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact.cjsx
Evan Morikawa 3d75da673b fix(salesforce): salesforce only displays focused contact
Summary: re-display information on re-entry of thread

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://review.inboxapp.com/D1340
2015-03-24 17:03:30 -04:00

39 lines
1,023 B
CoffeeScript

_ = require 'underscore-plus'
React = require "react"
FullContactStore = require "./fullcontact-store"
SidebarFullContactDetails = require "./sidebar-fullcontact-details"
module.exports =
SidebarFullContact = React.createClass
getInitialState: ->
@_getStateFromStores()
componentDidMount: ->
@unsubscribe = FullContactStore.listen @_onChange
componentWillUnmount: ->
@unsubscribe()
render: ->
<div className="full-contact-sidebar">
<SidebarFullContactDetails contact={@state.focusedContact ? {}}
fullContact={@_fullContact()}/>
</div>
_fullContact: ->
if @state.focusedContact?.email
return @state.fullContactCache[@state.focusedContact.email] ? {}
else
return {}
_onChange: ->
@setState(@_getStateFromStores())
_getStateFromStores: ->
fullContactCache: FullContactStore.fullContactCache()
focusedContact: FullContactStore.focusedContact()
SidebarFullContact.maxWidth = 300
SidebarFullContact.minWidth = 200