aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/AppUpdateInfoBar.js
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-06-05 17:23:29 +0200
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-06-05 17:23:29 +0200
commit70c4494b254688037c8b7033911d2d5f06e600a2 (patch)
tree5ef06c2b0fe08a170a1b25323f32009efc6d06bc /src/components/AppUpdateInfoBar.js
parentFix case in menu label (diff)
downloadferdium-app-70c4494b254688037c8b7033911d2d5f06e600a2.tar.gz
ferdium-app-70c4494b254688037c8b7033911d2d5f06e600a2.tar.zst
ferdium-app-70c4494b254688037c8b7033911d2d5f06e600a2.zip
support app updates also for unauthenticated users
Diffstat (limited to 'src/components/AppUpdateInfoBar.js')
-rw-r--r--src/components/AppUpdateInfoBar.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/components/AppUpdateInfoBar.js b/src/components/AppUpdateInfoBar.js
new file mode 100644
index 000000000..4fb3a8b71
--- /dev/null
+++ b/src/components/AppUpdateInfoBar.js
@@ -0,0 +1,66 @@
1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
3import { defineMessages, intlShape } from 'react-intl';
4
5import { announcementActions } from '../features/announcements/actions';
6import InfoBar from './ui/InfoBar';
7
8const messages = defineMessages({
9 updateAvailable: {
10 id: 'infobar.updateAvailable',
11 defaultMessage: '!!!A new update for Franz is available.',
12 },
13 changelog: {
14 id: 'infobar.buttonChangelog',
15 defaultMessage: '!!!Changelog',
16 },
17 buttonInstallUpdate: {
18 id: 'infobar.buttonInstallUpdate',
19 defaultMessage: '!!!Restart & install update',
20 },
21});
22
23class AppUpdateInfoBar extends Component {
24 static propTypes = {
25 onInstallUpdate: PropTypes.func.isRequired,
26 nextAppReleaseVersion: PropTypes.string,
27 };
28
29 static defaultProps = {
30 nextAppReleaseVersion: null,
31 };
32
33 static contextTypes = {
34 intl: intlShape,
35 };
36
37 render() {
38 const { intl } = this.context;
39 const {
40 onInstallUpdate,
41 nextAppReleaseVersion,
42 } = this.props;
43
44 return (
45 <InfoBar
46 type="primary"
47 ctaLabel={intl.formatMessage(messages.buttonInstallUpdate)}
48 onClick={onInstallUpdate}
49 sticky
50 >
51 <span className="mdi mdi-information" />
52 {intl.formatMessage(messages.updateAvailable)}
53 {' '}
54 <button
55 className="info-bar__inline-button"
56 type="button"
57 onClick={() => announcementActions.show({ targetVersion: nextAppReleaseVersion })}
58 >
59 <u>{intl.formatMessage(messages.changelog)}</u>
60 </button>
61 </InfoBar>
62 );
63 }
64}
65
66export default AppUpdateInfoBar;