mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
687597134d
Summary: - New behavior is that the in split mode, you will perform actions on the selection via the MessageListToolbar (the toolbar positioned above the message list) - Refactored and moved around a bunch of code to achieve this: - Mostly renaming stuff and moving stuff around and removing some duplication - Update naming of toolbar role to a single role, and update relevant code - Converted and refactored a bunch of code into ES6, specifically to reuse the code for the ThreadActionsToolbar at the 2 locations - Deprecated MultiselectActionBar in favor of MultiselectToolbar - Deprecated old roles - Punted the animation for the stackable cards in the selection display for now. - #370 Test Plan: - Manual and unit tests Reviewers: evan, drew, bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D2756
49 lines
1.4 KiB
CoffeeScript
49 lines
1.4 KiB
CoffeeScript
_ = require 'underscore'
|
|
React = require 'react'
|
|
{Actions} = require 'nylas-exports'
|
|
{FluxContainer,
|
|
FocusContainer,
|
|
EmptyListState,
|
|
MultiselectList} = require 'nylas-component-kit'
|
|
DraftListStore = require './draft-list-store'
|
|
DraftListColumns = require './draft-list-columns'
|
|
|
|
class DraftList extends React.Component
|
|
@displayName: 'DraftList'
|
|
@containerRequired: false
|
|
|
|
render: =>
|
|
<FluxContainer
|
|
stores=[DraftListStore]
|
|
getStateFromStores={ -> dataSource: DraftListStore.dataSource() }>
|
|
<FocusContainer collection="draft">
|
|
<MultiselectList
|
|
columns={DraftListColumns.Wide}
|
|
onDoubleClick={@_onDoubleClick}
|
|
emptyComponent={EmptyListState}
|
|
keymapHandlers={@_keymapHandlers()}
|
|
itemPropsProvider={@_itemPropsProvider}
|
|
itemHeight={39}
|
|
className="draft-list" />
|
|
</FocusContainer>
|
|
</FluxContainer>
|
|
|
|
_itemPropsProvider: (draft) ->
|
|
props = {}
|
|
props.className = 'sending' if draft.uploadTaskId
|
|
props
|
|
|
|
_keymapHandlers: =>
|
|
'application:remove-from-view': @_onRemoveFromView
|
|
|
|
_onDoubleClick: (draft) =>
|
|
unless draft.uploadTaskId
|
|
Actions.composePopoutDraft(draft.clientId)
|
|
|
|
# Additional Commands
|
|
|
|
_onRemoveFromView: =>
|
|
drafts = DraftListStore.dataSource().selection.items()
|
|
Actions.destroyDraft(draft.clientId) for draft in drafts
|
|
|
|
module.exports = DraftList
|