Skip to content

Commit 1c95cf9

Browse files
authored
chore: hide google maps link (#1328)
* chore: hide google maps link * chore: add sonar cloud comments
1 parent 00736c4 commit 1c95cf9

3 files changed

Lines changed: 40 additions & 40 deletions

File tree

public/frontend/src/components/rec-resource/RecreationResourceMap.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('RecreationResourceMap', () => {
5252

5353
expect(screen.getByText('Full map')).toBeInTheDocument();
5454
expect(screen.getByText('Export map file')).toBeInTheDocument();
55-
expect(screen.getByText('Google Maps')).toBeInTheDocument();
55+
// expect(screen.getByText('Google Maps')).toBeInTheDocument();
5656
});
5757

5858
it('renders Full map button', () => {

public/frontend/src/components/rec-resource/RecreationResourceMap.tsx

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@ import {
66
MATOMO_TRACKING_CATEGORY_MAP,
77
DownloadMapModal,
88
getMapFeaturesFromRecResource,
9-
getSitePointFeatureFromRecResource,
109
getLayerStyleForRecResource,
1110
StyleContext,
12-
webMercatorXToLon,
13-
webMercatorYToLat,
1411
} from '@shared/components/recreation-resource-map';
1512
import { RecreationResourceDetailModel } from '@/service/custom-models';
1613
import { trackEvent } from '@shared/utils';
1714
import { IconButton } from '@shared/components/icon-button';
1815
import { SearchMapFocusModes } from '@/components/search-map/constants';
1916
import { ROUTE_PATHS } from '@/routes/constants';
2017
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
21-
import { faExternalLink, faMap } from '@fortawesome/free-solid-svg-icons';
18+
import { faMap } from '@fortawesome/free-solid-svg-icons';
2219
import { getRecResourceDetailPageUrl } from '@/utils/recreationResourceUtils';
2320
import DownloadIcon from '@shared/assets/icons/download.svg';
2421

@@ -99,27 +96,30 @@ export const RecreationResourceMap = ({
9996
setIsDownloadModalOpen(true);
10097
}, [recResourceName, recResource?.rec_resource_id]);
10198

102-
const handleGoogleMapsLink = useCallback(() => {
103-
trackEvent({
104-
category: MATOMO_TRACKING_CATEGORY_MAP,
105-
action: TRACKING_ACTIONS.OPEN_GOOGLE_MAPS,
106-
name: `${recResourceName}-${recResource?.rec_resource_id}-${TRACKING_ACTIONS.OPEN_GOOGLE_MAPS}`,
107-
});
108-
const map = getSitePointFeatureFromRecResource(recResource);
109-
if (map) {
110-
const geometry = map.getGeometry();
111-
const coordinates = geometry?.getCoordinates();
112-
if (coordinates) {
113-
const lat = webMercatorYToLat(coordinates[1]);
114-
const lon = webMercatorXToLon(coordinates[0]);
115-
console.log(lat, lon);
116-
window.open(
117-
`https://www.google.com/maps/search/?api=1&query=${lat},${lon}`,
118-
'_blank',
119-
);
120-
}
121-
}
122-
}, [recResource, recResourceName]);
99+
/*
100+
* Hide temporaly google maps link until we come with a proper warning/disclaimer //NOSONAR
101+
* const handleGoogleMapsLink = useCallback(() => {
102+
* trackEvent({
103+
* category: MATOMO_TRACKING_CATEGORY_MAP,
104+
* action: TRACKING_ACTIONS.OPEN_GOOGLE_MAPS,
105+
* name: `${recResourceName}-${recResource?.rec_resource_id}-${TRACKING_ACTIONS.OPEN_GOOGLE_MAPS}`,
106+
* });
107+
* const map = getSitePointFeatureFromRecResource(recResource);
108+
* if (map) {
109+
* const geometry = map.getGeometry();
110+
* const coordinates = geometry?.getCoordinates();
111+
* if (coordinates) {
112+
* const lat = webMercatorYToLat(coordinates[1]);
113+
* const lon = webMercatorXToLon(coordinates[0]);
114+
* console.log(lat, lon);
115+
* window.open(
116+
* `https://www.google.com/maps/search/?api=1&query=${lat},${lon}`,
117+
* '_blank',
118+
* );
119+
* }
120+
* }
121+
*}, [recResource, recResourceName]);
122+
*/
123123

124124
if (!downloadStyledFeatures.length) {
125125
return null;
@@ -154,19 +154,19 @@ export const RecreationResourceMap = ({
154154
</IconButton>
155155
</Link>
156156
</Col>
157-
158-
<Col xs={12} md="auto">
159-
<IconButton
160-
data-testid="google-maps"
161-
variant="outline"
162-
onClick={handleGoogleMapsLink}
163-
aria-label={`Google maps view for ${recResourceName}`}
164-
leftIcon={<FontAwesomeIcon icon={faExternalLink} />}
165-
>
166-
Google Maps
167-
</IconButton>
168-
</Col>
169-
157+
{/* Hide temporaly google maps link until we come with a proper warning/disclaimer //NOSONAR
158+
*{<Col xs={12} md="auto">
159+
* <IconButton
160+
* data-testid="google-maps"
161+
* variant="outline"
162+
* onClick={handleGoogleMapsLink}
163+
* aria-label={`Google maps view for ${recResourceName}`}
164+
* leftIcon={<FontAwesomeIcon icon={faExternalLink} />}
165+
* >
166+
* Google Maps
167+
* </IconButton>
168+
*</Col>}
169+
*/}
170170
<Col xs={12} md="auto">
171171
<IconButton
172172
data-testid="download-button"

public/frontend/test/components/rec-resource/RecreationResourceMap.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('RecreationResourceMap', () => {
6464

6565
expect(screen.getByText('Full map')).toBeInTheDocument();
6666
expect(screen.getByText('Export map file')).toBeInTheDocument();
67-
expect(screen.getByText('Google Maps')).toBeInTheDocument();
67+
// expect(screen.getByText('Google Maps')).toBeInTheDocument();
6868
});
6969

7070
it('renders Full map button', () => {

0 commit comments

Comments
 (0)