Mailspring/internal_packages/message-list/lib/message-toolbar-items.cjsx
Robert McQueen 28692ff5af feat(starring): Star/unstar from the message detail view
Summary: Adding star button to message-toolbar view

Test Plan: Added spec for starring message from the message-toolbar view

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D1683
2015-06-25 10:33:26 -07:00

38 lines
1 KiB
CoffeeScript

_ = require 'underscore'
React = require 'react'
classNames = require 'classnames'
{Actions, Utils, FocusedContentStore, WorkspaceStore} = require 'nylas-exports'
{RetinaImg, Popover, Menu} = require 'nylas-component-kit'
ThreadArchiveButton = require './thread-archive-button'
ThreadStarButton = require './thread-star-button'
class MessageToolbarItems extends React.Component
@displayName: "MessageToolbarItems"
constructor: (@props) ->
@state =
thread: FocusedContentStore.focused('thread')
render: =>
classes = classNames
"message-toolbar-items": true
"hidden": !@state.thread
<div className={classes}>
<ThreadArchiveButton />
<ThreadStarButton ref="starButton" thread={@state.thread} />
</div>
componentDidMount: =>
@_unsubscribers = []
@_unsubscribers.push FocusedContentStore.listen @_onChange
componentWillUnmount: =>
unsubscribe() for unsubscribe in @_unsubscribers
_onChange: =>
@setState
thread: FocusedContentStore.focused('thread')
module.exports = MessageToolbarItems