design-comuni-plone-theme 11.24.5 → 11.24.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
 
2
2
 
3
+ ## [11.24.6](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v11.24.5...v11.24.6) (2024-11-22)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * removed getContent from Documento, Bando, Argomento and LocationsMap ([#803](https://github.com/RedTurtle/design-comuni-plone-theme/issues/803)) ([ca1f0f0](https://github.com/RedTurtle/design-comuni-plone-theme/commit/ca1f0f0b0e8b02d2a50d420e2aa371c97517a8f9))
9
+
10
+
11
+ ### Documentation
12
+
13
+ * updated publiccode ([ebcf3d0](https://github.com/RedTurtle/design-comuni-plone-theme/commit/ebcf3d05408cc5e175e9f610ba752b53d28082b9))
14
+
3
15
  ## [11.24.5](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v11.24.4...v11.24.5) (2024-11-22)
4
16
 
5
17
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "design-comuni-plone-theme",
3
3
  "description": "Volto Theme for Italia design guidelines",
4
4
  "license": "GPL-v3",
5
- "version": "11.24.5",
5
+ "version": "11.24.6",
6
6
  "main": "src/index.js",
7
7
  "repository": {
8
8
  "type": "git",
package/publiccode.yml CHANGED
@@ -229,7 +229,7 @@ platforms:
229
229
  - web
230
230
  releaseDate: '2024-11-22'
231
231
  softwareType: standalone/web
232
- softwareVersion: 11.24.5
232
+ softwareVersion: 11.24.6
233
233
  url: 'https://github.com/italia/design-comuni-plone-theme'
234
234
  usedBy:
235
235
  - ASP Comuni Modenesi Area Nord
@@ -34,7 +34,7 @@ const BandoApprofondimenti = ({ content }) => {
34
34
  />
35
35
  // item={item} viene utilizzato nelle customizzazioni per ottenere altre proprietà
36
36
  );
37
- } else if (item.type === 'Link') {
37
+ } else if (item.type === 'Collegamento') {
38
38
  return (
39
39
  <Card
40
40
  className="card card-teaser shadow p-4 mt-3 rounded attachment"
@@ -1,7 +1,5 @@
1
- import { useDispatch, useSelector } from 'react-redux';
2
- import React, { useEffect } from 'react';
1
+ import React from 'react';
3
2
  import { useIntl, defineMessages } from 'react-intl';
4
- import { getContent, resetContent } from '@plone/volto/actions';
5
3
  import { flattenToAppURL } from '@plone/volto/helpers';
6
4
  import { OSMMap } from 'volto-venue';
7
5
  import PropTypes from 'prop-types';
@@ -30,9 +28,7 @@ const messages = defineMessages({
30
28
  });
31
29
 
32
30
  const LocationsMap = ({ center, locations }) => {
33
- const dispatch = useDispatch();
34
31
  const intl = useIntl();
35
- const fetchedLocations = useSelector((state) => state.content.subrequests);
36
32
  const venues = locations.map((location) => {
37
33
  let url = flattenToAppURL(location['@id']);
38
34
  return {
@@ -41,18 +37,6 @@ const LocationsMap = ({ center, locations }) => {
41
37
  };
42
38
  });
43
39
 
44
- useEffect(() => {
45
- venues.forEach((loc) => {
46
- dispatch(getContent(loc.url, null, loc.key));
47
- });
48
-
49
- return () =>
50
- venues.forEach((loc) => {
51
- dispatch(resetContent(loc.key));
52
- });
53
- // eslint-disable-next-line react-hooks/exhaustive-deps
54
- }, [dispatch, locations]);
55
-
56
40
  const pinContent = (item) => {
57
41
  return (
58
42
  <div className="map-pin-popup">
@@ -97,7 +81,9 @@ const LocationsMap = ({ center, locations }) => {
97
81
  };
98
82
 
99
83
  let venuesData = venues.reduce((acc, val) => {
100
- let venue = fetchedLocations?.[val.key]?.data;
84
+ let venue = locations.find((el) => {
85
+ return el['@id'].includes(val.url);
86
+ });
101
87
 
102
88
  if (venue?.geolocation?.latitude && venue?.geolocation?.longitude) {
103
89
  return [
@@ -3,12 +3,9 @@
3
3
  * @module components/theme/View/DocumentoView/Modules
4
4
  */
5
5
 
6
- import React, { useEffect } from 'react';
7
- import { useDispatch, useSelector } from 'react-redux';
6
+ import React from 'react';
8
7
  import PropTypes from 'prop-types';
9
- import { flattenToAppURL } from '@plone/volto/helpers';
10
8
  import { UniversalLink } from '@plone/volto/components';
11
- import { getContent, resetContent } from '@plone/volto/actions';
12
9
 
13
10
  import { Card, CardBody, CardTitle } from 'design-react-kit';
14
11
 
@@ -21,20 +18,7 @@ import { DownloadFileFormat } from 'design-comuni-plone-theme/components/ItaliaT
21
18
  * @returns {string} Markup of the component.
22
19
  */
23
20
  const Module = ({ item }) => {
24
- const dispatch = useDispatch();
25
- const subrequests = useSelector((state) => state.content.subrequests);
26
- const url = flattenToAppURL(item['@id']);
27
- const key = 'module_' + url;
28
-
29
- useEffect(() => {
30
- dispatch(getContent(url, null, key));
31
- return () => dispatch(resetContent(key));
32
- // eslint-disable-next-line react-hooks/exhaustive-deps
33
- }, [key]);
34
-
35
- let modulo = subrequests?.[key]?.data;
36
-
37
- return modulo ? (
21
+ return item ? (
38
22
  <Card
39
23
  className="card card-teaser shadow p-4 mt-3 rounded modulo"
40
24
  noWrapper={true}
@@ -42,37 +26,38 @@ const Module = ({ item }) => {
42
26
  >
43
27
  <CardBody tag="div">
44
28
  <CardTitle className="h5">
45
- {modulo.file_principale ? (
46
- <a
47
- href={flattenToAppURL(modulo.file_principale.download)}
48
- title={modulo.title ?? modulo.file_principale.filename}
49
- >
50
- {modulo.title ?? modulo.file_principale.filename}
51
- </a>
52
- ) : modulo['@type'] === 'Link' ? (
53
- <UniversalLink item={modulo} title={modulo.title}>
54
- {modulo.title}
29
+ {item.file_principale ? (
30
+ item.title ?? item.file_principale.filename
31
+ ) : item['@type'] === 'Link' ? (
32
+ <UniversalLink item={item} title={item.title}>
33
+ {item.title}
55
34
  </UniversalLink>
56
35
  ) : (
57
- modulo.title
36
+ item.title
58
37
  )}
59
38
  </CardTitle>
60
39
 
61
- {modulo.description && <p>{modulo.description}</p>}
40
+ {item.description && <p>{item.description}</p>}
62
41
  <div className="download-formats">
63
42
  <DownloadFileFormat
64
- file={modulo.file_principale}
43
+ file={item.file_principale}
65
44
  showLabel={true}
45
+ title={item.title ?? item.file_principale.filename}
46
+ hideFileFormatLabel={true}
66
47
  className="mb-4"
67
48
  />
68
49
  <DownloadFileFormat
69
- file={modulo.formato_alternativo_1}
50
+ file={item.formato_alternativo_1}
70
51
  showLabel={true}
52
+ title={item.title ?? item.formato_alternativo_1.filename}
53
+ hideFileFormatLabel={true}
71
54
  className="mb-4"
72
55
  />
73
56
  <DownloadFileFormat
74
- file={modulo.formato_alternativo_2}
57
+ file={item.formato_alternativo_2}
75
58
  showLabel={true}
59
+ title={item.title ?? item.formato_alternativo_2.filename}
60
+ hideFileFormatLabel={true}
76
61
  />
77
62
  </div>
78
63
  </CardBody>
@@ -18,7 +18,9 @@ import {
18
18
  */
19
19
  const Modules = ({ content, title, id = 'documenti' }) => {
20
20
  const moduli =
21
- content.items?.filter((item) => item.id !== 'multimedia') ?? [];
21
+ content.moduli_del_documento ??
22
+ content.items?.filter((item) => item.id !== 'multimedia') ??
23
+ [];
22
24
 
23
25
  return moduli.length > 0 ? (
24
26
  <RichTextSection tag_id={id} title={title}>
@@ -3,9 +3,8 @@
3
3
  * @module components/theme/View/PaginaArgomentoView/PaginaArgomentoView
4
4
  */
5
5
 
6
- import React, { useEffect } from 'react';
6
+ import React from 'react';
7
7
  import { useLocation } from 'react-router-dom';
8
- import { useDispatch, useSelector } from 'react-redux';
9
8
  import { Portal } from 'react-portal';
10
9
  import cx from 'classnames';
11
10
 
@@ -16,7 +15,6 @@ import {
16
15
  flattenToAppURL,
17
16
  hasBlocksData,
18
17
  } from '@plone/volto/helpers';
19
- import { getContent, resetContent } from '@plone/volto/actions';
20
18
  import {
21
19
  CardCategory,
22
20
  Breadcrumbs,
@@ -44,32 +42,6 @@ import config from '@plone/volto/registry';
44
42
  const PaginaArgomentoView = ({ content }) => {
45
43
  const Image = config.getComponent({ name: 'Image' }).component;
46
44
  const location = useLocation();
47
- const dispatch = useDispatch();
48
-
49
- const searchResults = useSelector((state) => state.content?.subrequests);
50
-
51
- // one request is made for every 'unita_amministrative_responsabili' selected
52
- useEffect(() => {
53
- if (content?.unita_amministrative_responsabili?.length > 0) {
54
- content.unita_amministrative_responsabili.forEach((x) => {
55
- const url = flattenToAppURL(x['@id']);
56
- const loaded =
57
- searchResults?.[url]?.loading || searchResults?.[url]?.loaded;
58
- if (!loaded) {
59
- dispatch(getContent(url, null, url));
60
- }
61
- });
62
- }
63
-
64
- return () => {
65
- if (content?.unita_amministrative_responsabili?.length > 0) {
66
- content.unita_amministrative_responsabili.forEach((x) => {
67
- dispatch(resetContent(flattenToAppURL(x['@id'])));
68
- });
69
- }
70
- };
71
- // eslint-disable-next-line react-hooks/exhaustive-deps
72
- }, [content]);
73
45
 
74
46
  const rightHeaderHasContent =
75
47
  richTextHasContent(content.ulteriori_informazioni) ||
@@ -99,12 +71,17 @@ const PaginaArgomentoView = ({ content }) => {
99
71
 
100
72
  {content?.unita_amministrative_responsabili?.length > 0 &&
101
73
  content?.unita_amministrative_responsabili?.map((u, index) => {
102
- const uo_object =
103
- searchResults[flattenToAppURL(u['@id'])]?.data;
74
+ const uo_object = u;
104
75
  let alt = u.title;
105
- if (uo_object?.preview_image && uo_object?.preview_caption) {
76
+ if (
77
+ uo_object.image_scales.preview_image.length > 0 &&
78
+ uo_object?.preview_caption
79
+ ) {
106
80
  alt = uo_object.preview_caption;
107
- } else if (uo_object?.image && uo_object?.image_caption) {
81
+ } else if (
82
+ uo_object.image_scales.image.length > 0 &&
83
+ uo_object?.image_caption
84
+ ) {
108
85
  alt = uo_object.image_caption;
109
86
  }
110
87
 
@@ -132,7 +109,9 @@ const PaginaArgomentoView = ({ content }) => {
132
109
  </CardText>
133
110
  </CardBody>
134
111
  {uo_object &&
135
- (uo_object.preview_image || uo_object.image) && (
112
+ (uo_object.image_scales.image.length > 0 ||
113
+ uo_object.image_scales.preview_image.length >
114
+ 0) && (
136
115
  <div className="image-container me-3">
137
116
  <Image
138
117
  item={uo_object}