2016-02-25 06:45:47 +08:00
|
|
|
// import {DraftStore, React, Actions, NylasAPI, DatabaseStore, Message, Rx} from 'nylas-exports'
|
|
|
|
import {React} from 'nylas-exports'
|
|
|
|
import {MetadataComposerToggleButton} from 'nylas-component-kit'
|
2016-02-24 14:55:47 +08:00
|
|
|
import {PLUGIN_ID, PLUGIN_NAME} from './open-tracking-constants'
|
|
|
|
|
2016-02-20 04:30:24 +08:00
|
|
|
export default class OpenTrackingButton extends React.Component {
|
|
|
|
static displayName = 'OpenTrackingButton';
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
draftClientId: React.PropTypes.string.isRequired,
|
|
|
|
};
|
|
|
|
|
2016-02-25 06:45:47 +08:00
|
|
|
_title(enabled) {
|
|
|
|
const dir = enabled ? "Disable" : "Enable";
|
|
|
|
return `${dir} read receipts`
|
2016-02-20 04:30:24 +08:00
|
|
|
}
|
|
|
|
|
2016-02-25 06:45:47 +08:00
|
|
|
_errorMessage(error) {
|
|
|
|
return `Sorry, we were unable to save your read receipt settings. ${error.message}`
|
2016-02-20 04:30:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2016-02-25 06:45:47 +08:00
|
|
|
return (
|
|
|
|
<MetadataComposerToggleButton
|
|
|
|
title={this._title}
|
|
|
|
iconUrl="nylas://open-tracking/assets/icon-composer-eye@2x.png"
|
|
|
|
pluginId={PLUGIN_ID}
|
|
|
|
pluginName={PLUGIN_NAME}
|
|
|
|
metadataKey="tracked"
|
|
|
|
stickyToggle
|
|
|
|
errorMessage={this._errorMessage}
|
|
|
|
draftClientId={this.props.draftClientId} />
|
|
|
|
)
|
2016-02-20 04:30:24 +08:00
|
|
|
}
|
|
|
|
}
|