Skip to content

Commit

Permalink
- client: Don't hide version string when built-in auto-update is disa…
Browse files Browse the repository at this point in the history
…bled
  • Loading branch information
ArtemBaskal committed May 26, 2020
1 parent 383507b commit 7003a70
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 67 deletions.
107 changes: 52 additions & 55 deletions client/src/components/ui/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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();
Expand All @@ -20,6 +36,24 @@ class Footer extends Component {
i18n.changeLanguage(event.target.value);
};

renderCopyright = () => <div className="footer__column">
<div className="footer__copyright">
<Trans>copyright</Trans> &copy; {this.getYear()}{' '}
<a target="_blank" rel="noopener noreferrer" href="https://adguard.com/">AdGuard</a>
</div>
</div>;

renderLinks = (linksData) => linksData.map(({ name, href, className = '' }) => <a
key={name}
href={href}
className={`footer__link ${className}`.trim()}
target="_blank"
rel="noopener noreferrer"
>
<Trans>{name}</Trans>
</a>);


render() {
const {
dnsVersion, processingVersion, getVersion,
Expand All @@ -30,77 +64,40 @@ class Footer extends Component {
<footer className="footer">
<div className="container">
<div className="footer__row">
{!dnsVersion && (
<div className="footer__column">
<div className="footer__copyright">
<Trans>copyright</Trans> &copy; {this.getYear()}{' '}
<a target="_blank" rel="noopener noreferrer" href="https://adguard.com/">AdGuard</a>
</div>
</div>
)}
<div className="footer__column footer__column--links">
<a
href={REPOSITORY.URL}
className="footer__link"
target="_blank"
rel="noopener noreferrer"
>
<Trans>homepage</Trans>
</a>
<a
href={PRIVACY_POLICY_LINK}
className="footer__link"
target="_blank"
rel="noopener noreferrer"
>
<Trans>privacy_policy</Trans>
</a>
<a
href={REPOSITORY.ISSUES}
className="btn btn-outline-primary btn-sm footer__link footer__link--report"
target="_blank"
rel="noopener noreferrer"
>
<Trans>report_an_issue</Trans>
</a>
{this.renderLinks(linksData)}
</div>
<div className="footer__column footer__column--language">
<select
className="form-control select select--language"
value={i18n.language}
onChange={this.changeLanguage}
>
{Object.keys(LANGUAGES).map((lang) => (
<option key={lang} value={lang}>
{LANGUAGES[lang]}
</option>
))}
{Object.keys(LANGUAGES)
.map((lang) => (
<option key={lang} value={lang}>
{LANGUAGES[lang]}
</option>
))}
</select>
</div>
</div>
</div>
</footer>
{dnsVersion && (
<div className="footer">
<div className="container">
<div className="footer__row">
<div className="footer__column">
<div className="footer__copyright">
<Trans>copyright</Trans> &copy; {this.getYear()}{' '}
<a target="_blank" rel="noopener noreferrer" href="https://adguard.com/">AdGuard</a>
</div>
</div>
<div className="footer__column footer__column--language">
<Version
dnsVersion={dnsVersion}
processingVersion={processingVersion}
getVersion={getVersion}
/>
</div>
<div className="footer">
<div className="container">
<div className="footer__row">
{this.renderCopyright()}
<div className="footer__column footer__column--language">
<Version
dnsVersion={dnsVersion}
processingVersion={processingVersion}
getVersion={getVersion}
/>
</div>
</div>
</div>
)}
</div>
</Fragment>
);
}
Expand Down
27 changes: 15 additions & 12 deletions client/src/components/ui/Version.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ const Version = (props) => {
return (
<div className="version">
<div className="version__text">
<Trans>version</Trans>:&nbsp;<span className="version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button>
{dnsVersion && <>
<Trans>version</Trans>:&nbsp;
<span className="version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button>
</>}
</div>
</div>
);
Expand Down

0 comments on commit 7003a70

Please sign in to comment.