diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-03 16:07:02 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-03 16:07:02 -0700 |
commit | b75df536dfa8a64817c67764120939039ef9b871 (patch) | |
tree | aeadbdf57c3827a79e6157cb1c3e1e27a73c725a /modern/src | |
parent | c84878baa4e68aed6bb2e053d0a0c612b68aedda (diff) | |
download | trackermap-web-b75df536dfa8a64817c67764120939039ef9b871.tar.gz trackermap-web-b75df536dfa8a64817c67764120939039ef9b871.tar.bz2 trackermap-web-b75df536dfa8a64817c67764120939039ef9b871.zip |
Address link only if enabled (fix #756)
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/common/components/AddressValue.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modern/src/common/components/AddressValue.js b/modern/src/common/components/AddressValue.js index 767f516b..36369c69 100644 --- a/modern/src/common/components/AddressValue.js +++ b/modern/src/common/components/AddressValue.js @@ -1,4 +1,5 @@ import React, { useEffect, useState } from 'react'; +import { useSelector } from 'react-redux'; import { Link } from '@mui/material'; import { useTranslation } from './LocalizationProvider'; import { useCatch } from '../../reactHelper'; @@ -6,6 +7,8 @@ import { useCatch } from '../../reactHelper'; const AddressValue = ({ latitude, longitude, originalAddress }) => { const t = useTranslation(); + const addressEnabled = useSelector((state) => state.session.server.geocoderEnabled); + const [address, setAddress] = useState(); useEffect(() => { @@ -25,7 +28,10 @@ const AddressValue = ({ latitude, longitude, originalAddress }) => { if (address) { return address; } - return (<Link href="#" onClick={showAddress}>{t('sharedShowAddress')}</Link>); + if (addressEnabled) { + return (<Link href="#" onClick={showAddress}>{t('sharedShowAddress')}</Link>); + } + return ''; }; export default AddressValue; |