Mailspring/internal_packages/message-list/lib/thread-remove-button.cjsx
Evan Morikawa f88b0f3708 feat(archive): shows trash for non-archive accounts
Summary:
Fixes T3570
Fixes T3737

Rename ArchiveThreadHelper to RemoveThreadHelper

Rename of `getRemovalTask`

Remove unarchive from `RemoveThreadHelper`. Pass in mailviewfilter

Rename actions

Rename archive action

renmaing

support trash and archive folders in RemoveThreadHelper

Move everything over to trash

add tests

Hide trash and archive

Test Plan: new tests

Reviewers: dillon, bengotow

Reviewed By: dillon, bengotow

Maniphest Tasks: T3570, T3737

Differential Revision: https://phab.nylas.com/D2089
2015-09-30 19:51:48 -07:00

37 lines
1.1 KiB
CoffeeScript

_ = require 'underscore'
React = require 'react'
{Actions,
DOMUtils,
RemoveThreadHelper,
FocusedMailViewStore} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
class ThreadRemoveButton extends React.Component
@displayName: "ThreadRemoveButton"
@containerRequired: false
render: =>
focusedMailViewFilter = FocusedMailViewStore.mailView()
return false unless focusedMailViewFilter?.canRemoveThreads()
if RemoveThreadHelper.removeType() is RemoveThreadHelper.Type.Archive
tooltip = "Archive"
imgName = "toolbar-archive.png"
else if RemoveThreadHelper.removeType() is RemoveThreadHelper.Type.Trash
tooltip = "Trash"
imgName = "toolbar-trash.png"
<button className="btn btn-toolbar"
style={order: -106}
data-tooltip={tooltip}
onClick={@_onRemove}>
<RetinaImg name={imgName} mode={RetinaImg.Mode.ContentIsMask}/>
</button>
_onRemove: (e) =>
return unless DOMUtils.nodeIsVisible(e.currentTarget)
Actions.removeCurrentlyFocusedThread()
e.stopPropagation()
module.exports = ThreadRemoveButton