import { React, PropTypes, Actions, SendActionsStore } from 'mailspring-exports';
import { Menu, RetinaImg, ButtonDropdown, ListensToFluxStore } from 'mailspring-component-kit';
class SendActionButton extends React.Component {
static displayName = 'SendActionButton';
static containerRequired = false;
static propTypes = {
draft: PropTypes.object,
isValidDraft: PropTypes.func,
sendActions: PropTypes.array,
orderedSendActions: PropTypes.object,
};
primarySend() {
this._onPrimaryClick();
}
_onPrimaryClick = () => {
const { orderedSendActions } = this.props;
const { preferred } = orderedSendActions;
this._onSendWithAction(preferred);
};
_onSendWithAction = sendAction => {
const { isValidDraft, draft } = this.props;
if (isValidDraft()) {
Actions.sendDraft(draft.headerMessageId, sendAction.configKey);
}
};
_renderSendActionItem = ({ iconUrl }) => {
let plusHTML = '';
let additionalImg = false;
if (iconUrl) {
plusHTML = + ;
additionalImg = ;
}
return (
Send{plusHTML}
{additionalImg}
);
};
_renderSingleButton() {
const { sendActions } = this.props;
return (
);
}
_renderButtonDropdown() {
const { orderedSendActions } = this.props;
const { preferred, rest } = orderedSendActions;
const menu = (