2015-06-12 09:38:57 +08:00
|
|
|
React = require 'react'
|
|
|
|
{Actions,
|
2015-10-01 10:51:48 +08:00
|
|
|
RemoveThreadHelper,
|
|
|
|
FocusedMailViewStore} = require 'nylas-exports'
|
2015-06-12 09:38:57 +08:00
|
|
|
|
|
|
|
class ThreadListQuickActions extends React.Component
|
|
|
|
@displayName: 'ThreadListQuickActions'
|
|
|
|
@propTypes:
|
|
|
|
thread: React.PropTypes.object
|
|
|
|
|
|
|
|
render: =>
|
2015-10-01 10:51:48 +08:00
|
|
|
focusedMailViewFilter = FocusedMailViewStore.mailView()
|
|
|
|
return false unless focusedMailViewFilter?.canRemoveThreads()
|
2015-06-12 09:38:57 +08:00
|
|
|
|
2015-10-01 10:51:48 +08:00
|
|
|
classNames = "btn action action-#{RemoveThreadHelper.removeType()}"
|
2015-09-22 05:15:57 +08:00
|
|
|
|
2015-06-12 09:38:57 +08:00
|
|
|
<div className="inner">
|
2015-10-01 10:51:48 +08:00
|
|
|
<div key="remove" className={classNames} onClick={@_onRemove}></div>
|
2015-06-12 09:38:57 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
shouldComponentUpdate: (newProps, newState) ->
|
|
|
|
newProps.thread.id isnt @props?.thread.id
|
|
|
|
|
2015-10-01 10:51:48 +08:00
|
|
|
_onRemove: (event) =>
|
|
|
|
focusedMailViewFilter = FocusedMailViewStore.mailView()
|
|
|
|
t = RemoveThreadHelper.getRemovalTask([@props.thread], focusedMailViewFilter)
|
|
|
|
Actions.queueTask(t)
|
2015-06-12 09:38:57 +08:00
|
|
|
|
|
|
|
# Don't trigger the thread row click
|
|
|
|
event.stopPropagation()
|
|
|
|
|
|
|
|
module.exports = ThreadListQuickActions
|