💄(plugins): Updated assets and a bit of error handling

This commit is contained in:
Ben Gotow 2016-02-23 17:51:10 -08:00
parent 6392073a64
commit 5e78a9b2c6
13 changed files with 33 additions and 24 deletions

Binary file not shown.

View file

@ -64,7 +64,7 @@ class TemplatePicker extends React.Component {
render() { render() {
const button = ( const button = (
<button className="btn btn-toolbar narrow" title="Insert email template"> <button className="btn btn-toolbar narrow" title="Insert email template...">
<RetinaImg url="nylas://composer-templates/assets/icon-composer-templates@2x.png" mode={RetinaImg.Mode.ContentIsMask}/> <RetinaImg url="nylas://composer-templates/assets/icon-composer-templates@2x.png" mode={RetinaImg.Mode.ContentIsMask}/>
&nbsp; &nbsp;
<RetinaImg name="icon-composer-dropdown.png" mode={RetinaImg.Mode.ContentIsMask}/> <RetinaImg name="icon-composer-dropdown.png" mode={RetinaImg.Mode.ContentIsMask}/>

View file

@ -70,7 +70,7 @@ class TranslateButton extends React.Component
# `RetinaImg` will automatically chose the best image format for our display. # `RetinaImg` will automatically chose the best image format for our display.
# #
_renderButton: => _renderButton: =>
<button className="btn btn-toolbar" title="Translate"> <button className="btn btn-toolbar" title="Translate email body...">
<RetinaImg mode={RetinaImg.Mode.ContentIsMask} url="nylas://composer-translate/assets/icon-composer-translate@2x.png" /> <RetinaImg mode={RetinaImg.Mode.ContentIsMask} url="nylas://composer-translate/assets/icon-composer-translate@2x.png" />
&nbsp; &nbsp;
<RetinaImg name="icon-composer-dropdown.png" mode={RetinaImg.Mode.ContentIsMask}/> <RetinaImg name="icon-composer-dropdown.png" mode={RetinaImg.Mode.ContentIsMask}/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -17,30 +17,35 @@ export default class LinkTrackingButton extends React.Component {
componentDidMount() { componentDidMount() {
const query = DatabaseStore.findBy(Message, {clientId: this.props.draftClientId}); const query = DatabaseStore.findBy(Message, {clientId: this.props.draftClientId});
this._subscription = Rx.Observable.fromQuery(query).subscribe(this.setStateFromDraft) this._subscription = Rx.Observable.fromQuery(query).subscribe(this.setStateFromDraft);
} }
componentWillUnmount() { componentWillUnmount() {
this._subscription.dispose(); this._subscription.dispose();
} }
setStateFromDraft =(draft)=> { setStateFromDraft = (draft)=> {
if (!draft) return; if (!draft) return;
const metadata = draft.metadataForPluginId(PLUGIN_ID); const metadata = draft.metadataForPluginId(PLUGIN_ID);
this.setState({enabled: metadata ? metadata.tracked : false}); this.setState({enabled: metadata ? metadata.tracked : false});
}; };
_onClick=()=> { _onClick = ()=> {
const currentlyEnabled = this.state.enabled; const currentlyEnabled = this.state.enabled;
// write metadata into the draft to indicate tracked state // write metadata into the draft to indicate tracked state
DraftStore.sessionForClientId(this.props.draftClientId) DraftStore.sessionForClientId(this.props.draftClientId).then((session) => {
.then(session => session.draft()) const draft = session.draft();
.then(draft => {
return NylasAPI.authPlugin(PLUGIN_ID, plugin.title, draft.accountId).then(() => { NylasAPI.authPlugin(PLUGIN_ID, plugin.title, draft.accountId)
Actions.setMetadata(draft, PLUGIN_ID, currentlyEnabled ? null : {tracked: true}); .then(() => {
}); Actions.setMetadata(draft, PLUGIN_ID, currentlyEnabled ? null : {tracked: true});
})
.catch((error)=> {
NylasEnv.reportError(error);
NylasEnv.showErrorDialog(`Sorry, we were unable to save your link tracking settings. ${error.message}`);
}); });
});
}; };
render() { render() {
@ -51,10 +56,9 @@ export default class LinkTrackingButton extends React.Component {
className={`btn btn-toolbar ${this.state.enabled ? "btn-enabled" : ""}`} className={`btn btn-toolbar ${this.state.enabled ? "btn-enabled" : ""}`}
onClick={this._onClick}> onClick={this._onClick}>
<RetinaImg <RetinaImg
url="nylas://link-tracking/assets/linktracking-icon@2x.png" name="icon-composer-linktracking.png"
mode={RetinaImg.Mode.ContentIsMask} /> mode={RetinaImg.Mode.ContentIsMask} />
</button> </button>
) )
} }
} }

View file

@ -35,13 +35,18 @@ export default class OpenTrackingButton extends React.Component {
const currentlyEnabled = this.state.enabled; const currentlyEnabled = this.state.enabled;
// write metadata into the draft to indicate tracked state // write metadata into the draft to indicate tracked state
DraftStore.sessionForClientId(this.props.draftClientId) DraftStore.sessionForClientId(this.props.draftClientId).then((session)=> {
.then(session => session.draft()) const draft = session.draft();
.then(draft => {
return NylasAPI.authPlugin(PLUGIN_ID, plugin.title, draft.accountId).then(() => { NylasAPI.authPlugin(PLUGIN_ID, plugin.title, draft.accountId)
Actions.setMetadata(draft, PLUGIN_ID, currentlyEnabled ? null : {tracked: true}); .then(() => {
}); Actions.setMetadata(draft, PLUGIN_ID, currentlyEnabled ? null : {tracked: true});
})
.catch((error)=> {
NylasEnv.reportError(error);
NylasEnv.showErrorDialog(`Sorry, we were unable to save your read receipt settings. ${error.message}`);
}); });
});
}; };
render() { render() {

View file

@ -5,7 +5,7 @@ class CalendarButton extends React.Component
@displayName: 'CalendarButton' @displayName: 'CalendarButton'
render: => render: =>
<button className="btn btn-toolbar" onClick={@_onClick} title="Quick schedule"> <button className="btn btn-toolbar" onClick={@_onClick} title="Insert calendar availability...">
<RetinaImg url="nylas://quick-schedule/assets/icon-composer-quickschedule@2x.png" mode={RetinaImg.Mode.ContentIsMask} /> <RetinaImg url="nylas://quick-schedule/assets/icon-composer-quickschedule@2x.png" mode={RetinaImg.Mode.ContentIsMask} />
</button> </button>

View file

@ -102,7 +102,7 @@ class SendLaterPopover extends Component {
if (scheduledDate === 'saving') { if (scheduledDate === 'saving') {
return ( return (
<button className={className}> <button className={className} title="Send later...">
<RetinaImg <RetinaImg
name="inline-loading-spinner.gif" name="inline-loading-spinner.gif"
mode={RetinaImg.Mode.ContentDark} mode={RetinaImg.Mode.ContentDark}

View file

@ -26,9 +26,9 @@ class SnoozeStore {
Actions.setMetadata(updatedThreads, this.pluginId, {snoozeDate}) Actions.setMetadata(updatedThreads, this.pluginId, {snoozeDate})
}) })
.catch((error)=> { .catch((error)=> {
console.error(error) NylasEnv.reportError(error);
NylasEnv.showErrorDialog(error.message) NylasEnv.showErrorDialog(`Sorry, we were unable to save your snooze settings. ${error.message}`);
}) });
}; };
deactivate() { deactivate() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB