mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-17 06:42:25 +03:00
Squashed commit of the following: commit 1c4a15f2f32cd8bfbe0878f79feee4f581f0f5a8 Merge:399d28e67
9d1c45fd9
Author: Ildar Kamalov <ik@adguard.com> Date: Tue Jul 2 13:08:21 2024 +0300 Merge branch 'master' into ADG-8737 commit399d28e67f
Author: Ildar Kamalov <ik@adguard.com> Date: Mon Jul 1 19:37:05 2024 +0300 fix install commit91d5dd23ce
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Jul 1 17:40:22 2024 +0300 home: imp logs commit06917df08b
Author: Ildar Kamalov <ik@adguard.com> Date: Mon Jul 1 16:38:38 2024 +0300 ADG-8737 add missing version, remove validation call
54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
import { Trans, useTranslation } from 'react-i18next';
|
|
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
|
|
|
import { getVersion } from '../../actions';
|
|
import './Version.css';
|
|
import { RootState } from '../../initialState';
|
|
|
|
const Version = () => {
|
|
const dispatch = useDispatch();
|
|
const { t } = useTranslation();
|
|
const dashboard = useSelector((state: RootState) => state.dashboard, shallowEqual);
|
|
const install = useSelector((state: RootState) => state.install, shallowEqual);
|
|
|
|
if (!dashboard && !install) {
|
|
return null;
|
|
}
|
|
|
|
const version = dashboard?.dnsVersion || install?.dnsVersion;
|
|
|
|
const onClick = () => {
|
|
dispatch(getVersion(true));
|
|
};
|
|
|
|
return (
|
|
<div className="version">
|
|
<div className="version__text">
|
|
{version && (
|
|
<>
|
|
<Trans>version</Trans>:
|
|
<span className="version__value" title={version}>
|
|
{version}
|
|
</span>
|
|
</>
|
|
)}
|
|
|
|
{dashboard?.checkUpdateFlag && (
|
|
<button
|
|
type="button"
|
|
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
|
|
onClick={onClick}
|
|
disabled={dashboard?.processingVersion}
|
|
title={t('check_updates_now')}>
|
|
<svg className="icons icon12">
|
|
<use xlinkHref="#refresh" />
|
|
</svg>
|
|
</button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Version;
|