mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-11 02:30:21 +08:00
26 lines
564 B
Text
26 lines
564 B
Text
|
React = require 'react'
|
||
|
{ThreadStore} = require 'inbox-exports'
|
||
|
|
||
|
module.exports =
|
||
|
MessageSubjectItem = React.createClass
|
||
|
displayName: 'MessageSubjectItem'
|
||
|
|
||
|
getInitialState: ->
|
||
|
@_getStateFromStores()
|
||
|
|
||
|
componentDidMount: ->
|
||
|
@_unsubscriber = ThreadStore.listen @_onChange
|
||
|
|
||
|
componentWillUnmount: ->
|
||
|
@_unsubscriber() if @_unsubscriber
|
||
|
|
||
|
render: ->
|
||
|
<div className="message-toolbar-subject">{@state.thread?.subject}</div>
|
||
|
|
||
|
_onChange: ->
|
||
|
@setState(@_getStateFromStores())
|
||
|
|
||
|
_getStateFromStores: ->
|
||
|
thread: ThreadStore.selectedThread()
|
||
|
|