mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
e3dfbe59be
Summary: Fix react upgrade errors Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://review.inboxapp.com/D1456
42 lines
1.1 KiB
CoffeeScript
42 lines
1.1 KiB
CoffeeScript
_ = require 'underscore-plus'
|
|
React = require "react"
|
|
FullContactStore = require "./fullcontact-store"
|
|
|
|
SidebarFullContactDetails = require "./sidebar-fullcontact-details"
|
|
|
|
class SidebarFullContact extends React.Component
|
|
@displayName: "SidebarFullContact"
|
|
|
|
constructor: (@props) ->
|
|
@state = @_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
|
|
|
|
|
|
module.exports = SidebarFullContact
|