2015-12-16 03:03:35 +08:00
|
|
|
{Actions, React, FocusedContentStore, ChangeUnreadTask} = require 'nylas-exports'
|
|
|
|
{RetinaImg} = require 'nylas-component-kit'
|
2015-09-16 07:49:16 +08:00
|
|
|
|
|
|
|
class ThreadToggleUnreadButton extends React.Component
|
|
|
|
@displayName: "ThreadToggleUnreadButton"
|
|
|
|
@containerRequired: false
|
|
|
|
|
|
|
|
render: =>
|
|
|
|
fragment = if @props.thread?.unread then "read" else "unread"
|
2015-12-15 02:32:45 +08:00
|
|
|
<button className="btn btn-toolbar"
|
|
|
|
style={order: -105}
|
|
|
|
title="Mark as #{fragment}"
|
|
|
|
onClick={@_onClick}>
|
|
|
|
<RetinaImg name="toolbar-markas#{fragment}.png"
|
|
|
|
mode={RetinaImg.Mode.ContentIsMask} />
|
|
|
|
</button>
|
2015-09-16 07:49:16 +08:00
|
|
|
|
|
|
|
_onClick: (e) =>
|
|
|
|
task = new ChangeUnreadTask
|
|
|
|
thread: @props.thread
|
2015-12-15 02:32:45 +08:00
|
|
|
unread: !@props.thread.unread
|
2015-10-22 01:38:00 +08:00
|
|
|
Actions.queueTask(task)
|
2015-09-16 07:49:16 +08:00
|
|
|
Actions.popSheet()
|
2015-10-22 01:38:00 +08:00
|
|
|
e.stopPropagation()
|
2015-09-16 07:49:16 +08:00
|
|
|
|
|
|
|
module.exports = ThreadToggleUnreadButton
|