Mailspring/packages/client-app/internal_packages/message-list/lib/thread-trash-button.cjsx
Ben Gotow e2f27c3287 Revert "[client-app] Measure and report times for trashing and marking as spam"
This reverts commit 19195e9686.

# Conflicts:
#	packages/client-app/src/flux/actions.es6
#	packages/client-app/src/flux/stores/thread-list-actions-store.es6
2017-06-23 16:11:53 -07:00

39 lines
1 KiB
CoffeeScript

_ = require 'underscore'
React = require 'react'
{Actions,
DOMUtils,
TaskFactory,
AccountStore,
FocusedPerspectiveStore} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
class ThreadTrashButton extends React.Component
@displayName: "ThreadTrashButton"
@containerRequired: false
@propTypes:
thread: React.PropTypes.object.isRequired
render: =>
allowed = FocusedPerspectiveStore.current().canMoveThreadsTo([@props.thread], 'trash')
return <span /> unless allowed
<button className="btn btn-toolbar"
style={order: -106}
title="Move to Trash"
onClick={@_onRemove}>
<RetinaImg name="toolbar-trash.png" mode={RetinaImg.Mode.ContentIsMask}/>
</button>
_onRemove: (e) =>
return unless DOMUtils.nodeIsVisible(e.currentTarget)
tasks = TaskFactory.tasksForMovingToTrash
source: "Toolbar Button: Thread List"
threads: [@props.thread]
Actions.queueTasks(tasks)
Actions.popSheet()
e.stopPropagation()
module.exports = ThreadTrashButton