Mailspring/internal_packages/message-list/lib/thread-trash-button.cjsx
Evan Morikawa a20b979208 feat(analytics): add analytics for change mail tasks
Summary:
Adds the following new events:

- Threads Moved to Folder
  - isArchive
  - source
  - folderType
  - folderDisplayName
  - numThreads
  - numMessages
  - description
  - isUndo

- Threads Changed Labels
  - isArchive
  - source
  - labelTypesToAdd
  - labelTypesToRemove
  - labelDisplayNamesToAdd
  - labelDisplayNamesToRemove
  - numThreads
  - numMessages
  - description
  - isUndo

- Threads Starred
  - source
  - numThreads
  - description
  - isUndo

- Threads Unstarred
  - source
  - numThreads
  - description
  - isUndo

- Threads Marked as Read
  - source
  - numThreads
  - description
  - isUndo

- Threads Marked as Unread
  - source
  - numThreads
  - description
  - isUndo

Each new action has a "source" property that's one of the following:
- Category Picker: New Category
- Category Picker: Existing Category
- Toolbar Button: Message List
- Toolbar Button: Thread List
- Send and Archive
- Context Menu: Thread List
- Thread List Icon
- Quick Actions: Thread List
- Swipe
- Keyboard Shortcut
- Dragged Out of List
- Snooze Move
- Important Icon
- Label Remove Icon
- Thread Selected
- Mail Rules
- Dragged Into List

Test Plan: manual

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3760
2017-01-24 12:22:33 -05: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