2017-09-27 02:42:18 +08:00
|
|
|
import { Actions, React, TaskFactory, PropTypes } from 'mailspring-exports';
|
2017-09-27 02:46:00 +08:00
|
|
|
import { RetinaImg } from 'mailspring-component-kit';
|
2017-07-12 15:12:19 +08:00
|
|
|
|
|
|
|
export default class ThreadToggleUnreadButton extends React.Component {
|
2017-09-27 02:33:08 +08:00
|
|
|
static displayName = 'ThreadToggleUnreadButton';
|
2017-07-12 15:12:19 +08:00
|
|
|
static containerRequired = false;
|
|
|
|
static propTypes = {
|
2017-09-27 02:33:08 +08:00
|
|
|
thread: PropTypes.object,
|
2017-07-12 15:12:19 +08:00
|
|
|
};
|
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
_onClick = e => {
|
|
|
|
Actions.queueTask(
|
|
|
|
TaskFactory.taskForInvertingUnread({
|
|
|
|
source: 'Toolbar Button: Thread List',
|
|
|
|
threads: [this.props.thread],
|
|
|
|
})
|
|
|
|
);
|
2017-07-12 15:12:19 +08:00
|
|
|
Actions.popSheet();
|
|
|
|
e.stopPropagation();
|
2017-09-27 02:33:08 +08:00
|
|
|
};
|
2017-07-12 15:12:19 +08:00
|
|
|
|
|
|
|
render() {
|
2017-09-27 02:33:08 +08:00
|
|
|
const fragment = this.props.thread && this.props.thread.unread ? 'read' : 'unread';
|
2017-07-12 15:12:19 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
className="btn btn-toolbar"
|
2017-09-27 02:33:08 +08:00
|
|
|
style={{ order: -105 }}
|
2017-07-12 15:12:19 +08:00
|
|
|
title={`Mark as ${fragment}`}
|
|
|
|
onClick={this._onClick}
|
|
|
|
>
|
2017-09-27 02:33:08 +08:00
|
|
|
<RetinaImg name={`toolbar-markas${fragment}.png`} mode={RetinaImg.Mode.ContentIsMask} />
|
2017-07-12 15:12:19 +08:00
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|