Mailspring/app/internal_packages/notifications/lib/items/unstable-channel-notif.jsx

55 lines
1.3 KiB
React
Raw Normal View History

import { React, UpdateChannelStore } from 'mailspring-exports';
2017-09-27 02:46:00 +08:00
import { Notification } from 'mailspring-component-kit';
export default class UnstableChannelNotification extends React.Component {
static displayName = 'UnstableChannelNotification';
constructor() {
super();
this.state = {
isUnstableChannel: UpdateChannelStore.currentIsUnstable(),
2017-09-27 02:33:08 +08:00
};
}
componentDidMount() {
this._unsub = UpdateChannelStore.listen(() => {
this.setState({
isUnstableChannel: UpdateChannelStore.currentIsUnstable(),
});
});
}
componentWillUnmount() {
if (this._unsub) {
this._unsub();
}
}
_onReportIssue = () => {
2017-09-27 02:36:58 +08:00
AppEnv.windowEventHandler.openLink({ href: 'mailto:support@getmailspring.com' });
2017-09-27 02:33:08 +08:00
};
render() {
if (!this.state.isUnstableChannel) {
2017-09-27 02:33:08 +08:00
return <span />;
}
return (
<Notification
priority="0"
displayName={UnstableChannelNotification.displayName}
title="You're on a pre-release channel. We'd love your feedback."
subtitle="You can switch back to stable from the preferences."
icon="volstead-defaultclient.png"
2017-09-27 02:33:08 +08:00
actions={[
{
label: 'Feedback',
fn: this._onReportIssue,
},
]}
isDismissable
isPermanentlyDismissable
/>
2017-09-27 02:33:08 +08:00
);
}
}