mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-10 18:23:21 +08:00
e3dfbe59be
Summary: Fix react upgrade errors Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://review.inboxapp.com/D1456
97 lines
2.7 KiB
CoffeeScript
97 lines
2.7 KiB
CoffeeScript
_ = require 'underscore-plus'
|
|
React = require 'react'
|
|
classNames = require 'classnames'
|
|
{Actions, Utils, FocusedContentStore, WorkspaceStore} = require 'inbox-exports'
|
|
{RetinaImg} = require 'ui-components'
|
|
|
|
# Note: These always have a thread, but only sometimes get a
|
|
# message, depending on where in the UI they are being displayed.
|
|
|
|
class ReplyButton extends React.Component
|
|
@displayName: "ReplyButton"
|
|
|
|
render: =>
|
|
<button className="btn btn-toolbar"
|
|
data-tooltip="Reply"
|
|
onClick={@_onReply}>
|
|
<RetinaImg name="toolbar-reply.png" />
|
|
</button>
|
|
|
|
_onReply: (e) =>
|
|
return unless Utils.nodeIsVisible(e.currentTarget)
|
|
Actions.composeReply(threadId: FocusedContentStore.focusedId('thread'))
|
|
e.stopPropagation()
|
|
|
|
class ReplyAllButton extends React.Component
|
|
@displayName: "ReplyAllButton"
|
|
|
|
render: =>
|
|
<button className="btn btn-toolbar"
|
|
data-tooltip="Reply All"
|
|
onClick={@_onReplyAll}>
|
|
<RetinaImg name="toolbar-reply-all.png" />
|
|
</button>
|
|
|
|
_onReplyAll: (e) =>
|
|
return unless Utils.nodeIsVisible(e.currentTarget)
|
|
Actions.composeReplyAll(threadId: FocusedContentStore.focusedId('thread'))
|
|
e.stopPropagation()
|
|
|
|
class ForwardButton extends React.Component
|
|
@displayName: "ForwardButton"
|
|
|
|
render: =>
|
|
<button className="btn btn-toolbar"
|
|
data-tooltip="Forward"
|
|
onClick={@_onForward}>
|
|
<RetinaImg name="toolbar-forward.png" />
|
|
</button>
|
|
|
|
_onForward: (e) =>
|
|
return unless Utils.nodeIsVisible(e.currentTarget)
|
|
Actions.composeForward(threadId: FocusedContentStore.focusedId('thread'))
|
|
e.stopPropagation()
|
|
|
|
class ArchiveButton extends React.Component
|
|
@displayName: "ArchiveButton"
|
|
|
|
render: =>
|
|
<button className="btn btn-toolbar btn-archive"
|
|
data-tooltip="Archive"
|
|
onClick={@_onArchive}>
|
|
<RetinaImg name="toolbar-archive.png" />
|
|
</button>
|
|
|
|
_onArchive: (e) =>
|
|
return unless Utils.nodeIsVisible(e.currentTarget)
|
|
Actions.archive()
|
|
e.stopPropagation()
|
|
|
|
class MessageToolbarItems extends React.Component
|
|
@displayName: "MessageToolbarItems"
|
|
|
|
constructor: (@props) ->
|
|
@state =
|
|
threadIsSelected: FocusedContentStore.focusedId('thread')?
|
|
|
|
render: =>
|
|
classes = classNames
|
|
"message-toolbar-items": true
|
|
"hidden": !@state.threadIsSelected
|
|
|
|
<div className={classes}>
|
|
<ArchiveButton ref="archiveButton" />
|
|
</div>
|
|
|
|
componentDidMount: =>
|
|
@_unsubscribers = []
|
|
@_unsubscribers.push FocusedContentStore.listen @_onChange
|
|
|
|
componentWillUnmount: =>
|
|
unsubscribe() for unsubscribe in @_unsubscribers
|
|
|
|
_onChange: => _.defer =>
|
|
@setState
|
|
threadIsSelected: FocusedContentStore.focusedId('thread')?
|
|
|
|
module.exports = MessageToolbarItems
|