Mailspring/internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact.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

41 lines
1 KiB
CoffeeScript

_ = require 'underscore-plus'
React = require "react"
FullContactStore = require "./fullcontact-store"
SidebarFullContactDetails = require "./sidebar-fullcontact-details.cjsx"
module.exports =
SidebarFullContact = React.createClass
getInitialState: ->
fullContactCache: {}
focusedContact: null
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