2015-05-20 07:06:59 +08:00
|
|
|
_ = require 'underscore'
|
2015-03-07 04:03:32 +08:00
|
|
|
React = require 'react'
|
2015-04-25 02:33:10 +08:00
|
|
|
classNames = require 'classnames'
|
2015-05-15 08:08:30 +08:00
|
|
|
{Actions, Utils, FocusedContentStore, WorkspaceStore} = require 'nylas-exports'
|
|
|
|
{RetinaImg, Popover, Menu} = require 'nylas-component-kit'
|
2015-03-07 04:03:32 +08:00
|
|
|
|
2015-05-14 03:01:41 +08:00
|
|
|
ThreadArchiveButton = require './thread-archive-button'
|
2015-03-07 04:03:32 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
class MessageToolbarItems extends React.Component
|
|
|
|
@displayName: "MessageToolbarItems"
|
2015-03-07 04:03:32 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
constructor: (@props) ->
|
|
|
|
@state =
|
|
|
|
threadIsSelected: FocusedContentStore.focusedId('thread')?
|
2015-03-07 04:03:32 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
render: =>
|
2015-04-25 02:33:10 +08:00
|
|
|
classes = classNames
|
2015-03-07 04:03:32 +08:00
|
|
|
"message-toolbar-items": true
|
|
|
|
"hidden": !@state.threadIsSelected
|
|
|
|
|
|
|
|
<div className={classes}>
|
2015-05-14 03:01:41 +08:00
|
|
|
<ThreadArchiveButton />
|
2015-03-07 04:03:32 +08:00
|
|
|
</div>
|
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
componentDidMount: =>
|
2015-03-07 04:03:32 +08:00
|
|
|
@_unsubscribers = []
|
2015-04-09 10:25:00 +08:00
|
|
|
@_unsubscribers.push FocusedContentStore.listen @_onChange
|
2015-03-07 04:03:32 +08:00
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
componentWillUnmount: =>
|
2015-03-07 04:03:32 +08:00
|
|
|
unsubscribe() for unsubscribe in @_unsubscribers
|
|
|
|
|
2015-05-01 02:35:38 +08:00
|
|
|
_onChange: => _.defer =>
|
2015-03-07 04:03:32 +08:00
|
|
|
@setState
|
2015-04-09 10:25:00 +08:00
|
|
|
threadIsSelected: FocusedContentStore.focusedId('thread')?
|
2015-05-01 02:35:38 +08:00
|
|
|
|
|
|
|
module.exports = MessageToolbarItems
|