import {
React,
PropTypes,
Actions,
DOMUtils,
TaskFactory,
FocusedPerspectiveStore,
} from 'mailspring-exports';
import { RetinaImg } from 'mailspring-component-kit';
export default class ThreadTrashButton extends React.Component {
static displayName = 'ThreadTrashButton';
static containerRequired = false;
static propTypes = {
thread: PropTypes.object.isRequired,
};
_onRemove = e => {
if (!DOMUtils.nodeIsVisible(e.currentTarget)) {
return;
}
const tasks = TaskFactory.tasksForMovingToTrash({
source: 'Toolbar Button: Thread List',
threads: [this.props.thread],
});
Actions.queueTasks(tasks);
Actions.popSheet();
e.stopPropagation();
};
render() {
const allowed = FocusedPerspectiveStore.current().canMoveThreadsTo(
[this.props.thread],
'trash'
);
if (!allowed) {
return ;
}
return (
);
}
}