diff --git a/locales/de/LC_MESSAGES/volto.po b/locales/de/LC_MESSAGES/volto.po index d68101ec5..3d4d837d3 100644 --- a/locales/de/LC_MESSAGES/volto.po +++ b/locales/de/LC_MESSAGES/volto.po @@ -1021,7 +1021,7 @@ msgstr "" msgid "bando_data_pubblicazione" msgstr "" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextDestinatari # defaultMessage: Destinatari del bando msgid "bando_destinatari" msgstr "" @@ -1032,7 +1032,7 @@ msgid "bando_effective" msgstr "" #: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextEnte # defaultMessage: Ente msgid "bando_ente" msgstr "" @@ -3749,7 +3749,7 @@ msgstr "" msgid "timeline_tempi_scadenze_validation_error" msgstr "" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextTipologia # defaultMessage: Tipologia del bando msgid "tipologia_bando" msgstr "" diff --git a/locales/en/LC_MESSAGES/volto.po b/locales/en/LC_MESSAGES/volto.po index 26344fccf..28903bbed 100644 --- a/locales/en/LC_MESSAGES/volto.po +++ b/locales/en/LC_MESSAGES/volto.po @@ -1006,7 +1006,7 @@ msgstr "Expired" msgid "bando_data_pubblicazione" msgstr "Publication date" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextDestinatari # defaultMessage: Destinatari del bando msgid "bando_destinatari" msgstr "Recipients of the competition notice" @@ -1017,7 +1017,7 @@ msgid "bando_effective" msgstr "Publication date" #: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextEnte # defaultMessage: Ente msgid "bando_ente" msgstr "Supplying authority" @@ -3734,7 +3734,7 @@ msgstr "Insert a value" msgid "timeline_tempi_scadenze_validation_error" msgstr "" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextTipologia # defaultMessage: Tipologia del bando msgid "tipologia_bando" msgstr "Type of call" diff --git a/locales/es/LC_MESSAGES/volto.po b/locales/es/LC_MESSAGES/volto.po index 632636854..43f011312 100644 --- a/locales/es/LC_MESSAGES/volto.po +++ b/locales/es/LC_MESSAGES/volto.po @@ -1015,7 +1015,7 @@ msgstr "Expirado" msgid "bando_data_pubblicazione" msgstr "Fecha de publicación" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextDestinatari # defaultMessage: Destinatari del bando msgid "bando_destinatari" msgstr "Destinatarios del anuncio de concurso" @@ -1026,7 +1026,7 @@ msgid "bando_effective" msgstr "Fecha de publicación" #: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextEnte # defaultMessage: Ente msgid "bando_ente" msgstr "Autoridad proveedora" @@ -3743,7 +3743,7 @@ msgstr "Insertar un valor" msgid "timeline_tempi_scadenze_validation_error" msgstr "" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextTipologia # defaultMessage: Tipologia del bando msgid "tipologia_bando" msgstr "Tipo de llamada" diff --git a/locales/fr/LC_MESSAGES/volto.po b/locales/fr/LC_MESSAGES/volto.po index 33ce9f4a8..4722ddbdf 100644 --- a/locales/fr/LC_MESSAGES/volto.po +++ b/locales/fr/LC_MESSAGES/volto.po @@ -1023,7 +1023,7 @@ msgstr "Expiré" msgid "bando_data_pubblicazione" msgstr "Date de publication" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextDestinatari # defaultMessage: Destinatari del bando msgid "bando_destinatari" msgstr "Destinataires d'appels" @@ -1034,7 +1034,7 @@ msgid "bando_effective" msgstr "Date de publication" #: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextEnte # defaultMessage: Ente msgid "bando_ente" msgstr "Autorité fournisseur" @@ -3751,7 +3751,7 @@ msgstr "Entrez du texte" msgid "timeline_tempi_scadenze_validation_error" msgstr "" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextTipologia # defaultMessage: Tipologia del bando msgid "tipologia_bando" msgstr "Type d'appel" diff --git a/locales/it/LC_MESSAGES/volto.po b/locales/it/LC_MESSAGES/volto.po index eed38401f..fa9021030 100644 --- a/locales/it/LC_MESSAGES/volto.po +++ b/locales/it/LC_MESSAGES/volto.po @@ -1006,7 +1006,7 @@ msgstr "Scaduto" msgid "bando_data_pubblicazione" msgstr "Pubblicato il" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextDestinatari # defaultMessage: Destinatari del bando msgid "bando_destinatari" msgstr "Destinatari del bando" @@ -1017,7 +1017,7 @@ msgid "bando_effective" msgstr "Data di pubblicazione" #: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextEnte # defaultMessage: Ente msgid "bando_ente" msgstr "Ente erogatore" @@ -3734,7 +3734,7 @@ msgstr "Inserisci un valore" msgid "timeline_tempi_scadenze_validation_error" msgstr "" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextTipologia # defaultMessage: Tipologia del bando msgid "tipologia_bando" msgstr "Tipologia del bando" diff --git a/locales/volto.pot b/locales/volto.pot index 4e3423f7e..207c3929e 100644 --- a/locales/volto.pot +++ b/locales/volto.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: Plone\n" -"POT-Creation-Date: 2023-11-07T09:01:50.705Z\n" +"POT-Creation-Date: 2023-11-07T16:35:33.634Z\n" "Last-Translator: Plone i18n \n" "Language-Team: Plone i18n \n" "MIME-Version: 1.0\n" @@ -1008,7 +1008,7 @@ msgstr "" msgid "bando_data_pubblicazione" msgstr "" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextDestinatari # defaultMessage: Destinatari del bando msgid "bando_destinatari" msgstr "" @@ -1019,7 +1019,7 @@ msgid "bando_effective" msgstr "" #: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextEnte # defaultMessage: Ente msgid "bando_ente" msgstr "" @@ -3736,7 +3736,7 @@ msgstr "" msgid "timeline_tempi_scadenze_validation_error" msgstr "" -#: components/ItaliaTheme/View/BandoView/BandoText +#: components/ItaliaTheme/View/BandoView/BandoTextTipologia # defaultMessage: Tipologia del bando msgid "tipologia_bando" msgstr "" diff --git a/src/components/ItaliaTheme/View/BandoView/BandoText.jsx b/src/components/ItaliaTheme/View/BandoView/BandoText.jsx index dbb9ed64a..4f6048d71 100644 --- a/src/components/ItaliaTheme/View/BandoView/BandoText.jsx +++ b/src/components/ItaliaTheme/View/BandoView/BandoText.jsx @@ -7,23 +7,15 @@ import { richTextHasContent, } from 'design-comuni-plone-theme/components/ItaliaTheme/View'; +import BandoTextTipologia from 'design-comuni-plone-theme/components/ItaliaTheme/View/BandoView/BandoTextTipologia'; +import BandoTextDestinatari from 'design-comuni-plone-theme/components/ItaliaTheme/View/BandoView/BandoTextDestinatari'; +import BandoTextEnte from 'design-comuni-plone-theme/components/ItaliaTheme/View/BandoView/BandoTextEnte'; + const messages = defineMessages({ descrizione: { id: 'descrizione_bando', defaultMessage: 'Descrizione', }, - tipologia_bando: { - id: 'tipologia_bando', - defaultMessage: 'Tipologia del bando', - }, - destinatari: { - id: 'bando_destinatari', - defaultMessage: 'Destinatari del bando', - }, - ente: { - id: 'bando_ente', - defaultMessage: 'Ente erogatore', - }, }); const BandoText = ({ content }) => { @@ -40,33 +32,11 @@ const BandoText = ({ content }) => { {/* DESCRIZIONE DEL BANDO */} {richTextHasContent(content?.text) && } {/* TIPOLOGIA DEL BANDO */} - {content?.tipologia_bando && ( - <> -

