aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Sampath Kumar Krishnan <sampathBlam@users.noreply.github.com>2020-04-12 15:32:17 +0000
committerLibravatar GitHub <noreply@github.com>2020-04-12 16:32:17 +0100
commit5dd84f9ca68b55e892d0f13f37b284457990a4de (patch)
treeedc80ec0091e06a50fd618184308113eb4bad071
parentImprove user scripts (#559) (diff)
downloadferdium-app-5dd84f9ca68b55e892d0f13f37b284457990a4de.tar.gz
ferdium-app-5dd84f9ca68b55e892d0f13f37b284457990a4de.tar.zst
ferdium-app-5dd84f9ca68b55e892d0f13f37b284457990a4de.zip
Make update banner dismissable (#564)
- Remove the sticky option passed to InfoBar in AppUpdateInfoBar - Use component state to manage visibility of AppUpdateInfoBar in AuthLayout and AppLayout. - InfoBar will be dismissed only for the current session Co-Authored-By: Mahadevan Sreenivasan <mahadevan_sv@yahoo.com> Co-authored-by: Mahadevan Sreenivasan <mahadevan_sv@yahoo.com>
-rw-r--r--src/components/AppUpdateInfoBar.js4
-rw-r--r--src/components/auth/AuthLayout.js9
-rw-r--r--src/components/layout/AppLayout.js9
3 files changed, 19 insertions, 3 deletions
diff --git a/src/components/AppUpdateInfoBar.js b/src/components/AppUpdateInfoBar.js
index 4108fdf12..f51fe029b 100644
--- a/src/components/AppUpdateInfoBar.js
+++ b/src/components/AppUpdateInfoBar.js
@@ -24,6 +24,7 @@ class AppUpdateInfoBar extends Component {
24 static propTypes = { 24 static propTypes = {
25 onInstallUpdate: PropTypes.func.isRequired, 25 onInstallUpdate: PropTypes.func.isRequired,
26 nextAppReleaseVersion: PropTypes.string, 26 nextAppReleaseVersion: PropTypes.string,
27 onHide: PropTypes.func.isRequired,
27 }; 28 };
28 29
29 static defaultProps = { 30 static defaultProps = {
@@ -39,6 +40,7 @@ class AppUpdateInfoBar extends Component {
39 const { 40 const {
40 onInstallUpdate, 41 onInstallUpdate,
41 nextAppReleaseVersion, 42 nextAppReleaseVersion,
43 onHide,
42 } = this.props; 44 } = this.props;
43 45
44 return ( 46 return (
@@ -46,7 +48,7 @@ class AppUpdateInfoBar extends Component {
46 type="primary" 48 type="primary"
47 ctaLabel={intl.formatMessage(messages.buttonInstallUpdate)} 49 ctaLabel={intl.formatMessage(messages.buttonInstallUpdate)}
48 onClick={onInstallUpdate} 50 onClick={onInstallUpdate}
49 sticky 51 onHide={onHide}
50 > 52 >
51 <span className="mdi mdi-information" /> 53 <span className="mdi mdi-information" />
52 {intl.formatMessage(messages.updateAvailable)} 54 {intl.formatMessage(messages.updateAvailable)}
diff --git a/src/components/auth/AuthLayout.js b/src/components/auth/AuthLayout.js
index 0c5198583..4783fc6a0 100644
--- a/src/components/auth/AuthLayout.js
+++ b/src/components/auth/AuthLayout.js
@@ -27,6 +27,10 @@ export default @observer class AuthLayout extends Component {
27 appUpdateIsDownloaded: PropTypes.bool.isRequired, 27 appUpdateIsDownloaded: PropTypes.bool.isRequired,
28 }; 28 };
29 29
30 state = {
31 shouldShowAppUpdateInfoBar: true,
32 }
33
30 static defaultProps = { 34 static defaultProps = {
31 nextAppReleaseVersion: null, 35 nextAppReleaseVersion: null,
32 }; 36 };
@@ -62,10 +66,13 @@ export default @observer class AuthLayout extends Component {
62 {intl.formatMessage(globalMessages.notConnectedToTheInternet)} 66 {intl.formatMessage(globalMessages.notConnectedToTheInternet)}
63 </InfoBar> 67 </InfoBar>
64 )} 68 )}
65 {appUpdateIsDownloaded && ( 69 {appUpdateIsDownloaded && this.state.shouldShowAppUpdateInfoBar && (
66 <AppUpdateInfoBar 70 <AppUpdateInfoBar
67 nextAppReleaseVersion={nextAppReleaseVersion} 71 nextAppReleaseVersion={nextAppReleaseVersion}
68 onInstallUpdate={installAppUpdate} 72 onInstallUpdate={installAppUpdate}
73 onHide={() => {
74 this.setState({ shouldShowAppUpdateInfoBar: false });
75 }}
69 /> 76 />
70 )} 77 )}
71 {isOnline && !isAPIHealthy && ( 78 {isOnline && !isAPIHealthy && (
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js
index fe43c42d2..3b732e602 100644
--- a/src/components/layout/AppLayout.js
+++ b/src/components/layout/AppLayout.js
@@ -81,6 +81,10 @@ class AppLayout extends Component {
81 hasActivatedTrial: PropTypes.bool.isRequired, 81 hasActivatedTrial: PropTypes.bool.isRequired,
82 }; 82 };
83 83
84 state = {
85 shouldShowAppUpdateInfoBar: true,
86 }
87
84 static defaultProps = { 88 static defaultProps = {
85 children: [], 89 children: [],
86 nextAppReleaseVersion: null, 90 nextAppReleaseVersion: null,
@@ -181,10 +185,13 @@ class AppLayout extends Component {
181 {intl.formatMessage(messages.servicesUpdated)} 185 {intl.formatMessage(messages.servicesUpdated)}
182 </InfoBar> 186 </InfoBar>
183 )} 187 )}
184 {appUpdateIsDownloaded && ( 188 { appUpdateIsDownloaded && this.state.shouldShowAppUpdateInfoBar && (
185 <AppUpdateInfoBar 189 <AppUpdateInfoBar
186 nextAppReleaseVersion={nextAppReleaseVersion} 190 nextAppReleaseVersion={nextAppReleaseVersion}
187 onInstallUpdate={installAppUpdate} 191 onInstallUpdate={installAppUpdate}
192 onHide={() => {
193 this.setState({ shouldShowAppUpdateInfoBar: false });
194 }}
188 /> 195 />
189 )} 196 )}
190 <BasicAuth /> 197 <BasicAuth />