2016-10-19 03:39:05 +08:00
|
|
|
import {React, UpdateChannelStore} from 'nylas-exports';
|
|
|
|
import {Notification} from 'nylas-component-kit';
|
|
|
|
|
|
|
|
export default class UnstableChannelNotification extends React.Component {
|
|
|
|
static displayName = 'UnstableChannelNotification';
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.state = {
|
|
|
|
isUnstableChannel: UpdateChannelStore.currentIsUnstable(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this._unsub = UpdateChannelStore.listen(() => {
|
|
|
|
this.setState({
|
|
|
|
isUnstableChannel: UpdateChannelStore.currentIsUnstable(),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
if (this._unsub) {
|
|
|
|
this._unsub();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_onReportIssue = () => {
|
|
|
|
NylasEnv.windowEventHandler.openLink({href: 'mailto:support@nylas.com'})
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2016-11-05 07:30:28 +08:00
|
|
|
if (!this.state.isUnstableChannel) {
|
2016-10-19 03:39:05 +08:00
|
|
|
return <span />
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<Notification
|
|
|
|
priority="0"
|
2016-11-05 07:30:28 +08:00
|
|
|
displayName={UnstableChannelNotification.displayName}
|
2016-10-19 03:39:05 +08:00
|
|
|
title="You're on a pre-release channel. We'd love your feedback."
|
2017-01-12 09:41:07 +08:00
|
|
|
subtitle="You can switch back to stable from the preferences."
|
2016-10-19 03:39:05 +08:00
|
|
|
icon="volstead-defaultclient.png"
|
|
|
|
actions={[{
|
|
|
|
label: "Feedback",
|
|
|
|
fn: this._onReportIssue,
|
|
|
|
}]}
|
2016-11-05 07:30:28 +08:00
|
|
|
isDismissable
|
|
|
|
isPermanentlyDismissable
|
2016-10-19 03:39:05 +08:00
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|