feat(snooze): Add command for keyboard shortcut

Test Plan: Tested locally.

Reviewers: bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3008
This commit is contained in:
Jackie Luo 2016-06-07 10:28:59 -07:00
parent a924e4ff9c
commit 96b947b8d9
3 changed files with 18 additions and 0 deletions

View file

@ -17,6 +17,7 @@ module.exports = [
['core:remove-from-view', 'Remove from view'],
['core:gmail-remove-from-view', 'Gmail Remove from view'],
['core:star-item', 'Star'],
['core:snooze-item', 'Snooze'],
['core:change-category', 'Change Folder / Labels'],
['core:mark-as-read', 'Mark as read'],
['core:mark-as-unread', 'Mark as unread'],

View file

@ -65,6 +65,7 @@ class ThreadList extends React.Component
'core:archive-item': @_onArchiveItem
'core:delete-item': @_onDeleteItem
'core:star-item': @_onStarItem
'core:snooze-item': @_onSnoozeItem
'core:mark-important': => @_onSetImportant(true)
'core:mark-unimportant': => @_onSetImportant(false)
'core:mark-as-unread': => @_onSetUnread(true)
@ -223,6 +224,21 @@ class ThreadList extends React.Component
task = TaskFactory.taskForInvertingStarred({threads})
Actions.queueTask(task)
_onSnoozeItem: =>
threads = @_threadsForKeyboardAction()
return unless threads
# TODO this should be grabbed from elsewhere
SnoozePopover = require('../../thread-snooze/lib/snooze-popover').default
element = document.querySelector(".snooze-button.btn.btn-toolbar")
return unless element
originRect = element.getBoundingClientRect()
Actions.openPopover(
<SnoozePopover
threads={threads} />,
{originRect, direction: 'down'}
)
_onSetImportant: (important) =>
threads = @_threadsForKeyboardAction()
return unless threads

View file

@ -20,6 +20,7 @@
"window:close": "mod+w",
"core:snooze-item": "z",
"core:print-thread": "mod+p",
"core:focus-item": "enter",
"core:remove-from-view": ["backspace", "del"],