diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-06-12 11:35:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-12 11:35:22 +0200 |
commit | 98910182bb1316c02865bebe2e4e3a00fbba3f0a (patch) | |
tree | 1546e5a602b4b1c39df102459d11c4c1d4893036 /src/components | |
parent | Update CHANGELOG.md (diff) | |
parent | Update CHANGELOG.md (diff) | |
download | ferdium-app-98910182bb1316c02865bebe2e4e3a00fbba3f0a.tar.gz ferdium-app-98910182bb1316c02865bebe2e4e3a00fbba3f0a.tar.zst ferdium-app-98910182bb1316c02865bebe2e4e3a00fbba3f0a.zip |
Merge pull request #1472 from meetfranz/release/5.2.0-beta.1
5.2.0 beta.1
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/AppUpdateInfoBar.js | 66 | ||||
-rw-r--r-- | src/components/auth/AuthLayout.js | 17 | ||||
-rw-r--r-- | src/components/layout/AppLayout.js | 41 |
3 files changed, 89 insertions, 35 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; | ||
diff --git a/src/components/auth/AuthLayout.js b/src/components/auth/AuthLayout.js index ac8fdbe5b..3d43d4e5c 100644 --- a/src/components/auth/AuthLayout.js +++ b/src/components/auth/AuthLayout.js | |||
@@ -11,6 +11,7 @@ import { oneOrManyChildElements, globalError as globalErrorPropType } from '../. | |||
11 | import globalMessages from '../../i18n/globalMessages'; | 11 | import globalMessages from '../../i18n/globalMessages'; |
12 | 12 | ||
13 | import { isWindows } from '../../environment'; | 13 | import { isWindows } from '../../environment'; |
14 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; | ||
14 | 15 | ||
15 | export default @observer class AuthLayout extends Component { | 16 | export default @observer class AuthLayout extends Component { |
16 | static propTypes = { | 17 | static propTypes = { |
@@ -22,6 +23,13 @@ export default @observer class AuthLayout extends Component { | |||
22 | isHealthCheckLoading: PropTypes.bool.isRequired, | 23 | isHealthCheckLoading: PropTypes.bool.isRequired, |
23 | isFullScreen: PropTypes.bool.isRequired, | 24 | isFullScreen: PropTypes.bool.isRequired, |
24 | darkMode: PropTypes.bool.isRequired, | 25 | darkMode: PropTypes.bool.isRequired, |
26 | nextAppReleaseVersion: PropTypes.string, | ||
27 | installAppUpdate: PropTypes.func.isRequired, | ||
28 | appUpdateIsDownloaded: PropTypes.bool.isRequired, | ||
29 | }; | ||
30 | |||
31 | static defaultProps = { | ||
32 | nextAppReleaseVersion: null, | ||
25 | }; | 33 | }; |
26 | 34 | ||
27 | static contextTypes = { | 35 | static contextTypes = { |
@@ -38,6 +46,9 @@ export default @observer class AuthLayout extends Component { | |||
38 | isHealthCheckLoading, | 46 | isHealthCheckLoading, |
39 | isFullScreen, | 47 | isFullScreen, |
40 | darkMode, | 48 | darkMode, |
49 | nextAppReleaseVersion, | ||
50 | installAppUpdate, | ||
51 | appUpdateIsDownloaded, | ||
41 | } = this.props; | 52 | } = this.props; |
42 | const { intl } = this.context; | 53 | const { intl } = this.context; |
43 | 54 | ||
@@ -53,6 +64,12 @@ export default @observer class AuthLayout extends Component { | |||
53 | {intl.formatMessage(globalMessages.notConnectedToTheInternet)} | 64 | {intl.formatMessage(globalMessages.notConnectedToTheInternet)} |
54 | </InfoBar> | 65 | </InfoBar> |
55 | )} | 66 | )} |
67 | {appUpdateIsDownloaded && ( | ||
68 | <AppUpdateInfoBar | ||
69 | nextAppReleaseVersion={nextAppReleaseVersion} | ||
70 | onInstallUpdate={installAppUpdate} | ||
71 | /> | ||
72 | )} | ||
56 | {isOnline && !isAPIHealthy && ( | 73 | {isOnline && !isAPIHealthy && ( |
57 | <InfoBar | 74 | <InfoBar |
58 | type="danger" | 75 | type="danger" |
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index d5febfaf4..499bc097a 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js | |||
@@ -14,10 +14,9 @@ import ErrorBoundary from '../util/ErrorBoundary'; | |||
14 | // import globalMessages from '../../i18n/globalMessages'; | 14 | // import globalMessages from '../../i18n/globalMessages'; |
15 | 15 | ||
16 | import { isWindows } from '../../environment'; | 16 | import { isWindows } from '../../environment'; |
17 | import AnnouncementScreen from '../../features/announcements/components/AnnouncementScreen'; | ||
18 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; | 17 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; |
19 | import { workspaceStore } from '../../features/workspaces'; | 18 | import { workspaceStore } from '../../features/workspaces'; |
20 | import { announcementActions } from '../../features/announcements/actions'; | 19 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; |
21 | 20 | ||
22 | function createMarkup(HTMLString) { | 21 | function createMarkup(HTMLString) { |
23 | return { __html: HTMLString }; | 22 | return { __html: HTMLString }; |
@@ -28,22 +27,10 @@ const messages = defineMessages({ | |||
28 | id: 'infobar.servicesUpdated', | 27 | id: 'infobar.servicesUpdated', |
29 | defaultMessage: '!!!Your services have been updated.', | 28 | defaultMessage: '!!!Your services have been updated.', |
30 | }, | 29 | }, |
31 | updateAvailable: { | ||
32 | id: 'infobar.updateAvailable', | ||
33 | defaultMessage: '!!!A new update for Franz is available.', | ||
34 | }, | ||
35 | buttonReloadServices: { | 30 | buttonReloadServices: { |
36 | id: 'infobar.buttonReloadServices', | 31 | id: 'infobar.buttonReloadServices', |
37 | defaultMessage: '!!!Reload services', | 32 | defaultMessage: '!!!Reload services', |
38 | }, | 33 | }, |
39 | changelog: { | ||
40 | id: 'infobar.buttonChangelog', | ||
41 | defaultMessage: '!!!Changelog', | ||
42 | }, | ||
43 | buttonInstallUpdate: { | ||
44 | id: 'infobar.buttonInstallUpdate', | ||
45 | defaultMessage: '!!!Restart & install update', | ||
46 | }, | ||
47 | requiredRequestsFailed: { | 34 | requiredRequestsFailed: { |
48 | id: 'infobar.requiredRequestsFailed', | 35 | id: 'infobar.requiredRequestsFailed', |
49 | defaultMessage: '!!!Could not load services and user information', | 36 | defaultMessage: '!!!Could not load services and user information', |
@@ -83,7 +70,6 @@ class AppLayout extends Component { | |||
83 | areRequiredRequestsLoading: PropTypes.bool.isRequired, | 70 | areRequiredRequestsLoading: PropTypes.bool.isRequired, |
84 | darkMode: PropTypes.bool.isRequired, | 71 | darkMode: PropTypes.bool.isRequired, |
85 | isDelayAppScreenVisible: PropTypes.bool.isRequired, | 72 | isDelayAppScreenVisible: PropTypes.bool.isRequired, |
86 | isAnnouncementVisible: PropTypes.bool.isRequired, | ||
87 | }; | 73 | }; |
88 | 74 | ||
89 | static defaultProps = { | 75 | static defaultProps = { |
@@ -117,7 +103,6 @@ class AppLayout extends Component { | |||
117 | areRequiredRequestsLoading, | 103 | areRequiredRequestsLoading, |
118 | darkMode, | 104 | darkMode, |
119 | isDelayAppScreenVisible, | 105 | isDelayAppScreenVisible, |
120 | isAnnouncementVisible, | ||
121 | } = this.props; | 106 | } = this.props; |
122 | 107 | ||
123 | const { intl } = this.context; | 108 | const { intl } = this.context; |
@@ -176,33 +161,19 @@ class AppLayout extends Component { | |||
176 | </InfoBar> | 161 | </InfoBar> |
177 | )} | 162 | )} |
178 | {appUpdateIsDownloaded && ( | 163 | {appUpdateIsDownloaded && ( |
179 | <InfoBar | 164 | <AppUpdateInfoBar |
180 | type="primary" | 165 | nextAppReleaseVersion={nextAppReleaseVersion} |
181 | ctaLabel={intl.formatMessage(messages.buttonInstallUpdate)} | 166 | onInstallUpdate={installAppUpdate} |
182 | onClick={installAppUpdate} | 167 | /> |
183 | sticky | ||
184 | > | ||
185 | <span className="mdi mdi-information" /> | ||
186 | {intl.formatMessage(messages.updateAvailable)} | ||
187 | {' '} | ||
188 | <button | ||
189 | className="info-bar__inline-button" | ||
190 | type="button" | ||
191 | onClick={() => announcementActions.show({ targetVersion: nextAppReleaseVersion })} | ||
192 | > | ||
193 | <u>{intl.formatMessage(messages.changelog)}</u> | ||
194 | </button> | ||
195 | </InfoBar> | ||
196 | )} | 168 | )} |
197 | {isDelayAppScreenVisible && (<DelayApp />)} | 169 | {isDelayAppScreenVisible && (<DelayApp />)} |
198 | <BasicAuth /> | 170 | <BasicAuth /> |
199 | <ShareFranz /> | 171 | <ShareFranz /> |
200 | {isAnnouncementVisible && (<AnnouncementScreen />)} | ||
201 | {services} | 172 | {services} |
173 | {children} | ||
202 | </div> | 174 | </div> |
203 | </div> | 175 | </div> |
204 | </div> | 176 | </div> |
205 | {children} | ||
206 | </div> | 177 | </div> |
207 | </ErrorBoundary> | 178 | </ErrorBoundary> |
208 | ); | 179 | ); |