2015-06-26 01:33:26 +08:00
|
|
|
_ = require 'underscore'
|
|
|
|
React = require 'react'
|
2017-06-24 09:01:14 +08:00
|
|
|
{Actions, TaskFactory, Utils} = require 'nylas-exports'
|
2015-06-26 01:33:26 +08:00
|
|
|
{RetinaImg} = require 'nylas-component-kit'
|
|
|
|
|
|
|
|
class StarButton extends React.Component
|
|
|
|
@displayName: "StarButton"
|
2015-07-24 02:47:46 +08:00
|
|
|
@containerRequired: false
|
2015-06-26 01:33:26 +08:00
|
|
|
@propTypes:
|
2015-06-27 07:02:08 +08:00
|
|
|
thread: React.PropTypes.object
|
2015-06-26 01:33:26 +08:00
|
|
|
|
|
|
|
render: =>
|
2015-07-16 23:54:20 +08:00
|
|
|
selected = @props.thread? and @props.thread.starred
|
2015-09-16 07:49:16 +08:00
|
|
|
<button className="btn btn-toolbar"
|
2015-07-24 03:22:27 +08:00
|
|
|
style={order: -104}
|
2015-10-22 02:03:27 +08:00
|
|
|
title={if selected then "Remove star" else "Add star"}
|
2015-06-26 01:33:26 +08:00
|
|
|
onClick={@_onStarToggle}>
|
|
|
|
<RetinaImg name="toolbar-star.png" mode={RetinaImg.Mode.ContentIsMask} selected={selected} />
|
|
|
|
</button>
|
|
|
|
|
|
|
|
_onStarToggle: (e) =>
|
2017-06-24 09:01:14 +08:00
|
|
|
Actions.queueTask(TaskFactory.taskForInvertingStarred({
|
2017-02-22 03:06:38 +08:00
|
|
|
source: "Toolbar Button: Message List",
|
|
|
|
threads: [@props.thread]
|
2017-06-24 09:01:14 +08:00
|
|
|
}))
|
2015-06-26 01:33:26 +08:00
|
|
|
e.stopPropagation()
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = StarButton
|