{intl.formatMessage(messages.tipologia_bando)}

- {content.tipologia_bando.title} - - )} + {/* DESTINATARI DEL BANDO */} - {content?.destinatari?.length > 0 && ( - <> -

{intl.formatMessage(messages.destinatari)}

- {content.destinatari.map((item, i) => ( -

{item.title}

- ))} - - )} + {/* ENTE DEL BANDO */} - {content?.ente_bando?.length > 0 && ( - <> -

{intl.formatMessage(messages.ente)}

- {content.ente_bando.map((item, i) => ( - - {item} - {i < content.ente_bando.length - 1 ? ', ' : ''} - - ))} - - )} + ) : ( <> diff --git a/src/components/ItaliaTheme/View/BandoView/BandoTextDestinatari.jsx b/src/components/ItaliaTheme/View/BandoView/BandoTextDestinatari.jsx new file mode 100644 index 000000000..1e7f25797 --- /dev/null +++ b/src/components/ItaliaTheme/View/BandoView/BandoTextDestinatari.jsx @@ -0,0 +1,36 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { defineMessages, useIntl } from 'react-intl'; + +const messages = defineMessages({ + destinatari: { + id: 'bando_destinatari', + defaultMessage: 'Destinatari del bando', + }, +}); + +const BandoTextDestinatari = ({ content }) => { + const intl = useIntl(); + return content?.destinatari?.length > 0 ? ( + <> +

{intl.formatMessage(messages.destinatari)}

+ {content.destinatari.map((item, i) => ( +

{item.title}

+ ))} + + ) : ( + <> + ); +}; + +BandoTextDestinatari.propTypes = { + content: PropTypes.shape({ + destinatari: PropTypes.arrayOf( + PropTypes.shape({ + title: PropTypes.string, + token: PropTypes.string, + }), + ), + }).isRequired, +}; +export default BandoTextDestinatari; diff --git a/src/components/ItaliaTheme/View/BandoView/BandoTextEnte.jsx b/src/components/ItaliaTheme/View/BandoView/BandoTextEnte.jsx new file mode 100644 index 000000000..6fe30f893 --- /dev/null +++ b/src/components/ItaliaTheme/View/BandoView/BandoTextEnte.jsx @@ -0,0 +1,34 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { defineMessages, useIntl } from 'react-intl'; + +const messages = defineMessages({ + ente: { + id: 'bando_ente', + defaultMessage: 'Ente erogatore', + }, +}); + +const BandoTextEnte = ({ content }) => { + const intl = useIntl(); + return content?.ente_bando?.length > 0 ? ( + <> +

{intl.formatMessage(messages.ente)}

+ {content.ente_bando.map((item, i) => ( + + {item} + {i < content.ente_bando.length - 1 ? ', ' : ''} + + ))} + + ) : ( + <> + ); +}; + +BandoTextEnte.propTypes = { + content: PropTypes.shape({ + ente_bando: PropTypes.arrayOf(PropTypes.string), + }).isRequired, +}; +export default BandoTextEnte; diff --git a/src/components/ItaliaTheme/View/BandoView/BandoTextTipologia.jsx b/src/components/ItaliaTheme/View/BandoView/BandoTextTipologia.jsx new file mode 100644 index 000000000..d9a4ee065 --- /dev/null +++ b/src/components/ItaliaTheme/View/BandoView/BandoTextTipologia.jsx @@ -0,0 +1,32 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { defineMessages, useIntl } from 'react-intl'; + +const messages = defineMessages({ + tipologia_bando: { + id: 'tipologia_bando', + defaultMessage: 'Tipologia del bando', + }, +}); + +const BandoTextTipologia = ({ content }) => { + const intl = useIntl(); + return content?.tipologia_bando ? ( + <> +

{intl.formatMessage(messages.tipologia_bando)}

+ {content.tipologia_bando.title} + + ) : ( + <> + ); +}; + +BandoTextTipologia.propTypes = { + content: PropTypes.shape({ + tipologia_bando: PropTypes.shape({ + title: PropTypes.string, + token: PropTypes.string, + }), + }).isRequired, +}; +export default BandoTextTipologia;