From f4ec297e3e5a5b2ec7cfc60b96fa73565c202de7 Mon Sep 17 00:00:00 2001 From: Sara Bianchi <43245702+SaraBianchi@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:31:04 +0200 Subject: [PATCH] fix: fixed requiredBlocks config with spread and added controls in EventView props (#374) --- .../ItaliaTheme/View/EventoView/EventoCosE.jsx | 11 +++++++++-- .../View/EventoView/EventoUlterioriInformazioni.jsx | 6 +++--- src/config/italiaConfig.js | 4 +--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/ItaliaTheme/View/EventoView/EventoCosE.jsx b/src/components/ItaliaTheme/View/EventoView/EventoCosE.jsx index cb58ca601..f1e670518 100644 --- a/src/components/ItaliaTheme/View/EventoView/EventoCosE.jsx +++ b/src/components/ItaliaTheme/View/EventoView/EventoCosE.jsx @@ -12,6 +12,7 @@ import { richTextHasContent, Gallery, } from 'design-comuni-plone-theme/components/ItaliaTheme/View'; +import { contentFolderHasItems } from 'design-comuni-plone-theme/helpers'; const messages = defineMessages({ cos_e: { @@ -36,7 +37,11 @@ const messages = defineMessages({ const EventoCosE = ({ content }) => { const intl = useIntl(); - return ( + return richTextHasContent(content?.descrizione_estesa) || + contentFolderHasItems(content, 'immagini') || + contentFolderHasItems(content, 'video') || + content?.persone_amministrazione?.length > 0 || + richTextHasContent(content?.descrizione_destinatari) ? ( {
{intl.formatMessage(messages.parteciperanno)}
- {content.persone_amministrazione.map((item, i) => ( + {content?.persone_amministrazione?.map((item, i) => ( { )}
+ ) : ( + <> ); }; diff --git a/src/components/ItaliaTheme/View/EventoView/EventoUlterioriInformazioni.jsx b/src/components/ItaliaTheme/View/EventoView/EventoUlterioriInformazioni.jsx index 66c6ac0ab..62c77724a 100644 --- a/src/components/ItaliaTheme/View/EventoView/EventoUlterioriInformazioni.jsx +++ b/src/components/ItaliaTheme/View/EventoView/EventoUlterioriInformazioni.jsx @@ -34,7 +34,7 @@ const EventoUlterioriInformazioni = ({ content }) => { richTextHasContent(content?.ulteriori_informazioni) || content?.event_url || richTextHasContent(content?.patrocinato_da) || - content?.strutture_politiche.length > 0, + content?.strutture_politiche?.length > 0, [content], ); @@ -64,11 +64,11 @@ const EventoUlterioriInformazioni = ({ content }) => { )} )} - {content?.strutture_politiche.length > 0 && ( + {content?.strutture_politiche?.length > 0 && (
{intl.formatMessage(messages.strutture_politiche)}
- {content.strutture_politiche.map((item, i) => ( + {content?.strutture_politiche?.map((item, i) => (