2015-04-01 07:32:14 +08:00
|
|
|
_ = require 'underscore-plus'
|
2015-03-19 09:21:04 +08:00
|
|
|
React = require 'react'
|
2015-05-15 08:08:30 +08:00
|
|
|
{FocusedContentStore} = require 'nylas-exports'
|
2015-03-19 09:21:04 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
class MessageSubjectItem extends React.Component
|
|
|
|
@displayName: 'MessageSubjectItem'
|
2015-03-19 09:21:04 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
constructor: (@props) ->
|
|
|
|
@state = @_getStateFromStores()
|
2015-03-19 09:21:04 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
componentDidMount: =>
|
2015-04-09 10:25:00 +08:00
|
|
|
@_unsubscriber = FocusedContentStore.listen @_onChange
|
2015-03-19 09:21:04 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
componentWillUnmount: =>
|
2015-03-19 09:21:04 +08:00
|
|
|
@_unsubscriber() if @_unsubscriber
|
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
render: =>
|
2015-03-19 09:21:04 +08:00
|
|
|
<div className="message-toolbar-subject">{@state.thread?.subject}</div>
|
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
_onChange: => _.defer =>
|
2015-03-19 09:21:04 +08:00
|
|
|
@setState(@_getStateFromStores())
|
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
_getStateFromStores: =>
|
2015-04-09 10:25:00 +08:00
|
|
|
thread: FocusedContentStore.focused('thread')
|
2015-03-19 09:21:04 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
module.exports = MessageSubjectItem
|