diff --git a/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx b/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx index 1dcd93d..7d58856 100644 --- a/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx +++ b/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx @@ -1275,28 +1275,32 @@ const OpenlayersMapView = (props) => { - -
- -
-
+ {document.getElementById('map-view-your-area-button') ? ( + +
+ +
+
+ ) : ( + '' + )} ); }; diff --git a/src/components/manage/Blocks/Iframe/Edit.jsx b/src/components/manage/Blocks/Iframe/Edit.jsx index 152734f..f16d449 100644 --- a/src/components/manage/Blocks/Iframe/Edit.jsx +++ b/src/components/manage/Blocks/Iframe/Edit.jsx @@ -45,8 +45,16 @@ const getSchema = (props) => { title: 'Width', type: 'text', }, - height: { - title: 'Height', + desktopHeight: { + title: 'Desktop height', + type: 'text', + }, + tabletHeight: { + title: 'Tablet height', + type: 'text', + }, + mobileHeight: { + title: 'Mobile height', type: 'text', }, hideToolbar: { diff --git a/src/components/manage/Blocks/Iframe/View.jsx b/src/components/manage/Blocks/Iframe/View.jsx index 2da2cb5..94aa296 100644 --- a/src/components/manage/Blocks/Iframe/View.jsx +++ b/src/components/manage/Blocks/Iframe/View.jsx @@ -41,7 +41,9 @@ const View = ({ content, ...props }) => { description = '', descriptionClassName = '', width = '100%', - height = 'auto', + desktopHeight = '', + tabletHeight = '', + mobileHeight = '', } = data; const { hideToolbar = false, overflow = false, preset = null } = data; const url = { @@ -49,6 +51,11 @@ const View = ({ content, ...props }) => { tablet: tabletUrl || desktopUrl, mobile: mobileUrl || tabletUrl || desktopUrl, }; + const height = { + desktop: desktopHeight || data.height, + tablet: tabletHeight || desktopHeight || data.height, + mobile: mobileHeight || tabletHeight || desktopHeight || data.height, + }; useEffect(() => { if (props.data.queryParameters?.value) { @@ -137,6 +144,16 @@ const View = ({ content, ...props }) => { ]; }; + const getHeightByWidth = () => { + return height[ + Object.keys(breakPoints).filter( + (breakPoint) => + breakPoints[breakPoint][0] >= windowWidth && + breakPoints[breakPoint][1] <= windowWidth, + )[0] + ]; + }; + const applyQueryParameters = (url, query) => { try { new URL(url); @@ -192,7 +209,7 @@ const View = ({ content, ...props }) => { ...getPresetQueries(), })} width={width} - height={height} + height={getHeightByWidth()} className="embeded-iframe" display="initial" position="relative" diff --git a/src/components/manage/Blocks/SidebarBlock/View.jsx b/src/components/manage/Blocks/SidebarBlock/View.jsx index 80dd186..c72bb20 100644 --- a/src/components/manage/Blocks/SidebarBlock/View.jsx +++ b/src/components/manage/Blocks/SidebarBlock/View.jsx @@ -114,18 +114,21 @@ const makeNewNavigation = ( ...[ { title: 'Pollutant Releases', - url: `${item.items[0]?.url}#pollutant_releases_tableau`, + url: item.items[0]?.url, flag: 'has_release_data', + id: 'pollutant_releases_tableau', }, { title: 'Pollutant Transfers', - url: `${item.items[0]?.url}#pollutant_transfers_tableau`, + url: item.items[0]?.url, flag: 'has_transfer_data', + id: 'pollutant_transfers_tableau', }, { title: 'Waste Transfers', - url: `${item.items[0]?.url}#pollutant_waste_tableau`, + url: item.items[0]?.url, flag: 'has_waste_data', + id: 'pollutant_waste_tableau', }, ] .filter( @@ -150,7 +153,7 @@ const makeNewNavigation = ( // pathname.includes(child.url) // ); }, - onClick: (pathname) => { + onClick: (pathname, location) => { if ( facility.facilityInspireId !== search.facilityInspireId ) { @@ -162,9 +165,13 @@ const makeNewNavigation = ( }), ); } - if (pathname !== child.url) { - history.push(child.url); + history.push(`${child.url}#${child.id}`); + } else { + const hashElement = document.getElementById(child.id); + if (hashElement) { + hashElement.scrollIntoView(); + } } }, })), diff --git a/src/components/theme/View/DefaultView.jsx b/src/components/theme/View/DefaultView.jsx index 94c58b8..de0172a 100644 --- a/src/components/theme/View/DefaultView.jsx +++ b/src/components/theme/View/DefaultView.jsx @@ -3,7 +3,7 @@ * @module components/theme/View/DefaultView */ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; @@ -37,6 +37,17 @@ const DefaultView = ({ content, intl, location }) => { const blocksLayoutFieldname = getBlocksLayoutFieldname(content); const contentTypeBlocks = content['@components']?.layout?.[blocksFieldname]; + useEffect(() => { + if (content['@type' === 'site_template']) { + const hashElement = document.getElementById( + location.hash.replace('#', ''), + ); + if (hashElement) { + hashElement.scrollIntoView(); + } + } + }, [location.hash]); + return hasBlocksData(content) ? (
{map(content[blocksLayoutFieldname].items, (block) => {