From e46850dba5afc97fce22986879d9c72381c009e3 Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Thu, 17 Sep 2020 16:12:46 +0300 Subject: [PATCH] Update --- .../Blocks/DiscodataComponents/Text/View.jsx | 13 ++-- .../DiscodataOpenlayersMapBlock/View.jsx | 61 ++++--------------- .../manage/Blocks/SidebarBlock/View.jsx | 2 +- theme/site/globals/site.overrides | 6 ++ 4 files changed, 26 insertions(+), 56 deletions(-) diff --git a/src/components/manage/Blocks/DiscodataComponents/Text/View.jsx b/src/components/manage/Blocks/DiscodataComponents/Text/View.jsx index 371ddff2..9b0bad48 100644 --- a/src/components/manage/Blocks/DiscodataComponents/Text/View.jsx +++ b/src/components/manage/Blocks/DiscodataComponents/Text/View.jsx @@ -97,13 +97,14 @@ const View = ({ content, ...props }) => { }; }); selectedSubResources.forEach((subResource) => { - const discodataPackage = resources.filter( - (resource) => resource.package === subResource.package, - )[0]; - if (props.search[discodataPackage.queryParameter]) { + const discodataPackage = + resources.filter( + (resource) => resource.package === subResource.package, + )[0] || {}; + if (props.search[discodataPackage?.queryParameter]) { newDiscodataValues.push( - props.discodata_resources[discodataPackage.package]?.[ - props.search[discodataPackage.queryParameter] + props.discodata_resources[discodataPackage?.package]?.[ + props.search[discodataPackage?.queryParameter] ]?.[subResource.query], ); } diff --git a/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx b/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx index 04e9fdb9..4684240d 100644 --- a/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx +++ b/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx @@ -642,7 +642,9 @@ const OpenlayersMapView = (props) => { function displayPopup(map, pixel, coordinate, popup, detailed = false) { if (setFeatureInfo(map, pixel, coordinate, detailed)) { - map.getTarget().style.cursor = 'pointer'; + if (!detailed) { + map.getTarget().style.cursor = 'pointer'; + } popup.element.classList.add('show'); popup.setPosition(coordinate); } else { @@ -833,47 +835,6 @@ const OpenlayersMapView = (props) => { zIndex: 0, }), }), - // style: (feature, resolution) => { - // const featureProperties = feature.getProperties(); - // if ( - // featureProperties.siteName === siteTermRef.current || - // (SVG_COLLECTION[featureProperties.eea_activities]?.() && - // stateRef.current.map.element?.getView?.()?.getZoom?.() > 11) - // ) { - // return new Style({ - // image: new Icon({ - // src: - // featureProperties.siteName === siteTermRef.current - // ? `data:image/svg+xml;utf8,${encodeURIComponent( - // pinSVG('#50C878'), - // )}` - // : `data:image/svg+xml;utf8,${encodeURIComponent( - // SVG_COLLECTION[featureProperties.eea_activities](), - // )}`, - // opacity: 1, - // scale: 1, - // }), - // zIndex: - // featureProperties.siteName === siteTermRef.current ? 1 : 0, - // }); - // } else { - // return new Style({ - // image: new CircleStyle({ - // radius: 3, - // fill: - // featureProperties.siteName === siteTermRef.current - // ? new Fill({ color: '#50C878' }) - // : new Fill({ color: '#000' }), - // stroke: - // featureProperties.siteName === siteTermRef.current - // ? new Stroke({ color: '#6A6A6A', width: 1 }) - // : new Stroke({ color: '#6A6A6A', width: 1 }), - // zIndex: - // featureProperties.siteName === siteTermRef.current ? 1 : 0, - // }), - // }); - // } - // }, visible: true, title: 'ly_IED_SiteMap_WM', }); @@ -931,13 +892,15 @@ const OpenlayersMapView = (props) => { } }); if (hasPopups) { - map.on('pointermove', function (evt) { - if (evt.dragging) { - return; - } - const pixel = map.getEventPixel(evt.originalEvent); - displayPopup(map, pixel, evt.coordinate, popup); - }); + if (document && document.documentElement?.clientWidth > 500) { + map.on('pointermove', function (evt) { + if (evt.dragging) { + return; + } + const pixel = map.getEventPixel(evt.originalEvent); + displayPopup(map, pixel, evt.coordinate, popup); + }); + } map.on('click', function (evt) { let newZoom = map.getView().getZoom(); if (newZoom > zoomSwitch) { diff --git a/src/components/manage/Blocks/SidebarBlock/View.jsx b/src/components/manage/Blocks/SidebarBlock/View.jsx index 1e8d508e..21c8e4d4 100644 --- a/src/components/manage/Blocks/SidebarBlock/View.jsx +++ b/src/components/manage/Blocks/SidebarBlock/View.jsx @@ -476,7 +476,7 @@ const View = ({ content, ...props }) => { props.dispatch, ), ); - } else if (preset.key && !collection.length) { + } else if (preset.key) { navigation = flattenArray(props.navigation.items, {}, 0, 0); } else { navigation = flattenArray(props.navigation.items); diff --git a/theme/site/globals/site.overrides b/theme/site/globals/site.overrides index 2b9b8f66..49990241 100644 --- a/theme/site/globals/site.overrides +++ b/theme/site/globals/site.overrides @@ -1613,4 +1613,10 @@ b { pointer-events: none; color: #333; text-decoration: none !important; +} + +.query-param-text { + a { + text-decoration: underline !important; + } } \ No newline at end of file