diff options
Diffstat (limited to 'src/components/AppUpdateInfoBar.js')
-rw-r--r-- | src/components/AppUpdateInfoBar.js | 66 |
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 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { defineMessages, intlShape } from 'react-intl'; | ||
4 | |||
5 | import { announcementActions } from '../features/announcements/actions'; | ||
6 | import InfoBar from './ui/InfoBar'; | ||
7 | |||
8 | const 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 | |||
23 | class 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 | |||
66 | export default AppUpdateInfoBar; | ||