mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
a8fbcb0c93
Summary: This commit makes so it we report perf metrics for archive actions. To achieve this, I added a new `ThreadListActionsStore` which serves as a proxy for thread actions, which allow us to time them. The new store is in charge of listening to thread list actions, creating and queueing the appropriate tasks for any given action, and timing and reporting action times to our MetricsReporter. This commit only times archiving actions, and subsequent diffs will time other relevant thread list actions. Test Plan: manual Reviewers: halla, spang, evan Reviewed By: spang, evan Differential Revision: https://phab.nylas.com/D3983
36 lines
1,007 B
CoffeeScript
36 lines
1,007 B
CoffeeScript
{RetinaImg} = require 'nylas-component-kit'
|
|
{Actions,
|
|
React,
|
|
TaskFactory,
|
|
DOMUtils,
|
|
AccountStore,
|
|
FocusedPerspectiveStore} = require 'nylas-exports'
|
|
|
|
class ThreadArchiveButton extends React.Component
|
|
@displayName: "ThreadArchiveButton"
|
|
@containerRequired: false
|
|
|
|
@propTypes:
|
|
thread: React.PropTypes.object.isRequired
|
|
|
|
render: =>
|
|
canArchiveThreads = FocusedPerspectiveStore.current().canArchiveThreads([@props.thread])
|
|
return <span /> unless canArchiveThreads
|
|
|
|
<button className="btn btn-toolbar btn-archive"
|
|
style={order: -107}
|
|
title="Archive"
|
|
onClick={@_onArchive}>
|
|
<RetinaImg name="toolbar-archive.png" mode={RetinaImg.Mode.ContentIsMask}/>
|
|
</button>
|
|
|
|
_onArchive: (e) =>
|
|
return unless DOMUtils.nodeIsVisible(e.currentTarget)
|
|
Actions.archiveThreads({
|
|
threads: [@props.thread],
|
|
source: 'Toolbar Button: Message List',
|
|
})
|
|
Actions.popSheet()
|
|
e.stopPropagation()
|
|
|
|
module.exports = ThreadArchiveButton
|