Mailspring/internal_packages/message-list/lib/thread-star-button.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

29 lines
868 B
CoffeeScript

_ = require 'underscore'
React = require 'react'
{Actions, Utils, AddRemoveTagsTask} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
class StarButton extends React.Component
@displayName: "StarButton"
@propTypes:
thread: React.PropTypes.object.isRequired
render: =>
selected = @props.thread? and @props.thread.isStarred()
<button className="btn btn-toolbar"
data-tooltip="Star"
onClick={@_onStarToggle}>
<RetinaImg name="toolbar-star.png" mode={RetinaImg.Mode.ContentIsMask} selected={selected} />
</button>
_onStarToggle: (e) =>
if @props.thread.isStarred()
task = new AddRemoveTagsTask(@props.thread, [], ['starred'])
else
task = new AddRemoveTagsTask(@props.thread, ['starred'], [])
Actions.queueTask(task)
e.stopPropagation()
module.exports = StarButton