diff --git a/internal_packages/account-sidebar/lib/sidebar-section.coffee b/internal_packages/account-sidebar/lib/sidebar-section.coffee index e200b6e0f..8988cfb15 100644 --- a/internal_packages/account-sidebar/lib/sidebar-section.coffee +++ b/internal_packages/account-sidebar/lib/sidebar-section.coffee @@ -34,7 +34,7 @@ class SidebarSection .map (cat) => SidebarItem.forCategories([cat]) starredItem = SidebarItem.forStarred([account.id]) - draftsItem = SidebarItem.forDrafts({accountId: account.id}) + draftsItem = SidebarItem.forDrafts([account.id]) # Order correctly: Inbox, Starred, rest... , Drafts items.splice(1, 0, starredItem) diff --git a/internal_packages/thread-list/lib/draft-buttons.cjsx b/internal_packages/thread-list/lib/draft-buttons.cjsx index a464c54a7..b616d6e60 100644 --- a/internal_packages/thread-list/lib/draft-buttons.cjsx +++ b/internal_packages/thread-list/lib/draft-buttons.cjsx @@ -22,5 +22,6 @@ class DraftDeleteButton extends React.Component for item in @props.selection.items() Actions.queueTask(new DestroyDraftTask(draftClientId: item.clientId)) @props.selection.clear() + return module.exports = {DraftDeleteButton} diff --git a/internal_packages/thread-list/lib/draft-list.cjsx b/internal_packages/thread-list/lib/draft-list.cjsx index c600df2f0..81d80b4a4 100644 --- a/internal_packages/thread-list/lib/draft-list.cjsx +++ b/internal_packages/thread-list/lib/draft-list.cjsx @@ -24,16 +24,16 @@ class DraftList extends React.Component {} } itemHeight={39} className="draft-list" /> - _keymapHandlers: -> + _keymapHandlers: => 'core:remove-from-view': @_onRemoveFromView _onDoubleClick: (item) => diff --git a/internal_packages/thread-list/lib/draft-selection-bar.cjsx b/internal_packages/thread-list/lib/draft-selection-bar.cjsx index 1edb1e7f4..c6d477972 100644 --- a/internal_packages/thread-list/lib/draft-selection-bar.cjsx +++ b/internal_packages/thread-list/lib/draft-selection-bar.cjsx @@ -1,14 +1,19 @@ React = require "react/addons" DraftListStore = require './draft-list-store' -{MultiselectActionBar} = require 'nylas-component-kit' +{MultiselectActionBar, FluxContainer} = require 'nylas-component-kit' class DraftSelectionBar extends React.Component @displayName: 'DraftSelectionBar' render: => - + + dataSource: DraftListStore.dataSource() + }> + + module.exports = DraftSelectionBar diff --git a/internal_packages/thread-list/lib/thread-buttons.cjsx b/internal_packages/thread-list/lib/thread-buttons.cjsx index fc115a955..814dcfb8d 100644 --- a/internal_packages/thread-list/lib/thread-buttons.cjsx +++ b/internal_packages/thread-list/lib/thread-buttons.cjsx @@ -32,6 +32,7 @@ class ThreadBulkArchiveButton extends React.Component threads: @props.selection.items(), fromPerspective: FocusedPerspectiveStore.current() Actions.queueTasks(tasks) + return class ThreadBulkTrashButton extends React.Component @displayName: 'ThreadBulkTrashButton' @@ -56,6 +57,7 @@ class ThreadBulkTrashButton extends React.Component threads: @props.selection.items(), fromPerspective: FocusedPerspectiveStore.current() Actions.queueTasks(tasks) + return class ThreadBulkStarButton extends React.Component @@ -79,6 +81,7 @@ class ThreadBulkStarButton extends React.Component _onStar: => task = TaskFactory.taskForInvertingStarred(threads: @props.selection.items()) Actions.queueTask(task) + return class ThreadBulkToggleUnreadButton extends React.Component @@ -103,6 +106,7 @@ class ThreadBulkToggleUnreadButton extends React.Component _onClick: => task = TaskFactory.taskForInvertingUnread(threads: @props.selection.items()) Actions.queueTask(task) + return ThreadNavButtonMixin = diff --git a/internal_packages/thread-list/lib/thread-selection-bar.cjsx b/internal_packages/thread-list/lib/thread-selection-bar.cjsx index 507b5c58c..7e3cb5c25 100644 --- a/internal_packages/thread-list/lib/thread-selection-bar.cjsx +++ b/internal_packages/thread-list/lib/thread-selection-bar.cjsx @@ -1,14 +1,19 @@ React = require "react/addons" ThreadListStore = require './thread-list-store' -{MultiselectActionBar} = require 'nylas-component-kit' +{MultiselectActionBar, FluxContainer} = require 'nylas-component-kit' class ThreadSelectionBar extends React.Component @displayName: 'ThreadSelectionBar' render: => - + + dataSource: ThreadListStore.dataSource() + }> + + module.exports = ThreadSelectionBar diff --git a/src/components/flux-container.cjsx b/src/components/flux-container.cjsx index 150f700ad..669512d7b 100644 --- a/src/components/flux-container.cjsx +++ b/src/components/flux-container.cjsx @@ -10,9 +10,7 @@ class FluxContainer extends React.Component constructor: (@props) -> @_unlisteners = [] - - componentWillMount: -> - @setState(@props.getStateFromStores()) + @state = @props.getStateFromStores() componentDidMount: -> @setupListeners() diff --git a/src/components/multiselect-action-bar.cjsx b/src/components/multiselect-action-bar.cjsx index 00097aba3..715e47060 100644 --- a/src/components/multiselect-action-bar.cjsx +++ b/src/components/multiselect-action-bar.cjsx @@ -50,7 +50,7 @@ class MultiselectActionBar extends React.Component ### @propTypes: collection: React.PropTypes.string.isRequired - dataStore: React.PropTypes.object.isRequired + dataSource: React.PropTypes.object.isRequired constructor: (@props) -> @state = @_getStateFromStores() @@ -68,13 +68,13 @@ class MultiselectActionBar extends React.Component @teardownForProps() teardownForProps: => - return unless @unsubscribers - unsubscribe() for unsubscribe in @unsubscribers + return unless @_unsubscribers + unsubscribe() for unsubscribe in @_unsubscribers setupForProps: (props) => - @unsubscribers = [] - @unsubscribers.push props.dataStore.listen @_onChange - @unsubscribers.push WorkspaceStore.listen @_onChange + @_unsubscribers = [] + @_unsubscribers.push WorkspaceStore.listen @_onChange + @_unsubscribers.push @props.dataSource.listen @_onChange shouldComponentUpdate: (nextProps, nextState) => not Utils.isEqualReact(nextProps, @props) or @@ -108,9 +108,9 @@ class MultiselectActionBar extends React.Component _renderActions: => - return
unless @state.dataSource + return
unless @props.dataSource + exposedProps={selection: @props.dataSource.selection, items: @state.items} /> _label: => if @state.items.length > 1 @@ -120,21 +120,14 @@ class MultiselectActionBar extends React.Component else "" - _getStateFromStores: (props) => - props ?= @props - dataSource = props.dataStore.dataSource() - items = dataSource?.selection.items() ? [] - - return { - dataSource: dataSource - items: items - } + _getStateFromStores: (props = @props) => + items: props.dataSource.selection.items() ? [] _onChange: => @setState(@_getStateFromStores()) _onClearSelection: => - @state.dataSource.selection.clear() + @props.dataSource.selection.clear() module.exports = MultiselectActionBar diff --git a/src/components/multiselect-list.cjsx b/src/components/multiselect-list.cjsx index f93cfedd7..092aa7fb4 100644 --- a/src/components/multiselect-list.cjsx +++ b/src/components/multiselect-list.cjsx @@ -174,8 +174,7 @@ class MultiselectList extends React.Component event.stopPropagation()
- _getStateFromStores: (props) => - props ?= @props + _getStateFromStores: (props = @props) => state = @state ? {} layoutMode = WorkspaceStore.layoutMode()