2015-06-26 01:33:26 +08:00
|
|
|
_ = require 'underscore'
|
|
|
|
React = require 'react'
|
2015-08-06 06:53:08 +08:00
|
|
|
{Actions, Utils, ChangeStarredTask} = 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-07-22 05:16:11 +08:00
|
|
|
<button className="btn btn-toolbar btn-star"
|
2015-07-24 03:22:27 +08:00
|
|
|
style={order: -104}
|
2015-06-26 01:33:26 +08:00
|
|
|
data-tooltip="Star"
|
|
|
|
onClick={@_onStarToggle}>
|
|
|
|
<RetinaImg name="toolbar-star.png" mode={RetinaImg.Mode.ContentIsMask} selected={selected} />
|
|
|
|
</button>
|
|
|
|
|
|
|
|
_onStarToggle: (e) =>
|
2015-08-06 06:53:08 +08:00
|
|
|
task = new ChangeStarredTask({
|
|
|
|
thread: @props.thread
|
|
|
|
starred: !@props.thread.starred
|
|
|
|
})
|
2015-06-26 01:33:26 +08:00
|
|
|
Actions.queueTask(task)
|
|
|
|
e.stopPropagation()
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = StarButton
|