@eeacms/volto-cca-policy 0.2.36 → 0.2.37
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 +12 -0
- package/package.json +3 -1
- package/src/components/theme/Views/C3SIndicatorView.jsx +97 -93
- package/src/components/theme/Views/DatabaseItemView.jsx +48 -23
- package/src/components/theme/Views/DatabaseItemView.test.jsx +6 -0
- package/src/helpers/Constants.jsx +5 -5
- package/theme/globals/blocks.less +2 -1
- package/theme/globals/views.less +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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.2.37](https://github.com/eea/volto-cca-policy/compare/0.2.36...0.2.37) - 29 May 2024
|
|
8
|
+
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- chore: add @eeacms/volto-embed to dependencies [kreafox - [`87293f1`](https://github.com/eea/volto-cca-policy/commit/87293f13c43fba395b3d247cbe1490285a0ea18b)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- test: update snapshot [kreafox - [`f25b1b6`](https://github.com/eea/volto-cca-policy/commit/f25b1b643a96a7bbf7765442dd496334b497fdfa)]
|
|
16
|
+
- Code cleanup [Tiberiu Ichim - [`9867b7b`](https://github.com/eea/volto-cca-policy/commit/9867b7b19bdd124559ab03da8efdacf55dfbb446)]
|
|
17
|
+
- Code cleanup [Tiberiu Ichim - [`955176a`](https://github.com/eea/volto-cca-policy/commit/955176a0fdacb57c890164330ce3f898a7bd6769)]
|
|
18
|
+
- test: mock volto-embed [kreafox - [`6396e9d`](https://github.com/eea/volto-cca-policy/commit/6396e9d89817a10b1fb57c2dcd8a2f651148b846)]
|
|
7
19
|
### [0.2.36](https://github.com/eea/volto-cca-policy/compare/0.2.35...0.2.36) - 28 May 2024
|
|
8
20
|
|
|
9
21
|
#### :nail_care: Enhancements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-cca-policy",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.37",
|
|
4
4
|
"description": "@eeacms/volto-cca-policy: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@eeacms/volto-eea-design-system",
|
|
24
24
|
"@eeacms/volto-eea-website-theme",
|
|
25
25
|
"@eeacms/volto-tabs-block",
|
|
26
|
+
"@eeacms/volto-embed",
|
|
26
27
|
"@eeacms/volto-globalsearch"
|
|
27
28
|
],
|
|
28
29
|
"dependencies": {
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
"@eeacms/volto-datablocks": "*",
|
|
31
32
|
"@eeacms/volto-eea-design-system": "*",
|
|
32
33
|
"@eeacms/volto-eea-website-theme": "^1.33.2",
|
|
34
|
+
"@eeacms/volto-embed": "9.1.1",
|
|
33
35
|
"@eeacms/volto-globalsearch": "^1.1.0",
|
|
34
36
|
"@eeacms/volto-openlayers-map": "*",
|
|
35
37
|
"@eeacms/volto-searchlib": "^0.9.3",
|
|
@@ -59,36 +59,6 @@ const createIframe = (div_id, details_url, details_params, spinner_url) => {
|
|
|
59
59
|
/>`;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
const Details = (props) => {
|
|
63
|
-
const { content } = props;
|
|
64
|
-
const { details_app_toolbox_url, details_app_parameters } = content;
|
|
65
|
-
|
|
66
|
-
const c3s_details_url = details_app_toolbox_url;
|
|
67
|
-
const c3s_details_params = JSON.stringify(details_app_parameters).replace(
|
|
68
|
-
/"/g,
|
|
69
|
-
"'",
|
|
70
|
-
); // we avoid double quotes in iframe text
|
|
71
|
-
const [spinnerUrl, setSpinnerUrl] = useState(null);
|
|
72
|
-
|
|
73
|
-
React.useEffect(() => {
|
|
74
|
-
setSpinnerUrl(spinner);
|
|
75
|
-
}, []);
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<div
|
|
79
|
-
className="iframe-container"
|
|
80
|
-
dangerouslySetInnerHTML={{
|
|
81
|
-
__html: createIframe(
|
|
82
|
-
'toolbox-app-details',
|
|
83
|
-
c3s_details_url,
|
|
84
|
-
c3s_details_params,
|
|
85
|
-
spinnerUrl,
|
|
86
|
-
),
|
|
87
|
-
}}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
62
|
const Overview = (props) => {
|
|
93
63
|
const { content } = props;
|
|
94
64
|
const { overview_app_toolbox_url, overview_app_parameters } = content;
|
|
@@ -105,7 +75,7 @@ const Overview = (props) => {
|
|
|
105
75
|
|
|
106
76
|
return (
|
|
107
77
|
<div
|
|
108
|
-
className="iframe-container"
|
|
78
|
+
className="iframe-container div-chart-container"
|
|
109
79
|
dangerouslySetInnerHTML={{
|
|
110
80
|
__html: createIframe(
|
|
111
81
|
'toolbox-app-overview',
|
|
@@ -123,26 +93,36 @@ function C3SIndicatorView(props) {
|
|
|
123
93
|
const {
|
|
124
94
|
definition_app,
|
|
125
95
|
long_description,
|
|
126
|
-
indicator_title,
|
|
96
|
+
// indicator_title,
|
|
127
97
|
title,
|
|
128
98
|
logo,
|
|
99
|
+
// c3sjs_overview,
|
|
129
100
|
} = content;
|
|
101
|
+
// console.log('c3sjs_overview', c3sjs_overview, props);
|
|
130
102
|
const [showDetails, setShowDetails] = useState(false);
|
|
131
|
-
const hasIndicatorTitle =
|
|
132
|
-
|
|
103
|
+
// const hasIndicatorTitle =
|
|
104
|
+
// indicator_title && indicator_title !== '_' && indicator_title !== '-';
|
|
133
105
|
|
|
134
|
-
const [
|
|
106
|
+
const [activeAccordion, setActiveAccordion] = React.useState([true, false]);
|
|
135
107
|
|
|
136
|
-
function
|
|
137
|
-
const
|
|
138
|
-
|
|
108
|
+
function handleAccordionClick(e, index) {
|
|
109
|
+
const _activeAccordion = JSON.parse(JSON.stringify(activeAccordion));
|
|
110
|
+
_activeAccordion[index] = !_activeAccordion[index];
|
|
139
111
|
|
|
140
|
-
|
|
112
|
+
setActiveAccordion(_activeAccordion);
|
|
141
113
|
}
|
|
142
114
|
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
115
|
+
const [showMode, setShowMode] = React.useState('normal');
|
|
116
|
+
|
|
117
|
+
function handleShowModeClick(e, mode) {
|
|
118
|
+
setShowMode(mode);
|
|
119
|
+
setActiveAccordion(mode === 'full' ? [false, false] : [true, false]);
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// const toggleIframe = () => {
|
|
124
|
+
// setShowDetails(!showDetails);
|
|
125
|
+
// };
|
|
146
126
|
|
|
147
127
|
useEffect(() => {
|
|
148
128
|
if (window.location.hash === '#details') {
|
|
@@ -173,7 +153,7 @@ function C3SIndicatorView(props) {
|
|
|
173
153
|
}}
|
|
174
154
|
/>
|
|
175
155
|
|
|
176
|
-
<Container>
|
|
156
|
+
<Container className="">
|
|
177
157
|
<PortalMessage content={content} />
|
|
178
158
|
<LogoWrapper logo={logo}>
|
|
179
159
|
<h2>
|
|
@@ -191,62 +171,86 @@ function C3SIndicatorView(props) {
|
|
|
191
171
|
)}
|
|
192
172
|
</LogoWrapper>
|
|
193
173
|
|
|
194
|
-
<
|
|
174
|
+
<Accordion id="background" key="background" className="secondary">
|
|
175
|
+
<Accordion.Title
|
|
176
|
+
role="button"
|
|
177
|
+
tabIndex={0}
|
|
178
|
+
active={activeAccordion[0]}
|
|
179
|
+
aria-expanded={activeAccordion[0]}
|
|
180
|
+
index={1}
|
|
181
|
+
onClick={(e) => handleAccordionClick(e, 0)}
|
|
182
|
+
onKeyDown={(e) => {
|
|
183
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
handleAccordionClick(e, 0);
|
|
186
|
+
}
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
<span className="item-title">Background Information</span>
|
|
190
|
+
{activeAccordion[0] ? (
|
|
191
|
+
<Icon className="ri-arrow-up-s-line" />
|
|
192
|
+
) : (
|
|
193
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
194
|
+
)}
|
|
195
|
+
</Accordion.Title>
|
|
196
|
+
<Accordion.Content active={activeAccordion[0]}>
|
|
197
|
+
<HTMLField value={long_description} />
|
|
198
|
+
</Accordion.Content>
|
|
199
|
+
</Accordion>
|
|
200
|
+
<Accordion id="visualisation" key="visualisation" className="secondary">
|
|
201
|
+
<Accordion.Title
|
|
202
|
+
role="button"
|
|
203
|
+
tabIndex={0}
|
|
204
|
+
active={activeAccordion[1]}
|
|
205
|
+
aria-expanded={activeAccordion[1]}
|
|
206
|
+
index={1}
|
|
207
|
+
onClick={(e) => handleAccordionClick(e, 1)}
|
|
208
|
+
onKeyDown={(e) => {
|
|
209
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
handleAccordionClick(e, 1);
|
|
212
|
+
}
|
|
213
|
+
}}
|
|
214
|
+
>
|
|
215
|
+
<span className="item-title">Visualisation and Navigation</span>
|
|
216
|
+
{activeAccordion[1] ? (
|
|
217
|
+
<Icon className="ri-arrow-up-s-line" />
|
|
218
|
+
) : (
|
|
219
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
220
|
+
)}
|
|
221
|
+
</Accordion.Title>
|
|
222
|
+
<Accordion.Content active={activeAccordion[1]}>
|
|
223
|
+
<HTMLField value={definition_app} />
|
|
224
|
+
</Accordion.Content>
|
|
225
|
+
</Accordion>
|
|
195
226
|
|
|
196
227
|
<div className="c3s-buttons">
|
|
197
|
-
|
|
198
|
-
<
|
|
199
|
-
{
|
|
200
|
-
<FormattedMessage id="
|
|
201
|
-
|
|
228
|
+
{showMode === 'normal' ? (
|
|
229
|
+
<a href="#details">
|
|
230
|
+
<Button primary onClick={(_e) => handleShowModeClick(_e, 'full')}>
|
|
231
|
+
<FormattedMessage id="Fullscreen" defaultMessage="Fullscreen" />
|
|
232
|
+
</Button>
|
|
233
|
+
</a>
|
|
234
|
+
) : (
|
|
235
|
+
<Link to={window.location.pathname}>
|
|
236
|
+
<Button
|
|
237
|
+
primary
|
|
238
|
+
onClick={(_e) => handleShowModeClick(_e, 'normal')}
|
|
239
|
+
>
|
|
202
240
|
<FormattedMessage
|
|
203
|
-
id="
|
|
204
|
-
defaultMessage="
|
|
241
|
+
id="Exit fullscreen"
|
|
242
|
+
defaultMessage="Exit fullscreen"
|
|
205
243
|
/>
|
|
206
|
-
|
|
207
|
-
</
|
|
208
|
-
|
|
209
|
-
<Link to="/knowledge/european-climate-data-explorer/">
|
|
210
|
-
<Button primary>
|
|
211
|
-
<FormattedMessage
|
|
212
|
-
id="ECDE homepage"
|
|
213
|
-
defaultMessage="ECDE homepage"
|
|
214
|
-
/>
|
|
215
|
-
</Button>
|
|
216
|
-
</Link>
|
|
217
|
-
</div>
|
|
218
|
-
|
|
219
|
-
{definition_app && !hasIndicatorTitle && (
|
|
220
|
-
<Accordion>
|
|
221
|
-
<Accordion.Title
|
|
222
|
-
className="accordion-title "
|
|
223
|
-
active={activeAccIndex === 0}
|
|
224
|
-
index={0}
|
|
225
|
-
onClick={handleAccClick}
|
|
226
|
-
>
|
|
227
|
-
<span>Visualisation and Navigation</span>
|
|
228
|
-
{activeAccIndex === 0 ? (
|
|
229
|
-
<Icon className="ri-arrow-up-s-line" />
|
|
230
|
-
) : (
|
|
231
|
-
<Icon className="ri-arrow-down-s-line" />
|
|
232
|
-
)}
|
|
233
|
-
</Accordion.Title>
|
|
234
|
-
<Accordion.Content active={activeAccIndex === 0}>
|
|
235
|
-
<HTMLField value={definition_app} />
|
|
236
|
-
</Accordion.Content>
|
|
237
|
-
</Accordion>
|
|
238
|
-
)}
|
|
239
|
-
|
|
240
|
-
<h2>
|
|
241
|
-
{hasIndicatorTitle && <>{indicator_title}</>}
|
|
242
|
-
{showDetails && ' - Explore index'}
|
|
243
|
-
</h2>
|
|
244
|
-
|
|
245
|
-
<div>
|
|
246
|
-
{!__SERVER__ && !showDetails && <Overview {...props} />}
|
|
247
|
-
{!__SERVER__ && showDetails && <Details {...props} />}
|
|
244
|
+
</Button>
|
|
245
|
+
</Link>
|
|
246
|
+
)}
|
|
248
247
|
</div>
|
|
248
|
+
</Container>
|
|
249
249
|
|
|
250
|
+
<div className={showMode === 'full' ? 'page-document' : 'ui container'}>
|
|
251
|
+
<div className="full">{!__SERVER__ && <Overview {...props} />}</div>
|
|
252
|
+
</div>
|
|
253
|
+
<Container>
|
|
250
254
|
<Segment>
|
|
251
255
|
<p>
|
|
252
256
|
Content in the European Climate Data Explorer pages is delivered by
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { useLocation } from 'react-router-dom';
|
|
4
|
+
import { PrivacyProtection } from '@eeacms/volto-embed';
|
|
5
|
+
import { Container, Divider, Grid } from 'semantic-ui-react';
|
|
6
|
+
import {
|
|
7
|
+
ShareInfoButton,
|
|
8
|
+
PortalMessage,
|
|
9
|
+
} from '@eeacms/volto-cca-policy/components';
|
|
10
|
+
import {
|
|
11
|
+
isObservatoryMetadataURL,
|
|
12
|
+
fixEmbedURL,
|
|
13
|
+
} from '@eeacms/volto-cca-policy/helpers';
|
|
2
14
|
import {
|
|
3
15
|
TOOL,
|
|
4
16
|
GUIDANCE,
|
|
@@ -19,20 +31,28 @@ import {
|
|
|
19
31
|
ExternalLink,
|
|
20
32
|
BannerTitle,
|
|
21
33
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
22
|
-
import {
|
|
23
|
-
ShareInfoButton,
|
|
24
|
-
PortalMessage,
|
|
25
|
-
} from '@eeacms/volto-cca-policy/components';
|
|
26
|
-
import {
|
|
27
|
-
isObservatoryMetadataURL,
|
|
28
|
-
fixEmbedURL,
|
|
29
|
-
} from '@eeacms/volto-cca-policy/helpers';
|
|
30
|
-
import { Container, Divider, Grid } from 'semantic-ui-react';
|
|
31
|
-
import { useLocation } from 'react-router-dom';
|
|
32
|
-
import { FormattedMessage } from 'react-intl';
|
|
33
34
|
|
|
34
35
|
const share_eea = ['https://cmshare.eea.eu', 'shareit.eea.europa.eu'];
|
|
35
36
|
|
|
37
|
+
const dataprotection = {
|
|
38
|
+
enabled: true,
|
|
39
|
+
privacy_cookie_key: 'flourish',
|
|
40
|
+
privacy_statement: [
|
|
41
|
+
{
|
|
42
|
+
children: [
|
|
43
|
+
{
|
|
44
|
+
text:
|
|
45
|
+
'This map is hosted by a third party [Flourish]. ' +
|
|
46
|
+
'By showing the external content you accept the terms ' +
|
|
47
|
+
'and conditions of www.flourish.studio. This includes ' +
|
|
48
|
+
'their cookie policies, which we have no control over.',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
type: 'p',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
|
|
36
56
|
const DatabaseItemView = (props) => {
|
|
37
57
|
const { content } = props;
|
|
38
58
|
const type = content['@type'];
|
|
@@ -193,18 +213,23 @@ const DatabaseItemView = (props) => {
|
|
|
193
213
|
</>
|
|
194
214
|
)}
|
|
195
215
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
216
|
+
<PrivacyProtection
|
|
217
|
+
data={{
|
|
218
|
+
dataprotection,
|
|
219
|
+
}}
|
|
220
|
+
>
|
|
221
|
+
{!!data_src(map_graphs) && (
|
|
222
|
+
<iframe
|
|
223
|
+
height="980"
|
|
224
|
+
width="100%"
|
|
225
|
+
src={`https://flo.uri.sh/${data_src(map_graphs)}/embed`}
|
|
226
|
+
title="Interactive or visual content"
|
|
227
|
+
className="flourish-embed-iframe"
|
|
228
|
+
sandbox="allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
|
|
229
|
+
></iframe>
|
|
230
|
+
)}
|
|
231
|
+
</PrivacyProtection>
|
|
232
|
+
|
|
208
233
|
<Divider />
|
|
209
234
|
|
|
210
235
|
<ReferenceInfo content={content} />
|
|
@@ -21,6 +21,12 @@ jest.mock('semantic-ui-react', () => ({
|
|
|
21
21
|
...jest.requireActual('semantic-ui-react'),
|
|
22
22
|
}));
|
|
23
23
|
|
|
24
|
+
jest.mock('@eeacms/volto-embed', () => {
|
|
25
|
+
return {
|
|
26
|
+
PrivacyProtection: jest.fn(({ children }) => <div>{children}</div>),
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
24
30
|
describe('DatabaseItemView', () => {
|
|
25
31
|
it('should render the component', () => {
|
|
26
32
|
const content = {
|
|
@@ -95,7 +95,7 @@ export const BIOREGIONS = {
|
|
|
95
95
|
COUNTRIES: 'Countries',
|
|
96
96
|
SUBNATIONAL: 'Subnational Regions',
|
|
97
97
|
CITY: 'Municipality Name',
|
|
98
|
-
TRANS_MACRO_NORTHPERI: 'Northern Periphery',
|
|
98
|
+
TRANS_MACRO_NORTHPERI: 'Northern Periphery and Arctic',
|
|
99
99
|
TRANS_MACRO_BACLITC: 'Baltic Sea',
|
|
100
100
|
TRANS_MACRO_NW_EUROPE: 'North West Europe',
|
|
101
101
|
TRANS_MACRO_N_SEA: 'North Sea',
|
|
@@ -103,20 +103,20 @@ export const BIOREGIONS = {
|
|
|
103
103
|
TRANS_MACRO_ALP_SPACE: 'Alpine Space',
|
|
104
104
|
TRANS_MACRO_CEN_EUR: 'Central Europe',
|
|
105
105
|
TRANS_MACRO_SW_EUR: 'South West Europe',
|
|
106
|
-
TRANS_MACRO_MED: 'Mediterranean',
|
|
107
|
-
TRANS_MACRO_DANUBE: 'Danube',
|
|
106
|
+
TRANS_MACRO_MED: 'Mediterranean (Euro-Med)',
|
|
107
|
+
TRANS_MACRO_DANUBE: 'Danube Area',
|
|
108
108
|
TRANS_MACRO_ADR_IONIAN: 'Adriatic-Ionian',
|
|
109
109
|
TRANS_MACRO_BALKAN_MED: 'Balkan-Mediterranean',
|
|
110
110
|
TRANS_MACRO_CAR_AREA: 'Caribbean Area',
|
|
111
111
|
TRANS_MACRO_AMAZONIA: 'Amazonia',
|
|
112
112
|
TRANS_MACRO_IND_OCEAN_AREA: 'Indian Ocean Area',
|
|
113
113
|
TRANS_MACRO_SE_EUR: 'South East Europe',
|
|
114
|
-
TRANS_MACRO_MED_BASIN: 'Mediterranean Sea Basin',
|
|
114
|
+
TRANS_MACRO_MED_BASIN: 'Mediterranean Sea Basin (NEXT)',
|
|
115
115
|
TRANS_MACRO_MID_ATLANTIC: 'Mid-Atlantic',
|
|
116
116
|
TRANS_MACRO_ARCTIC: 'Arctic',
|
|
117
117
|
TRANS_MACRO_BLACKSEA: 'Black Sea',
|
|
118
118
|
TRANS_MACRO_ATLANTIC: 'Atlantic',
|
|
119
|
-
TRANS_MACRO_BLACKSEA_BASIN: 'Black Sea Basin',
|
|
119
|
+
TRANS_MACRO_BLACKSEA_BASIN: 'Black Sea Basin (NEXT)',
|
|
120
120
|
TRANS_BIO_ALPINE: 'Alpine',
|
|
121
121
|
TRANS_BIO_ANATOLIAN: 'Anatolian',
|
|
122
122
|
TRANS_BIO_ARCTIC: 'Arctic',
|