io-sanita-theme 2.12.1 → 2.12.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.12.2](https://github.com/RedTurtle/io-sanita-theme/compare/2.12.1...2.12.2) (2025-04-18)
4
+
5
+ ### Bug Fixes
6
+
7
+ * Multilingual aggregation page url ([#82](https://github.com/RedTurtle/io-sanita-theme/issues/82)) ([a16e9e9](https://github.com/RedTurtle/io-sanita-theme/commit/a16e9e9b5f4bb3e1026eb53ef58e94e4ab5f5808))
8
+
3
9
  ## [2.12.1](https://github.com/RedTurtle/io-sanita-theme/compare/2.12.0...2.12.1) (2025-04-17)
4
10
 
5
11
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "io-sanita-theme",
3
- "version": "2.12.1",
3
+ "version": "2.12.2",
4
4
  "description": "io-sanita-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -8,11 +8,7 @@ import React from 'react';
8
8
  import { Card, CardBody, CardTitle, CardText, Badge } from 'design-react-kit';
9
9
  import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
10
10
  import { Icon } from 'io-sanita-theme/components';
11
-
12
- import {
13
- AGGREGATION_PAGE_ARGOMENTO,
14
- AGGREGATION_PAGE_TIPOLOGIA_UTENTE,
15
- } from 'io-sanita-theme/config/ioSanitaConfig';
11
+ import { getAggregationPageUrl } from 'io-sanita-theme/helpers/aggregation';
16
12
 
17
13
  import './cardTaxonomy.scss';
18
14
 
@@ -27,10 +23,7 @@ export const CardTaxonomy = ({
27
23
  type = 'topics', //topics,users
28
24
  }) => {
29
25
  const title = item.title ?? item.label;
30
- const href =
31
- (type === 'topics'
32
- ? AGGREGATION_PAGE_ARGOMENTO
33
- : AGGREGATION_PAGE_TIPOLOGIA_UTENTE) + item.value;
26
+ const href = getAggregationPageUrl(type, item.value);
34
27
 
35
28
  return (
36
29
  <Card
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { useIntl, defineMessages } from 'react-intl';
4
4
  import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
5
- import { AGGREGATION_PAGE_ARGOMENTO } from 'io-sanita-theme/config/ioSanitaConfig';
5
+ import { getAggregationPageUrl } from 'io-sanita-theme/helpers/aggregation';
6
6
 
7
7
  const messages = defineMessages({
8
8
  uo: { id: 'CardCategoryBottom_UO', defaultMessage: 'Unità operativa' },
@@ -53,7 +53,7 @@ const CardCategoryBottom = ({
53
53
  href={
54
54
  isEditMode
55
55
  ? '#'
56
- : AGGREGATION_PAGE_ARGOMENTO + display_category.token
56
+ : getAggregationPageUrl('topics', display_category.token)
57
57
  }
58
58
  >
59
59
  <span className="text">{display_category.title}</span>
@@ -149,7 +149,6 @@ const AggregationPage = ({ match, route, location }) => {
149
149
 
150
150
  return (
151
151
  <>
152
- {/* <Helmet title={title} /> */}
153
152
  <Helmet title={title} />
154
153
 
155
154
  <div className="container px-4 my-4 aggregation-page-view public-ui">
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
3
- import { AGGREGATION_PAGE_ARGOMENTO } from 'io-sanita-theme/config/ioSanitaConfig';
3
+ import { getAggregationPageUrl } from 'io-sanita-theme/helpers/aggregation';
4
4
  import { Chip, ChipLabel } from 'design-react-kit';
5
5
 
6
6
  const ParliamoDiWidgetView = ({ value, children, className }) => {
@@ -8,7 +8,7 @@ const ParliamoDiWidgetView = ({ value, children, className }) => {
8
8
  <div className="topics-view-widget">
9
9
  {value.map((item, i) => (
10
10
  <UniversalLink
11
- href={AGGREGATION_PAGE_ARGOMENTO + item.token}
11
+ href={getAggregationPageUrl('topics', item.token)}
12
12
  key={item.token}
13
13
  className="text-decoration-none me-2 d-inline-block"
14
14
  >
@@ -2,10 +2,9 @@ import React from 'react';
2
2
  import { defineMessages, useIntl } from 'react-intl';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Chip, ChipLabel } from 'design-react-kit';
5
-
5
+ import { getAggregationPageUrl } from 'io-sanita-theme/helpers/aggregation';
6
6
  import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
7
7
  import { Icon } from 'io-sanita-theme/components';
8
- import { AGGREGATION_PAGE_TIPOLOGIA_UTENTE } from 'io-sanita-theme/config/ioSanitaConfig';
9
8
 
10
9
  /**
11
10
  * TassonomiaUtenti view component class.
@@ -27,7 +26,10 @@ const TassonomiaUtenti = ({ content }) => {
27
26
 
28
27
  return (
29
28
  <UniversalLink
30
- href={AGGREGATION_PAGE_TIPOLOGIA_UTENTE + item.token}
29
+ href={getAggregationPageUrl(
30
+ 'a_chi_si_rivolge_tassonomia',
31
+ item.token,
32
+ )}
31
33
  key={item.token}
32
34
  className="text-decoration-none me-2 d-inline-block"
33
35
  //data-element="service-topic"
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { Chip, ChipLabel } from 'design-react-kit';
5
5
 
6
6
  import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
7
- import { AGGREGATION_PAGE_ARGOMENTO } from 'io-sanita-theme/config/ioSanitaConfig';
7
+ import { getAggregationPageUrl } from 'io-sanita-theme/helpers/aggregation';
8
8
 
9
9
  /**
10
10
  * Topics view component class.
@@ -34,7 +34,7 @@ const Topics = ({ content, titleTag = 'h3' }) => {
34
34
  </Tag>
35
35
  {list.map((item, i) => (
36
36
  <UniversalLink
37
- href={AGGREGATION_PAGE_ARGOMENTO + item.token}
37
+ href={getAggregationPageUrl('topics', item.token)}
38
38
  key={item.token}
39
39
  className="text-decoration-none me-2 d-inline-block"
40
40
  data-element="service-topic"
@@ -250,11 +250,11 @@ export default function applyConfig(config) {
250
250
  ...(config.settings['volto-feedback']
251
251
  ?.feedbackEnabledNonContentRoutes ?? []),
252
252
  {
253
- path: AGGREGATION_PAGE_TIPOLOGIA_UTENTE,
253
+ path: '/*' + AGGREGATION_PAGE_TIPOLOGIA_UTENTE,
254
254
  feedbackTitle: null /*usa il path per sapere quale tipologia è*/,
255
255
  },
256
256
  {
257
- path: AGGREGATION_PAGE_ARGOMENTO,
257
+ path: '/*' + AGGREGATION_PAGE_ARGOMENTO,
258
258
  feedbackTitle: null /*usa il path per sapere quale tipologia è*/,
259
259
  },
260
260
  ],
@@ -339,8 +339,8 @@ export default function applyConfig(config) {
339
339
  },
340
340
  {
341
341
  path: [
342
- AGGREGATION_PAGE_ARGOMENTO + ':id',
343
- AGGREGATION_PAGE_ARGOMENTO.replace(/\/+$/, ''),
342
+ '*' + AGGREGATION_PAGE_ARGOMENTO + ':id',
343
+ '*' + AGGREGATION_PAGE_ARGOMENTO.replace(/\/+$/, ''),
344
344
  ],
345
345
  component: AggregationPage,
346
346
  type: 'parliamo_di',
@@ -348,8 +348,8 @@ export default function applyConfig(config) {
348
348
  },
349
349
  {
350
350
  path: [
351
- AGGREGATION_PAGE_TIPOLOGIA_UTENTE + ':id',
352
- AGGREGATION_PAGE_TIPOLOGIA_UTENTE.replace(/\/+$/, ''),
351
+ '*' + AGGREGATION_PAGE_TIPOLOGIA_UTENTE + ':id',
352
+ '*' + AGGREGATION_PAGE_TIPOLOGIA_UTENTE.replace(/\/+$/, ''),
353
353
  ],
354
354
  component: AggregationPage,
355
355
  type: 'a_chi_si_rivolge_tassonomia',
@@ -0,0 +1,17 @@
1
+ import {
2
+ AGGREGATION_PAGE_ARGOMENTO,
3
+ AGGREGATION_PAGE_TIPOLOGIA_UTENTE,
4
+ } from 'io-sanita-theme/config/ioSanitaConfig';
5
+ import { useHomePath } from 'io-sanita-theme/helpers';
6
+
7
+ export const getAggregationPageUrl = (type, value) => {
8
+ const homepath = useHomePath();
9
+ let href =
10
+ homepath +
11
+ (type === 'topics'
12
+ ? AGGREGATION_PAGE_ARGOMENTO
13
+ : AGGREGATION_PAGE_TIPOLOGIA_UTENTE) +
14
+ value;
15
+ href = href.replaceAll('//', '/');
16
+ return href;
17
+ };