Mailspring/packages/client-app/internal_packages/message-list/lib/thread-trash-button.cjsx
Juan Tejada 19195e9686 [client-app] Measure and report times for trashing and marking as spam
Summary:
See title

Depends on D3989

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: spang, halla

Differential Revision: https://phab.nylas.com/D3990
2017-02-21 12:26:58 -08:00

39 lines
1,018 B
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)
Actions.trashThreads({
source: "Toolbar Button: Thread List",
threads: [@props.thread],
})
Actions.popSheet()
e.stopPropagation()
module.exports = ThreadTrashButton