mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
d3542fef46
Fixes T2155 and T1765
29 lines
857 B
CoffeeScript
29 lines
857 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
|
|
|
|
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
|