💄(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() {
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}/>
&nbsp;
<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.
#
_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" />
&nbsp;
<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() {
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() {
this._subscription.dispose();
}
setStateFromDraft =(draft)=> {
setStateFromDraft = (draft)=> {
if (!draft) return;
const metadata = draft.metadataForPluginId(PLUGIN_ID);
this.setState({enabled: metadata ? metadata.tracked : false});
};
_onClick=()=> {
_onClick = ()=> {
const currentlyEnabled = this.state.enabled;
// write metadata into the draft to indicate tracked state
DraftStore.sessionForClientId(this.props.draftClientId)
.then(session => session.draft())
.then(draft => {
return NylasAPI.authPlugin(PLUGIN_ID, plugin.title, draft.accountId).then(() => {
Actions.setMetadata(draft, PLUGIN_ID, currentlyEnabled ? null : {tracked: true});
});
DraftStore.sessionForClientId(this.props.draftClientId).then((session) => {
const draft = session.draft();
NylasAPI.authPlugin(PLUGIN_ID, plugin.title, draft.accountId)
.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() {
@ -51,10 +56,9 @@ export default class LinkTrackingButton extends React.Component {
className={`btn btn-toolbar ${this.state.enabled ? "btn-enabled" : ""}`}
onClick={this._onClick}>
<RetinaImg
url="nylas://link-tracking/assets/linktracking-icon@2x.png"
name="icon-composer-linktracking.png"
mode={RetinaImg.Mode.ContentIsMask} />
</button>
)
}
}

View file

@ -35,13 +35,18 @@ export default class OpenTrackingButton extends React.Component {
const currentlyEnabled = this.state.enabled;
// write metadata into the draft to indicate tracked state
DraftStore.sessionForClientId(this.props.draftClientId)
.then(session => session.draft())
.then(draft => {
return NylasAPI.authPlugin(PLUGIN_ID, plugin.title, draft.accountId).then(() => {
Actions.setMetadata(draft, PLUGIN_ID, currentlyEnabled ? null : {tracked: true});
});
DraftStore.sessionForClientId(this.props.draftClientId).then((session)=> {
const draft = session.draft();
NylasAPI.authPlugin(PLUGIN_ID, plugin.title, draft.accountId)
.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() {

View file

@ -5,7 +5,7 @@ class CalendarButton extends React.Component
@displayName: 'CalendarButton'
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} />
</button>

View file

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

View file

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