@eeacms/volto-cca-policy 0.3.34 → 0.3.36
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 +23 -0
- package/package.json +1 -1
- package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +8 -6
- package/src/components/manage/Blocks/CountryMapObservatory/Interactions.jsx +6 -2
- package/src/components/manage/Blocks/CountryProfileDetail/View.js +11 -1
- package/src/components/theme/Header/LanguageSwitch.jsx +75 -30
- package/src/constants.js +14 -12
- package/src/customizations/@plone/volto-slate/widgets/HtmlSlateWidget.jsx +2 -1
- package/src/customizations/@plone/volto-slate/widgets/README.md +13 -5
- package/src/index.js +3 -3
- package/theme/globals/site.overrides +67 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [0.3.36](https://github.com/eea/volto-cca-policy/compare/0.3.35...0.3.36) - 7 May 2025
|
|
8
|
+
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- style: Automated code fix [eea-jenkins - [`8c6a6ad`](https://github.com/eea/volto-cca-policy/commit/8c6a6adfb65e10eb4d2c85dc76883cfd64306063)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- Remove defineMessages [Tiberiu Ichim - [`86aa49c`](https://github.com/eea/volto-cca-policy/commit/86aa49c7c56029108862a4210cad2e81b08cbf40)]
|
|
16
|
+
- Show a message in non-en country profiles [Tiberiu Ichim - [`8d6842b`](https://github.com/eea/volto-cca-policy/commit/8d6842b1043d13d739b25da119803c4fb359b8dd)]
|
|
17
|
+
- Customize language bar [Tiberiu Ichim - [`f85ce9f`](https://github.com/eea/volto-cca-policy/commit/f85ce9f2f2fb9c594e66c3b26cd198819a05b58d)]
|
|
18
|
+
### [0.3.35](https://github.com/eea/volto-cca-policy/compare/0.3.34...0.3.35) - 6 May 2025
|
|
19
|
+
|
|
20
|
+
#### :house: Internal changes
|
|
21
|
+
|
|
22
|
+
- style: Automated code fix [eea-jenkins - [`3ee5c45`](https://github.com/eea/volto-cca-policy/commit/3ee5c45a2c6240ca4891b424278b66d36b097bd2)]
|
|
23
|
+
|
|
24
|
+
#### :hammer_and_wrench: Others
|
|
25
|
+
|
|
26
|
+
- Customize html widget to let it treat whitespace [Tiberiu Ichim - [`c587517`](https://github.com/eea/volto-cca-policy/commit/c58751740401480d5e87674cc1a16d9a010385be)]
|
|
27
|
+
- Refs #287349 - remove uk from observatory map dependency [Tripon Eugen - [`6b90a59`](https://github.com/eea/volto-cca-policy/commit/6b90a599a2aaa9c00b9b24625216c5c34e518075)]
|
|
28
|
+
- Refs #287349 - remove uk from observatory map eslint [Tripon Eugen - [`b535431`](https://github.com/eea/volto-cca-policy/commit/b5354318a41f03cc8d5dec9ae5a93cd8e1182d0d)]
|
|
29
|
+
- Refs #287349 - remove uk from observatory map [Tripon Eugen - [`d3d89dd`](https://github.com/eea/volto-cca-policy/commit/d3d89ddf80e63af63ebcc4a3a2eb538dce1eec3b)]
|
|
7
30
|
### [0.3.34](https://github.com/eea/volto-cca-policy/compare/0.3.33...0.3.34) - 6 May 2025
|
|
8
31
|
|
|
9
32
|
#### :bug: Bug Fixes
|
package/package.json
CHANGED
|
@@ -37,12 +37,14 @@ const CountryMapObservatoryView = (props) => {
|
|
|
37
37
|
setOverlaySource(new ol.source.Vector());
|
|
38
38
|
|
|
39
39
|
const features = new ol.format.GeoJSON().readFeatures(geofeatures);
|
|
40
|
-
const updateEuCountryNames = euCountryNames
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const updateEuCountryNames = euCountryNames
|
|
41
|
+
.map((countryName) => {
|
|
42
|
+
if ('Turkey' === countryName) {
|
|
43
|
+
countryName = 'Türkiye';
|
|
44
|
+
}
|
|
45
|
+
return countryName;
|
|
46
|
+
})
|
|
47
|
+
.filter((countryName) => countryName !== 'United Kingdom');
|
|
46
48
|
|
|
47
49
|
const filtered = features.filter((f) =>
|
|
48
50
|
updateEuCountryNames.includes(f.get('na')),
|
|
@@ -21,6 +21,10 @@ function setTooltipVisibility(node, label, event, visible) {
|
|
|
21
21
|
export const Interactions = ({ overlaySource, tooltipRef, onFeatureClick }) => {
|
|
22
22
|
const map = useMapContext().map;
|
|
23
23
|
|
|
24
|
+
const euCountryNamesFiltered = euCountryNames.filter(
|
|
25
|
+
(euCountryName) => euCountryName !== 'United Kingdom',
|
|
26
|
+
);
|
|
27
|
+
|
|
24
28
|
React.useEffect(() => {
|
|
25
29
|
if (!map) return;
|
|
26
30
|
|
|
@@ -40,7 +44,7 @@ export const Interactions = ({ overlaySource, tooltipRef, onFeatureClick }) => {
|
|
|
40
44
|
overlaySource.removeFeature(highlight);
|
|
41
45
|
} catch {}
|
|
42
46
|
}
|
|
43
|
-
if (feature &&
|
|
47
|
+
if (feature && euCountryNamesFiltered.includes(feature.get('na'))) {
|
|
44
48
|
overlaySource.addFeature(feature);
|
|
45
49
|
map.getTargetElement().style.cursor = 'pointer';
|
|
46
50
|
const node = tooltipRef.current;
|
|
@@ -64,7 +68,7 @@ export const Interactions = ({ overlaySource, tooltipRef, onFeatureClick }) => {
|
|
|
64
68
|
onFeatureClick(feature);
|
|
65
69
|
}
|
|
66
70
|
});
|
|
67
|
-
}, [map, overlaySource, tooltipRef, onFeatureClick]);
|
|
71
|
+
}, [map, overlaySource, tooltipRef, onFeatureClick, euCountryNamesFiltered]);
|
|
68
72
|
|
|
69
73
|
return null;
|
|
70
74
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TabPane, Tab, Accordion, Icon } from 'semantic-ui-react';
|
|
2
|
+
import { Message, TabPane, Tab, Accordion, Icon } from 'semantic-ui-react';
|
|
3
3
|
import CountryTabPane from './CountryTabPane';
|
|
4
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
5
|
|
|
5
6
|
import './styles.less';
|
|
6
7
|
|
|
@@ -10,6 +11,7 @@ export default function View(props) {
|
|
|
10
11
|
// );
|
|
11
12
|
const dataJson = props?.properties['@components']?.countryprofile?.html || {};
|
|
12
13
|
const [activePanes, setActivePanes] = React.useState({});
|
|
14
|
+
const isNonEN = props?.properties?.language !== 'en';
|
|
13
15
|
|
|
14
16
|
const panes = [];
|
|
15
17
|
if (dataJson?.menu) {
|
|
@@ -32,6 +34,14 @@ export default function View(props) {
|
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
36
|
<>
|
|
37
|
+
{isNonEN && (
|
|
38
|
+
<Message class="eea callout">
|
|
39
|
+
<FormattedMessage
|
|
40
|
+
id="officiallyInEnglish"
|
|
41
|
+
defaultMessage="Officially reported governmental information is only available in English"
|
|
42
|
+
/>
|
|
43
|
+
</Message>
|
|
44
|
+
)}
|
|
35
45
|
{dataJson.message_top ? (
|
|
36
46
|
<div class="eea callout">{dataJson.message_top}</div>
|
|
37
47
|
) : null}
|
|
@@ -7,10 +7,12 @@ import { flattenToAppURL } from '@plone/volto/helpers';
|
|
|
7
7
|
import config from '@plone/volto/registry';
|
|
8
8
|
import { Header } from '@eeacms/volto-eea-design-system/ui';
|
|
9
9
|
import cx from 'classnames';
|
|
10
|
+
import { FormattedMessage } from 'react-intl';
|
|
10
11
|
|
|
11
|
-
import { selectedLanguageAtom } from '../../../state';
|
|
12
12
|
import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg';
|
|
13
13
|
|
|
14
|
+
import { selectedLanguageAtom } from '../../../state';
|
|
15
|
+
|
|
14
16
|
export default function LanguageSwitch({ history }) {
|
|
15
17
|
const { eea } = config.settings;
|
|
16
18
|
const translations = useSelector(
|
|
@@ -43,6 +45,7 @@ export default function LanguageSwitch({ history }) {
|
|
|
43
45
|
});
|
|
44
46
|
};
|
|
45
47
|
|
|
48
|
+
// .filter((item) => eea.non_eu_langs.indexOf(item.code) !== -1)
|
|
46
49
|
return (
|
|
47
50
|
<Header.TopDropdownMenu
|
|
48
51
|
id="language-switcher"
|
|
@@ -61,37 +64,79 @@ export default function LanguageSwitch({ history }) {
|
|
|
61
64
|
role="listbox"
|
|
62
65
|
aria-label="language switcher"
|
|
63
66
|
>
|
|
64
|
-
{eea.languages
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
{eea.languages
|
|
68
|
+
.filter((item) => eea.non_eu_langs.indexOf(item.code) === -1)
|
|
69
|
+
.map((item, index) => {
|
|
70
|
+
const translated = (translations || []).some(
|
|
71
|
+
(obj) => obj.language === item.code,
|
|
72
|
+
);
|
|
73
|
+
const active = item.code === currentLang;
|
|
74
|
+
const disabled = !translated && !active;
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Dropdown.Item
|
|
78
|
+
className={cx({
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
active: active,
|
|
81
|
+
})}
|
|
82
|
+
as="li"
|
|
83
|
+
key={index}
|
|
84
|
+
text={
|
|
85
|
+
<span>
|
|
86
|
+
<span className="country-code">
|
|
87
|
+
{item.code.toUpperCase()}
|
|
88
|
+
</span>{' '}
|
|
89
|
+
{item.name}
|
|
90
|
+
</span>
|
|
91
|
+
}
|
|
92
|
+
onClick={(e) =>
|
|
93
|
+
disabled || active
|
|
94
|
+
? e.preventDefault()
|
|
95
|
+
: handlePageRedirect(item)
|
|
96
|
+
}
|
|
97
|
+
></Dropdown.Item>
|
|
98
|
+
);
|
|
99
|
+
})}
|
|
100
|
+
<strong className="noneu-langs-label">
|
|
101
|
+
<FormattedMessage
|
|
102
|
+
id="Non-EU Languages"
|
|
103
|
+
defaultMessage="Non-EU Languages"
|
|
104
|
+
/>
|
|
105
|
+
</strong>
|
|
106
|
+
|
|
107
|
+
{eea.languages
|
|
108
|
+
.filter((item) => eea.non_eu_langs.indexOf(item.code) !== -1)
|
|
109
|
+
.map((item, index) => {
|
|
110
|
+
const translated = (translations || []).some(
|
|
111
|
+
(obj) => obj.language === item.code,
|
|
112
|
+
);
|
|
113
|
+
const active = item.code === currentLang;
|
|
114
|
+
const disabled = !translated && !active;
|
|
70
115
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{
|
|
116
|
+
return (
|
|
117
|
+
<Dropdown.Item
|
|
118
|
+
className={cx({
|
|
119
|
+
disabled: disabled,
|
|
120
|
+
active: active,
|
|
121
|
+
})}
|
|
122
|
+
as="li"
|
|
123
|
+
key={index}
|
|
124
|
+
text={
|
|
125
|
+
<span>
|
|
126
|
+
<span className="country-code">
|
|
127
|
+
{item.code.toUpperCase()}
|
|
128
|
+
</span>{' '}
|
|
129
|
+
{item.name}
|
|
84
130
|
</span>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
94
|
-
})}
|
|
131
|
+
}
|
|
132
|
+
onClick={(e) =>
|
|
133
|
+
disabled || active
|
|
134
|
+
? e.preventDefault()
|
|
135
|
+
: handlePageRedirect(item)
|
|
136
|
+
}
|
|
137
|
+
></Dropdown.Item>
|
|
138
|
+
);
|
|
139
|
+
})}
|
|
95
140
|
</ul>
|
|
96
141
|
</Header.TopDropdownMenu>
|
|
97
142
|
);
|
package/src/constants.js
CHANGED
|
@@ -21,31 +21,33 @@ export const download_fields = [
|
|
|
21
21
|
];
|
|
22
22
|
|
|
23
23
|
export const eea_languages = [
|
|
24
|
-
{ name: 'English', code: 'en' },
|
|
25
24
|
{ name: 'български', code: 'bg' },
|
|
26
25
|
{ name: 'Español', code: 'es' },
|
|
27
|
-
|
|
26
|
+
{ name: 'Čeština', code: 'cs' },
|
|
28
27
|
{ name: 'Dansk', code: 'da' },
|
|
29
28
|
{ name: 'Deutsch', code: 'de' },
|
|
30
|
-
|
|
29
|
+
{ name: 'Eesti keel', code: 'et' },
|
|
31
30
|
{ name: 'Ελληνικά', code: 'el' },
|
|
31
|
+
{ name: 'English', code: 'en' },
|
|
32
32
|
{ name: 'Français', code: 'fr' },
|
|
33
|
-
|
|
33
|
+
{ name: 'Gaeilge', code: 'ga' },
|
|
34
34
|
{ name: 'Hrvatski', code: 'hr' },
|
|
35
35
|
{ name: 'Italiano', code: 'it' },
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
{ name: 'Latviešu', code: 'lv' },
|
|
37
|
+
{ name: 'Lietuvių', code: 'lt' },
|
|
38
|
+
{ name: 'Magyar', code: 'hu' },
|
|
39
|
+
{ name: 'Malti', code: 'mt' },
|
|
40
|
+
{ name: 'Nederlands', code: 'nl' },
|
|
41
41
|
{ name: 'Polski', code: 'pl' },
|
|
42
42
|
{ name: 'Português', code: 'pt' },
|
|
43
43
|
{ name: 'Română', code: 'ro' },
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
{ name: 'Slovenčina', code: 'sk' },
|
|
45
|
+
{ name: 'Slovenščina', code: 'sl' },
|
|
46
46
|
{ name: 'Suomi', code: 'fi' },
|
|
47
47
|
{ name: 'Svenska', code: 'sv' },
|
|
48
48
|
{ name: 'Íslenska', code: 'is' },
|
|
49
49
|
{ name: 'Nynorsk', code: 'nn' },
|
|
50
|
-
|
|
50
|
+
{ name: 'Türkçe', code: 'tr' },
|
|
51
51
|
];
|
|
52
|
+
|
|
53
|
+
export const non_eu_langs = ['is', 'nn', 'tr'];
|
|
@@ -80,7 +80,8 @@ const HtmlSlateWidget = (props) => {
|
|
|
80
80
|
parsed.getElementsByTagName('google-sheets-html-origin').length > 0
|
|
81
81
|
? parsed.querySelector('google-sheets-html-origin > table')
|
|
82
82
|
: parsed.body;
|
|
83
|
-
let data = deserialize(editor, body, { collapseWhitespace:
|
|
83
|
+
let data = deserialize(editor, body, { collapseWhitespace: true });
|
|
84
|
+
// console.log({ data, parsed, body, html });
|
|
84
85
|
if (data.length) {
|
|
85
86
|
data = normalizeExternalData(editor, data);
|
|
86
87
|
} else {
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
# Customizations
|
|
2
|
+
|
|
1
3
|
Customized for this
|
|
2
4
|
|
|
5
|
+
```js
|
|
6
|
+
if (data.length) {
|
|
7
|
+
data = normalizeExternalData(editor, data);
|
|
8
|
+
} else {
|
|
9
|
+
return [createEmptyParagraph()];
|
|
10
|
+
}
|
|
3
11
|
```
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
|
|
13
|
+
and this:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
let data = deserialize(editor, body, { collapseWhitespace: true });
|
|
9
17
|
```
|
package/src/index.js
CHANGED
|
@@ -43,7 +43,7 @@ import eeaWhiteLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/as
|
|
|
43
43
|
import './slate-styles.less';
|
|
44
44
|
import BrokenLinks from './components/theme/Views/BrokenLinks';
|
|
45
45
|
|
|
46
|
-
import { eea_languages } from './constants';
|
|
46
|
+
import { eea_languages, non_eu_langs } from './constants';
|
|
47
47
|
|
|
48
48
|
const getEnv = () => (typeof window !== 'undefined' ? window.env : process.env);
|
|
49
49
|
|
|
@@ -109,13 +109,12 @@ const applyConfig = (config) => {
|
|
|
109
109
|
config.settings.hasLanguageDropdown = true;
|
|
110
110
|
config.settings.defaultLanguage = 'en';
|
|
111
111
|
config.settings.supportedLanguages = [
|
|
112
|
-
'en',
|
|
113
|
-
|
|
114
112
|
'bg', // bulgarian
|
|
115
113
|
'es', // spanish
|
|
116
114
|
'cs', // czech
|
|
117
115
|
'da', // danish
|
|
118
116
|
'de', // german
|
|
117
|
+
'en',
|
|
119
118
|
'et', // estonian
|
|
120
119
|
'el', // greek
|
|
121
120
|
'fr', // french
|
|
@@ -145,6 +144,7 @@ const applyConfig = (config) => {
|
|
|
145
144
|
config.settings.eea = {
|
|
146
145
|
...(config.settings.eea || {}),
|
|
147
146
|
languages: eea_languages,
|
|
147
|
+
non_eu_langs,
|
|
148
148
|
headerOpts: {
|
|
149
149
|
...(config.settings.eea?.headerOpts || {}),
|
|
150
150
|
logo: ccaLogo,
|
|
@@ -49,13 +49,13 @@ p.has--clear--both:empty {
|
|
|
49
49
|
.ui.items > .item > .image > img {
|
|
50
50
|
width: auto;
|
|
51
51
|
}
|
|
52
|
-
.ui.items > .item > .image + .content{
|
|
52
|
+
.ui.items > .item > .image + .content {
|
|
53
53
|
padding-left: 1rem;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.ui.items > .item .ui.middle.aligned.image {
|
|
57
57
|
display: flex;
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
img {
|
|
60
60
|
align-self: center;
|
|
61
61
|
}
|
|
@@ -258,3 +258,68 @@ iframe {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
+
|
|
262
|
+
// language dropdown
|
|
263
|
+
.top.bar {
|
|
264
|
+
.ui.container {
|
|
265
|
+
.wrapper.language-list {
|
|
266
|
+
/* display: flex; */
|
|
267
|
+
/* flex-direction: column; */
|
|
268
|
+
margin: 0.25rem 0;
|
|
269
|
+
gap: 0.25rem;
|
|
270
|
+
white-space: pre-wrap;
|
|
271
|
+
|
|
272
|
+
display: grid;
|
|
273
|
+
grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
|
|
274
|
+
grid-auto-flow: column;
|
|
275
|
+
grid-auto-rows: auto;
|
|
276
|
+
grid-template-rows: repeat(10, auto);
|
|
277
|
+
|
|
278
|
+
.menu {
|
|
279
|
+
cursor: auto;
|
|
280
|
+
position: absolute;
|
|
281
|
+
display: none;
|
|
282
|
+
outline: none;
|
|
283
|
+
top: 100%;
|
|
284
|
+
min-width: -moz-max-content;
|
|
285
|
+
min-width: max-content;
|
|
286
|
+
margin: 0;
|
|
287
|
+
padding: 0;
|
|
288
|
+
background: #fff;
|
|
289
|
+
font-size: 1em;
|
|
290
|
+
text-shadow: none;
|
|
291
|
+
text-align: left;
|
|
292
|
+
box-shadow: 0 2px 3px 0 #e6e7e8;
|
|
293
|
+
border: 1px solid #e6e7e8;
|
|
294
|
+
border-radius: 0;
|
|
295
|
+
transition: opacity 0.1s ease;
|
|
296
|
+
z-index: 11;
|
|
297
|
+
will-change: transform, opacity;
|
|
298
|
+
|
|
299
|
+
max-width: 100%;
|
|
300
|
+
width: fit-content;
|
|
301
|
+
}
|
|
302
|
+
.item {
|
|
303
|
+
padding-left: 0.8em;
|
|
304
|
+
min-width: 10em;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.noneu-langs-label {
|
|
308
|
+
// border-bottom: 1px solid black;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
#language-switcher .menu .wrapper .item {
|
|
315
|
+
justify-content: flex-start !important;
|
|
316
|
+
font-weight: 400;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
@media (max-width: 768px) {
|
|
320
|
+
.top.bar .ui.dropdown .wrapper {
|
|
321
|
+
display: flex;
|
|
322
|
+
flex-direction: column;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// end language dropdown
|