From 6d557961db7bac178273007cf4a9f70a7f20518d Mon Sep 17 00:00:00 2001 From: Colin King Date: Sun, 3 Jan 2016 20:03:52 -0500 Subject: [PATCH] Moved all quick actions within flexbox from injectable component Fixed linting issues Moved away from ComponentRegistry towards InjectComponentSet children --- .../lib/thread-list-quick-actions.cjsx | 40 ++++++++++++------- .../thread-list/lib/thread-list.cjsx | 19 +++++++-- .../thread-list/stylesheets/thread-list.less | 9 ++--- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx b/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx index aeb011bfc..7d1635488 100644 --- a/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx +++ b/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx @@ -4,32 +4,22 @@ React = require 'react' TaskFactory, FocusedMailViewStore} = require 'nylas-exports' -class ThreadListQuickActions extends React.Component - @displayName: 'ThreadListQuickActions' +class ThreadArchiveQuickAction extends React.Component + @displayName: 'ThreadArchiveQuickAction' @propTypes: thread: React.PropTypes.object render: => mailViewFilter = FocusedMailViewStore.mailView() archive = null - remove = null if mailViewFilter?.canArchiveThreads() archive =
- - if mailViewFilter?.canTrashThreads() - trash =
- -
- {archive} - {trash} -
+ return archive shouldComponentUpdate: (newProps, newState) -> newProps.thread.id isnt @props?.thread.id @@ -43,6 +33,26 @@ class ThreadListQuickActions extends React.Component # Don't trigger the thread row click event.stopPropagation() +class ThreadTrashQuickAction extends React.Component + @displayName: 'ThreadTrashQuickAction' + @propTypes: + thread: React.PropTypes.object + + render: => + mailViewFilter = FocusedMailViewStore.mailView() + trash = null + + if mailViewFilter?.canTrashThreads() + trash =
+ return trash + + shouldComponentUpdate: (newProps, newState) -> + newProps.thread.id isnt @props?.thread.id + _onRemove: (event) => task = TaskFactory.taskForMovingToTrash threads: [@props.thread] @@ -52,4 +62,4 @@ class ThreadListQuickActions extends React.Component # Don't trigger the thread row click event.stopPropagation() -module.exports = ThreadListQuickActions +module.exports = { ThreadArchiveQuickAction, ThreadTrashQuickAction } diff --git a/internal_packages/thread-list/lib/thread-list.cjsx b/internal_packages/thread-list/lib/thread-list.cjsx index cf12992e1..48a223a87 100644 --- a/internal_packages/thread-list/lib/thread-list.cjsx +++ b/internal_packages/thread-list/lib/thread-list.cjsx @@ -19,9 +19,9 @@ classNames = require 'classnames' CategoryStore, FocusedContentStore, FocusedMailViewStore} = require 'nylas-exports' - ThreadListParticipants = require './thread-list-participants' -ThreadListQuickActions = require './thread-list-quick-actions' +{ThreadArchiveQuickAction, + ThreadTrashQuickAction} = require './thread-list-quick-actions' ThreadListStore = require './thread-list-store' ThreadListIcon = require './thread-list-icon' @@ -137,7 +137,20 @@ class ThreadList extends React.Component c5 = new ListTabular.Column name: "HoverActions" resolver: (thread) => - +
+ + + ]} + matching={role: "ThreadListQuickAction"} + className="thread-injected-quick-actions" + exposedProps={thread: thread}/> +
@wideColumns = [c1, c2, c3, c4, c5] diff --git a/internal_packages/thread-list/stylesheets/thread-list.less b/internal_packages/thread-list/stylesheets/thread-list.less index f13a6375e..753f33c78 100644 --- a/internal_packages/thread-list/stylesheets/thread-list.less +++ b/internal_packages/thread-list/stylesheets/thread-list.less @@ -229,9 +229,6 @@ height: 57px; margin: 9px 16px 0 16px; } - .action:last-child { - margin-right:40px; - } .action.action-archive { background: url(@archive-img) center no-repeat, @background-gradient; } @@ -244,9 +241,6 @@ body.platform-win32 { .action { border: 0; margin: 9px 0 0 0; - &:last-child { - margin-right: 30px; - } } .action.action-archive { background: url(@archive-img) center no-repeat; @@ -268,6 +262,9 @@ body.platform-win32 { width:300px; height:100%; left: -300px; + .thread-injected-quick-actions { + margin-right: 10px; + } } }