From 355e634f64ddfef9abb7050dd486069cd6bbe18c Mon Sep 17 00:00:00 2001 From: Artem Baskal Date: Wed, 27 May 2020 14:25:27 +0300 Subject: [PATCH] - client: Don't hide version string when built-in auto-update is disabled: Merge pull request #628 in DNS/adguard-home from fix/1726 to master Close #1726 Squashed commit of the following: commit 3eac793c7c05fbb599f510fd8cae560011b7f5ca Merge: aebfaf61 16a6aada Author: ArtemBaskal Date: Wed May 27 14:14:58 2020 +0300 Merge branch 'master' into fix/1726 commit aebfaf610113f83027feb959ed87adef1b2db255 Author: ArtemBaskal Date: Wed May 27 12:54:30 2020 +0300 Always show version but hide update button when program is launched with "--no-check-update" flag commit 1d4ee05959379420fee9730b3bf8ba737852e96e Author: ArtemBaskal Date: Wed May 27 11:59:10 2020 +0300 Use classnames lib commit 7003a7064c9625fab513dc02222faff4a340393f Author: ArtemBaskal Date: Tue May 26 19:40:22 2020 +0300 - client: Don't hide version string when built-in auto-update is disabled --- client/src/components/App/index.js | 1 + client/src/components/ui/Footer.js | 112 ++++++++++++++-------------- client/src/components/ui/Version.js | 10 ++- client/src/reducers/index.js | 2 + 4 files changed, 65 insertions(+), 60 deletions(-) diff --git a/client/src/components/App/index.js b/client/src/components/App/index.js index 0b4d8cf9..2458f667 100644 --- a/client/src/components/App/index.js +++ b/client/src/components/App/index.js @@ -126,6 +126,7 @@ class App extends Component { dnsPort={dashboard.dnsPort} processingVersion={dashboard.processingVersion} getVersion={getVersion} + checkUpdateFlag={dashboard.checkUpdateFlag} /> diff --git a/client/src/components/ui/Footer.js b/client/src/components/ui/Footer.js index 7f8be014..14f37637 100644 --- a/client/src/components/ui/Footer.js +++ b/client/src/components/ui/Footer.js @@ -1,6 +1,7 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import { Trans, withTranslation } from 'react-i18next'; +import classNames from 'classnames'; import { REPOSITORY, PRIVACY_POLICY_LINK } from '../../helpers/constants'; import { LANGUAGES } from '../../helpers/twosky'; @@ -10,6 +11,22 @@ import Version from './Version'; import './Footer.css'; import './Select.css'; +const linksData = [ + { + href: REPOSITORY.URL, + name: 'homepage', + }, + { + href: PRIVACY_POLICY_LINK, + name: 'privacy_policy', + }, + { + href: REPOSITORY.ISSUES, + className: 'btn btn-outline-primary btn-sm footer__link--report', + name: 'report_an_issue', + }, +]; + class Footer extends Component { getYear = () => { const today = new Date(); @@ -20,9 +37,27 @@ class Footer extends Component { i18n.changeLanguage(event.target.value); }; + renderCopyright = () =>
+
+ copyright © {this.getYear()}{' '} + AdGuard +
+
; + + renderLinks = (linksData) => linksData.map(({ name, href, className = '' }) => + {name} + ); + + render() { const { - dnsVersion, processingVersion, getVersion, + dnsVersion, processingVersion, getVersion, checkUpdateFlag, } = this.props; return ( @@ -30,39 +65,8 @@ class Footer extends Component {
- {!dnsVersion && ( -
-
- copyright © {this.getYear()}{' '} - AdGuard -
-
- )}
- {dnsVersion && ( -
-
-
-
-
- copyright © {this.getYear()}{' '} - AdGuard -
-
-
- -
+
+
+
+ {this.renderCopyright()} +
+
- )} +
); } @@ -110,6 +109,7 @@ Footer.propTypes = { dnsVersion: PropTypes.string, processingVersion: PropTypes.bool, getVersion: PropTypes.func, + checkUpdateFlag: PropTypes.bool, }; export default withTranslation()(Footer); diff --git a/client/src/components/ui/Version.js b/client/src/components/ui/Version.js index 98287e48..185ba78d 100644 --- a/client/src/components/ui/Version.js +++ b/client/src/components/ui/Version.js @@ -6,14 +6,15 @@ import './Version.css'; const Version = (props) => { const { - dnsVersion, processingVersion, t, + dnsVersion = 'undefined', processingVersion, t, checkUpdateFlag, } = props; return (
- version{dnsVersion} - + }
); @@ -33,6 +34,7 @@ Version.propTypes = { dnsVersion: PropTypes.string.isRequired, getVersion: PropTypes.func.isRequired, processingVersion: PropTypes.bool.isRequired, + checkUpdateFlag: PropTypes.bool.isRequired, t: PropTypes.func.isRequired, }; diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js index 7cbeb4b5..642d8503 100644 --- a/client/src/reducers/index.js +++ b/client/src/reducers/index.js @@ -96,6 +96,7 @@ const dashboard = handleActions( canAutoUpdate, isUpdateAvailable: true, processingVersion: false, + checkUpdateFlag: !!payload, }; return newState; } @@ -165,6 +166,7 @@ const dashboard = handleActions( autoClients: [], supportedTags: [], name: '', + checkUpdateFlag: false, }, );