aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorLibravatar Amine Mouafik <amine@mouafik.fr>2019-07-01 13:39:55 +0700
committerLibravatar Amine Mouafik <amine@mouafik.fr>2019-07-01 13:39:55 +0700
commitb43b265e8d383eb9b6f0a31f096f52ad9f7171c2 (patch)
tree6b258426b849520ae29d92a44fe2aa7c608ad80b /src/components
parentAdd features list to README (diff)
parentRevert: fix spellchecker (diff)
downloadferdium-app-b43b265e8d383eb9b6f0a31f096f52ad9f7171c2.tar.gz
ferdium-app-b43b265e8d383eb9b6f0a31f096f52ad9f7171c2.tar.zst
ferdium-app-b43b265e8d383eb9b6f0a31f096f52ad9f7171c2.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/components')
-rw-r--r--src/components/AppUpdateInfoBar.js66
-rw-r--r--src/components/auth/AuthLayout.js17
-rw-r--r--src/components/layout/AppLayout.js41
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 @@
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;
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 '../.
11import globalMessages from '../../i18n/globalMessages'; 11import globalMessages from '../../i18n/globalMessages';
12 12
13import { isWindows } from '../../environment'; 13import { isWindows } from '../../environment';
14import AppUpdateInfoBar from '../AppUpdateInfoBar';
14 15
15export default @observer class AuthLayout extends Component { 16export 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 d0476ef04..c66004183 100644
--- a/src/components/layout/AppLayout.js
+++ b/src/components/layout/AppLayout.js
@@ -13,10 +13,9 @@ import ErrorBoundary from '../util/ErrorBoundary';
13// import globalMessages from '../../i18n/globalMessages'; 13// import globalMessages from '../../i18n/globalMessages';
14 14
15import { isWindows } from '../../environment'; 15import { isWindows } from '../../environment';
16import AnnouncementScreen from '../../features/announcements/components/AnnouncementScreen';
17import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; 16import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator';
18import { workspaceStore } from '../../features/workspaces'; 17import { workspaceStore } from '../../features/workspaces';
19import { announcementActions } from '../../features/announcements/actions'; 18import AppUpdateInfoBar from '../AppUpdateInfoBar';
20 19
21function createMarkup(HTMLString) { 20function createMarkup(HTMLString) {
22 return { __html: HTMLString }; 21 return { __html: HTMLString };
@@ -27,22 +26,10 @@ const messages = defineMessages({
27 id: 'infobar.servicesUpdated', 26 id: 'infobar.servicesUpdated',
28 defaultMessage: '!!!Your services have been updated.', 27 defaultMessage: '!!!Your services have been updated.',
29 }, 28 },
30 updateAvailable: {
31 id: 'infobar.updateAvailable',
32 defaultMessage: '!!!A new update for Franz is available.',
33 },
34 buttonReloadServices: { 29 buttonReloadServices: {
35 id: 'infobar.buttonReloadServices', 30 id: 'infobar.buttonReloadServices',
36 defaultMessage: '!!!Reload services', 31 defaultMessage: '!!!Reload services',
37 }, 32 },
38 changelog: {
39 id: 'infobar.buttonChangelog',
40 defaultMessage: '!!!Changelog',
41 },
42 buttonInstallUpdate: {
43 id: 'infobar.buttonInstallUpdate',
44 defaultMessage: '!!!Restart & install update',
45 },
46 requiredRequestsFailed: { 33 requiredRequestsFailed: {
47 id: 'infobar.requiredRequestsFailed', 34 id: 'infobar.requiredRequestsFailed',
48 defaultMessage: '!!!Could not load services and user information', 35 defaultMessage: '!!!Could not load services and user information',
@@ -82,7 +69,6 @@ class AppLayout extends Component {
82 areRequiredRequestsLoading: PropTypes.bool.isRequired, 69 areRequiredRequestsLoading: PropTypes.bool.isRequired,
83 darkMode: PropTypes.bool.isRequired, 70 darkMode: PropTypes.bool.isRequired,
84 isDelayAppScreenVisible: PropTypes.bool.isRequired, 71 isDelayAppScreenVisible: PropTypes.bool.isRequired,
85 isAnnouncementVisible: PropTypes.bool.isRequired,
86 }; 72 };
87 73
88 static defaultProps = { 74 static defaultProps = {
@@ -116,7 +102,6 @@ class AppLayout extends Component {
116 areRequiredRequestsLoading, 102 areRequiredRequestsLoading,
117 darkMode, 103 darkMode,
118 isDelayAppScreenVisible, 104 isDelayAppScreenVisible,
119 isAnnouncementVisible,
120 } = this.props; 105 } = this.props;
121 106
122 const { intl } = this.context; 107 const { intl } = this.context;
@@ -175,32 +160,18 @@ class AppLayout extends Component {
175 </InfoBar> 160 </InfoBar>
176 )} 161 )}
177 {appUpdateIsDownloaded && ( 162 {appUpdateIsDownloaded && (
178 <InfoBar 163 <AppUpdateInfoBar
179 type="primary" 164 nextAppReleaseVersion={nextAppReleaseVersion}
180 ctaLabel={intl.formatMessage(messages.buttonInstallUpdate)} 165 onInstallUpdate={installAppUpdate}
181 onClick={installAppUpdate} 166 />
182 sticky
183 >
184 <span className="mdi mdi-information" />
185 {intl.formatMessage(messages.updateAvailable)}
186 {' '}
187 <button
188 className="info-bar__inline-button"
189 type="button"
190 onClick={() => announcementActions.show({ targetVersion: nextAppReleaseVersion })}
191 >
192 <u>{intl.formatMessage(messages.changelog)}</u>
193 </button>
194 </InfoBar>
195 )} 167 )}
196 <BasicAuth /> 168 <BasicAuth />
197 <ShareFranz /> 169 <ShareFranz />
198 {isAnnouncementVisible && (<AnnouncementScreen />)}
199 {services} 170 {services}
171 {children}
200 </div> 172 </div>
201 </div> 173 </div>
202 </div> 174 </div>
203 {children}
204 </div> 175 </div>
205 </ErrorBoundary> 176 </ErrorBoundary>
206 ); 177 );