2015-04-01 07:32:14 +08:00
|
|
|
_ = require 'underscore-plus'
|
2015-03-19 09:21:04 +08:00
|
|
|
React = require 'react'
|
2015-04-09 10:25:00 +08:00
|
|
|
{FocusedContentStore} = require 'inbox-exports'
|
2015-03-19 09:21:04 +08:00
|
|
|
|
|
|
|
module.exports =
|
|
|
|
MessageSubjectItem = React.createClass
|
|
|
|
displayName: 'MessageSubjectItem'
|
|
|
|
|
|
|
|
getInitialState: ->
|
|
|
|
@_getStateFromStores()
|
|
|
|
|
|
|
|
componentDidMount: ->
|
2015-04-09 10:25:00 +08:00
|
|
|
@_unsubscriber = FocusedContentStore.listen @_onChange
|
2015-03-19 09:21:04 +08:00
|
|
|
|
|
|
|
componentWillUnmount: ->
|
|
|
|
@_unsubscriber() if @_unsubscriber
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
<div className="message-toolbar-subject">{@state.thread?.subject}</div>
|
|
|
|
|
2015-04-01 07:32:14 +08:00
|
|
|
_onChange: -> _.defer =>
|
|
|
|
return unless @isMounted()
|
2015-03-19 09:21:04 +08:00
|
|
|
@setState(@_getStateFromStores())
|
|
|
|
|
|
|
|
_getStateFromStores: ->
|
2015-04-09 10:25:00 +08:00
|
|
|
thread: FocusedContentStore.focused('thread')
|
2015-03-19 09:21:04 +08:00
|
|
|
|