@eeacms/volto-cca-policy 0.1.74 → 0.1.76
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 +36 -8
- package/package.json +1 -1
- package/src/components/MigrationButtons.jsx +24 -11
- package/src/components/manage/Blocks/Listing/IndicatorCardsListingView.jsx +69 -0
- package/src/components/manage/Blocks/Listing/OrganisationCardsListingView.jsx +8 -9
- package/src/components/manage/Blocks/Listing/common.js +3 -0
- package/src/components/manage/Blocks/Listing/index.js +8 -0
- package/src/components/manage/Blocks/Listing/styles.less +40 -6
- package/src/components/theme/Header.jsx +4 -58
- package/src/components/theme/LanguageSwitch.jsx +66 -0
- package/src/components/theme/Views/PublicationReportView.jsx +3 -35
- package/src/components/theme/Views/ToolView.jsx +2 -31
- package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +1 -1
- package/src/customizations/volto/middleware/README.md +3 -0
- package/src/customizations/volto/middleware/api.js +347 -0
- package/src/customizations/volto/server.jsx +354 -0
- package/src/helpers/Utils.jsx +39 -0
- package/src/helpers/index.js +1 -0
- package/src/index.js +11 -6
- package/src/search/mission_projects/config-projects.js +1 -1
- package/src/search/mission_stories/config-stories.js +5 -0
- package/src/search/mission_stories/facets-stories.js +16 -0
- package/theme/globals/mission.less +4 -0
- package/theme/globals/site.overrides +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,42 @@ 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.1.76](https://github.com/eea/volto-cca-policy/compare/0.1.75...0.1.76) - 16 February 2024
|
|
8
|
+
|
|
9
|
+
#### :nail_care: Enhancements
|
|
10
|
+
|
|
11
|
+
- change: update mission search fields [kreafox - [`011be24`](https://github.com/eea/volto-cca-policy/commit/011be24eed371196ce8180a6ca058fc4b254e2e6)]
|
|
12
|
+
- change: update mission stories search [kreafox - [`d077a11`](https://github.com/eea/volto-cca-policy/commit/d077a115001f8b8038531bcecb3306fb5b454da5)]
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- Refs #265319 - Improve design for organisation cards. [GhitaB - [`da31fc1`](https://github.com/eea/volto-cca-policy/commit/da31fc1f1fa3b025be689cc77bb3cc0cb690b407)]
|
|
17
|
+
- Refs #265325 - Use observatory url format for indicators listing, too. [GhitaB - [`0557783`](https://github.com/eea/volto-cca-policy/commit/0557783ef325bf1786e3c59ef85bf2a5c94e1f06)]
|
|
18
|
+
- test: fix duplicated code issue [kreafox - [`0104638`](https://github.com/eea/volto-cca-policy/commit/01046385f54e58cc792ea06542c24b0bb4446c0f)]
|
|
19
|
+
### [0.1.75](https://github.com/eea/volto-cca-policy/compare/0.1.74...0.1.75) - 15 February 2024
|
|
20
|
+
|
|
21
|
+
#### :rocket: New Features
|
|
22
|
+
|
|
23
|
+
- feat: add language dropdown [kreafox - [`22ffe5b`](https://github.com/eea/volto-cca-policy/commit/22ffe5b8664b51fc44e9a86c2387305414e95d62)]
|
|
24
|
+
|
|
25
|
+
#### :bug: Bug Fixes
|
|
26
|
+
|
|
27
|
+
- fix: remove polish language [kreafox - [`29413fd`](https://github.com/eea/volto-cca-policy/commit/29413fdb4f0d97dbdd47a0760972d7b0076e1d45)]
|
|
28
|
+
|
|
29
|
+
#### :nail_care: Enhancements
|
|
30
|
+
|
|
31
|
+
- change: hide language selector from mission [kreafox - [`2f18f6d`](https://github.com/eea/volto-cca-policy/commit/2f18f6d7f6f4961c24e5254dfb431cd28d0bb5cd)]
|
|
32
|
+
- change: remove padding from .content-area [kreafox - [`a456994`](https://github.com/eea/volto-cca-policy/commit/a45699421a3e67e6fbb339934116ae76c62f7912)]
|
|
33
|
+
|
|
34
|
+
#### :hammer_and_wrench: Others
|
|
35
|
+
|
|
36
|
+
- Indicator card - fix error. [GhitaB - [`e917135`](https://github.com/eea/volto-cca-policy/commit/e91713566d7bc3529f740d825e3183322ecb6ecd)]
|
|
37
|
+
- Indicator card - fix missing key. [GhitaB - [`eef5186`](https://github.com/eea/volto-cca-policy/commit/eef51864db680a7c18a9a6875f3ad52a81767dc0)]
|
|
38
|
+
- Fix image src for organisation card. [GhitaB - [`5457713`](https://github.com/eea/volto-cca-policy/commit/5457713795ae28e2c0d475cdea59c5d225d1bd1c)]
|
|
39
|
+
- Add indicator card new listing type for search block in Observatory. [GhitaB - [`09b80dc`](https://github.com/eea/volto-cca-policy/commit/09b80dc0fca8347ee139c5367afae310fa0b2ee3)]
|
|
40
|
+
- Cleanup code [kreafox - [`1908fca`](https://github.com/eea/volto-cca-policy/commit/1908fca7707f526081a449f79eae6bdd6350b886)]
|
|
41
|
+
- Add LanguageSwitch and customized api middleware [Tiberiu Ichim - [`02ba1ca`](https://github.com/eea/volto-cca-policy/commit/02ba1ca72ba2812b51179ad0ac46f37642e6d8c8)]
|
|
42
|
+
- Add pdb button [Tiberiu Ichim - [`18c5630`](https://github.com/eea/volto-cca-policy/commit/18c5630c9c7676ce30ae7e6ac63afc60327e19b9)]
|
|
7
43
|
### [0.1.74](https://github.com/eea/volto-cca-policy/compare/0.1.73...0.1.74) - 13 February 2024
|
|
8
44
|
|
|
9
45
|
#### :bug: Bug Fixes
|
|
@@ -287,13 +323,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
287
323
|
- Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
|
|
288
324
|
- Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
|
|
289
325
|
- Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
|
|
290
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
|
|
291
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
|
|
292
326
|
### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
|
|
293
327
|
|
|
294
328
|
#### :house: Internal changes
|
|
295
329
|
|
|
296
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
|
|
297
330
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
|
|
298
331
|
|
|
299
332
|
#### :hammer_and_wrench: Others
|
|
@@ -310,9 +343,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
310
343
|
- Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
|
|
311
344
|
- Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
|
|
312
345
|
- Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
|
|
313
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
|
|
314
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
|
|
315
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
|
|
316
346
|
- Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
|
|
317
347
|
- Refs #256681 - Fix error in CCA Event view menu. ([React Intl] An id must be provided to format a message.) [GhitaB - [`517eeb8`](https://github.com/eea/volto-cca-policy/commit/517eeb817264a47bbfd6b9b7d22aaf22d44ed224)]
|
|
318
348
|
- Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
|
|
@@ -529,7 +559,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
529
559
|
|
|
530
560
|
#### :house: Internal changes
|
|
531
561
|
|
|
532
|
-
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
|
|
533
562
|
|
|
534
563
|
#### :hammer_and_wrench: Others
|
|
535
564
|
|
|
@@ -1010,7 +1039,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1010
1039
|
#### :hammer_and_wrench: Others
|
|
1011
1040
|
|
|
1012
1041
|
- Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
|
|
1013
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
|
|
1014
1042
|
### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
|
|
1015
1043
|
|
|
1016
1044
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -7,20 +7,22 @@ function MigrationButtons(props) {
|
|
|
7
7
|
const show = !!token && contentId && contentId.indexOf('europa.eu') === -1;
|
|
8
8
|
const base = getBaseUrl(pathname);
|
|
9
9
|
|
|
10
|
-
const handleClickMigrate = () => {
|
|
11
|
-
window.open(`http://localhost:8080/cca/${base}/@@volto_migrate`, '_blank');
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const handleClickView = () => {
|
|
15
|
-
window.open(`https://climate-adapt.eea.europa.eu${base}`, '_blank');
|
|
16
|
-
};
|
|
17
|
-
|
|
18
10
|
return show ? (
|
|
19
|
-
<Plug
|
|
11
|
+
<Plug
|
|
12
|
+
pluggable="main.toolbar.top"
|
|
13
|
+
id="cca-migration-helpers"
|
|
14
|
+
order={0}
|
|
15
|
+
dependencies={[contentId]}
|
|
16
|
+
>
|
|
20
17
|
<button
|
|
21
18
|
className={`circle-right-btn `}
|
|
22
19
|
id="toolbar-migration"
|
|
23
|
-
onClick={
|
|
20
|
+
onClick={() =>
|
|
21
|
+
window.open(
|
|
22
|
+
`http://localhost:8080/cca/${base}/@@volto_migrate`,
|
|
23
|
+
'_blank',
|
|
24
|
+
)
|
|
25
|
+
}
|
|
24
26
|
title="Migrate context"
|
|
25
27
|
>
|
|
26
28
|
M
|
|
@@ -29,11 +31,22 @@ function MigrationButtons(props) {
|
|
|
29
31
|
<button
|
|
30
32
|
className={`circle-right-btn `}
|
|
31
33
|
id="toolbar-view"
|
|
32
|
-
onClick={
|
|
34
|
+
onClick={() =>
|
|
35
|
+
window.open(`https://climate-adapt.eea.europa.eu${base}`, '_blank')
|
|
36
|
+
}
|
|
33
37
|
title="View original"
|
|
34
38
|
>
|
|
35
39
|
V
|
|
36
40
|
</button>
|
|
41
|
+
|
|
42
|
+
<button
|
|
43
|
+
className={`circle-right-btn`}
|
|
44
|
+
id="toolbar-migration"
|
|
45
|
+
onClick={() => window.open(`http://localhost:8080/cca/${base}/@@gopdb`)}
|
|
46
|
+
title="Migrate context"
|
|
47
|
+
>
|
|
48
|
+
PDB
|
|
49
|
+
</button>
|
|
37
50
|
</Plug>
|
|
38
51
|
) : null;
|
|
39
52
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { compose } from 'redux';
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import { ConditionalLink } from '@plone/volto/components';
|
|
7
|
+
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
|
|
8
|
+
import { observatoryURL } from './common';
|
|
9
|
+
import './styles.less';
|
|
10
|
+
|
|
11
|
+
const fixedTitles = {
|
|
12
|
+
C3S: 'Copernicus (C3S)',
|
|
13
|
+
'Lancet Countdown': 'Lancet Countdown in Europe',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const fixTitle = (title) => {
|
|
17
|
+
return fixedTitles[title] || title;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const IndicatorCardsListingView = ({ items, isEditMode, token }) => {
|
|
21
|
+
return (
|
|
22
|
+
<div className={cx('ui fluid indicatorCards')}>
|
|
23
|
+
{items.map((item, index) => (
|
|
24
|
+
<div
|
|
25
|
+
className={cx('u-item listing-item simple-listing-item')}
|
|
26
|
+
key={item['@id']}
|
|
27
|
+
>
|
|
28
|
+
<div className="wrapper">
|
|
29
|
+
<div className="slot-top">
|
|
30
|
+
<ConditionalLink
|
|
31
|
+
to={flattenToAppURL(getBaseUrl(observatoryURL(item)))}
|
|
32
|
+
condition={!isEditMode}
|
|
33
|
+
>
|
|
34
|
+
<div className="listing-body">
|
|
35
|
+
<h4 className={'listing-header'}>
|
|
36
|
+
{item.title ? item.title : item.id}
|
|
37
|
+
</h4>
|
|
38
|
+
</div>
|
|
39
|
+
</ConditionalLink>
|
|
40
|
+
</div>
|
|
41
|
+
<div className="simple-item-meta">
|
|
42
|
+
<span className="text-left year">
|
|
43
|
+
{item?.cca_published &&
|
|
44
|
+
new Date(item?.publication_date).getFullYear()}
|
|
45
|
+
</span>
|
|
46
|
+
<span className="text-left">
|
|
47
|
+
{item &&
|
|
48
|
+
item.origin_website &&
|
|
49
|
+
item.origin_website.length > 0 &&
|
|
50
|
+
fixTitle(item?.origin_website[0]?.title)}
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
))}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
IndicatorCardsListingView.propTypes = {
|
|
61
|
+
items: PropTypes.arrayOf(PropTypes.any).isRequired,
|
|
62
|
+
isEditMode: PropTypes.bool,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default compose(
|
|
66
|
+
connect((state) => ({
|
|
67
|
+
token: state.userSession.token,
|
|
68
|
+
})),
|
|
69
|
+
)(IndicatorCardsListingView);
|
|
@@ -2,13 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { connect } from 'react-redux';
|
|
4
4
|
import { compose } from 'redux';
|
|
5
|
+
import { observatoryURL } from './common';
|
|
5
6
|
import './styles.less';
|
|
6
7
|
|
|
7
8
|
const OrganisationCardsListingView = ({ items, isEditMode, token }) => {
|
|
8
|
-
const observatoryURL = (item) => {
|
|
9
|
-
return item['@id'].replace('/metadata/', '/observatory/++aq++metadata/');
|
|
10
|
-
};
|
|
11
|
-
|
|
12
9
|
const contributionsURL = (item) => {
|
|
13
10
|
const mapContributorValues = {
|
|
14
11
|
'copernicus-climate-change-service-ecmw':
|
|
@@ -51,11 +48,13 @@ const OrganisationCardsListingView = ({ items, isEditMode, token }) => {
|
|
|
51
48
|
<div className="content">
|
|
52
49
|
<div className="header">
|
|
53
50
|
<a className="image" href={observatoryURL(item)}>
|
|
54
|
-
<img
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
<div className="img-container">
|
|
52
|
+
<img
|
|
53
|
+
src={item['@id'] + '/@@images/logo/preview'}
|
|
54
|
+
alt={item.title}
|
|
55
|
+
className="ui image"
|
|
56
|
+
></img>
|
|
57
|
+
</div>
|
|
59
58
|
</a>
|
|
60
59
|
<a className="header-link org-name" href={observatoryURL(item)}>
|
|
61
60
|
{item.title}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import OrganisationCardsListingView from './OrganisationCardsListingView';
|
|
2
|
+
import IndicatorCardsListingView from './IndicatorCardsListingView';
|
|
2
3
|
|
|
3
4
|
export default function installListing(config) {
|
|
4
5
|
config.blocks.blocksConfig.listing = {
|
|
@@ -12,6 +13,13 @@ export default function installListing(config) {
|
|
|
12
13
|
isDefault: false,
|
|
13
14
|
fullobjects: true,
|
|
14
15
|
},
|
|
16
|
+
{
|
|
17
|
+
id: 'indicatorCards',
|
|
18
|
+
title: 'Indicator Cards',
|
|
19
|
+
template: IndicatorCardsListingView,
|
|
20
|
+
isDefault: false,
|
|
21
|
+
fullobjects: true,
|
|
22
|
+
},
|
|
15
23
|
],
|
|
16
24
|
};
|
|
17
25
|
|
|
@@ -1,12 +1,46 @@
|
|
|
1
1
|
// Organisation Cards Listing
|
|
2
2
|
div.organisationCards {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
div.card.u-card {
|
|
4
|
+
border: 1px solid #ccc;
|
|
5
|
+
margin: 10px;
|
|
6
|
+
|
|
7
|
+
div.img-container {
|
|
8
|
+
min-height: 120px;
|
|
9
|
+
text-align: center;
|
|
10
|
+
|
|
11
|
+
img {
|
|
12
|
+
width: auto;
|
|
13
|
+
max-height: 100px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
a.org-name {
|
|
18
|
+
margin-top: 0.5em;
|
|
19
|
+
margin-bottom: 0.5em;
|
|
20
|
+
font-size: 1em;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
a.org-site {
|
|
24
|
+
font-size: 0.7em;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Indicators Cards Listing
|
|
30
|
+
div.indicatorCards {
|
|
31
|
+
a {
|
|
32
|
+
color: #006bb8 !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
h4 {
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
span.year {
|
|
40
|
+
margin-right: 1em;
|
|
7
41
|
}
|
|
8
42
|
|
|
9
|
-
|
|
10
|
-
|
|
43
|
+
.simple-listing-item {
|
|
44
|
+
margin-bottom: 1em !important;
|
|
11
45
|
}
|
|
12
46
|
}
|
|
@@ -17,14 +17,13 @@ import {
|
|
|
17
17
|
import { getNavigation } from '@plone/volto/actions';
|
|
18
18
|
import { Header, Logo } from '@eeacms/volto-eea-design-system/ui';
|
|
19
19
|
import { usePrevious } from '@eeacms/volto-eea-design-system/helpers';
|
|
20
|
-
import { find } from 'lodash';
|
|
21
|
-
import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg';
|
|
22
20
|
import eeaFlag from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea.png';
|
|
23
21
|
import { toPublicURL } from '@plone/volto/helpers';
|
|
24
22
|
|
|
25
23
|
import config from '@plone/volto/registry';
|
|
26
24
|
import { compose } from 'recompose';
|
|
27
25
|
import { BodyClass } from '@plone/volto/helpers';
|
|
26
|
+
import LanguageSwitch from './LanguageSwitch';
|
|
28
27
|
|
|
29
28
|
import cx from 'classnames';
|
|
30
29
|
|
|
@@ -63,12 +62,8 @@ const DirectLinkLogo = ({
|
|
|
63
62
|
/**
|
|
64
63
|
* EEA Specific Header component.
|
|
65
64
|
*/
|
|
66
|
-
const EEAHeader = (
|
|
67
|
-
const
|
|
68
|
-
const translations = useSelector(
|
|
69
|
-
(state) => state.content.data?.['@components']?.translations?.items,
|
|
70
|
-
);
|
|
71
|
-
|
|
65
|
+
const EEAHeader = (props) => {
|
|
66
|
+
const { pathname, token, items, subsite } = props;
|
|
72
67
|
const router_pathname = useSelector((state) => {
|
|
73
68
|
return removeTrailingSlash(state.router?.location?.pathname) || '';
|
|
74
69
|
});
|
|
@@ -94,9 +89,6 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
|
|
|
94
89
|
const width = useSelector((state) => state.screen?.width);
|
|
95
90
|
const dispatch = useDispatch();
|
|
96
91
|
const previousToken = usePrevious(token);
|
|
97
|
-
const [language, setLanguage] = React.useState(
|
|
98
|
-
currentLang || eea.defaultLanguage,
|
|
99
|
-
);
|
|
100
92
|
|
|
101
93
|
React.useEffect(() => {
|
|
102
94
|
const { settings } = config;
|
|
@@ -184,53 +176,7 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
|
|
|
184
176
|
</Header.TopItem>
|
|
185
177
|
)}
|
|
186
178
|
|
|
187
|
-
{config.settings.isMultilingual &&
|
|
188
|
-
<Header.TopDropdownMenu
|
|
189
|
-
id="language-switcher"
|
|
190
|
-
className="item"
|
|
191
|
-
hasLanguageDropdown={
|
|
192
|
-
config.settings.supportedLanguages.length > 1 &&
|
|
193
|
-
config.settings.hasLanguageDropdown
|
|
194
|
-
}
|
|
195
|
-
text={`${language.toUpperCase()}`}
|
|
196
|
-
mobileText={`${language.toUpperCase()}`}
|
|
197
|
-
icon={
|
|
198
|
-
<Image src={globeIcon} alt="language dropdown globe icon"></Image>
|
|
199
|
-
}
|
|
200
|
-
viewportWidth={width}
|
|
201
|
-
>
|
|
202
|
-
<ul
|
|
203
|
-
className="wrapper language-list"
|
|
204
|
-
role="listbox"
|
|
205
|
-
aria-label="language switcher"
|
|
206
|
-
>
|
|
207
|
-
{eea.languages.map((item, index) => (
|
|
208
|
-
<Dropdown.Item
|
|
209
|
-
as="li"
|
|
210
|
-
key={index}
|
|
211
|
-
text={
|
|
212
|
-
<span>
|
|
213
|
-
{item.name}
|
|
214
|
-
<span className="country-code">
|
|
215
|
-
{item.code.toUpperCase()}
|
|
216
|
-
</span>
|
|
217
|
-
</span>
|
|
218
|
-
}
|
|
219
|
-
onClick={() => {
|
|
220
|
-
const translation = find(translations, {
|
|
221
|
-
language: item.code,
|
|
222
|
-
});
|
|
223
|
-
const to = translation
|
|
224
|
-
? flattenToAppURL(translation['@id'])
|
|
225
|
-
: `/${item.code}`;
|
|
226
|
-
setLanguage(item.code);
|
|
227
|
-
history.push(to);
|
|
228
|
-
}}
|
|
229
|
-
></Dropdown.Item>
|
|
230
|
-
))}
|
|
231
|
-
</ul>
|
|
232
|
-
</Header.TopDropdownMenu>
|
|
233
|
-
)}
|
|
179
|
+
{config.settings.isMultilingual && <LanguageSwitch {...props} />}
|
|
234
180
|
</Header.TopHeader>
|
|
235
181
|
<Header.Main
|
|
236
182
|
pathname={pathname}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Header } from '@eeacms/volto-eea-design-system/ui';
|
|
3
|
+
import { find } from 'lodash';
|
|
4
|
+
import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg';
|
|
5
|
+
import { useSelector } from 'react-redux';
|
|
6
|
+
import config from '@plone/volto/registry';
|
|
7
|
+
import { Dropdown, Image } from 'semantic-ui-react';
|
|
8
|
+
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
9
|
+
|
|
10
|
+
// dispatch(changeLanguage(redirectToLanguage, locale.default));
|
|
11
|
+
export default function LanguageSwitch({ history }) {
|
|
12
|
+
const { eea } = config.settings;
|
|
13
|
+
const translations = useSelector(
|
|
14
|
+
(state) => state.content.data?.['@components']?.translations?.items,
|
|
15
|
+
);
|
|
16
|
+
const width = useSelector((state) => state.screen?.width);
|
|
17
|
+
|
|
18
|
+
const currentLang = useSelector((state) => state.intl.locale);
|
|
19
|
+
const [language, setLanguage] = React.useState(
|
|
20
|
+
currentLang || eea.defaultLanguage,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Header.TopDropdownMenu
|
|
25
|
+
id="language-switcher"
|
|
26
|
+
className="item"
|
|
27
|
+
hasLanguageDropdown={
|
|
28
|
+
config.settings.supportedLanguages.length > 1 &&
|
|
29
|
+
config.settings.hasLanguageDropdown
|
|
30
|
+
}
|
|
31
|
+
text={`${language.toUpperCase()}`}
|
|
32
|
+
mobileText={`${language.toUpperCase()}`}
|
|
33
|
+
icon={<Image src={globeIcon} alt="language dropdown globe icon"></Image>}
|
|
34
|
+
viewportWidth={width}
|
|
35
|
+
>
|
|
36
|
+
<ul
|
|
37
|
+
className="wrapper language-list"
|
|
38
|
+
role="listbox"
|
|
39
|
+
aria-label="language switcher"
|
|
40
|
+
>
|
|
41
|
+
{eea.languages.map((item, index) => (
|
|
42
|
+
<Dropdown.Item
|
|
43
|
+
as="li"
|
|
44
|
+
key={index}
|
|
45
|
+
text={
|
|
46
|
+
<span>
|
|
47
|
+
{item.name}
|
|
48
|
+
<span className="country-code">{item.code.toUpperCase()}</span>
|
|
49
|
+
</span>
|
|
50
|
+
}
|
|
51
|
+
onClick={() => {
|
|
52
|
+
const translation = find(translations, {
|
|
53
|
+
language: item.code,
|
|
54
|
+
});
|
|
55
|
+
const to = translation
|
|
56
|
+
? flattenToAppURL(translation['@id'])
|
|
57
|
+
: `/${item.code}`;
|
|
58
|
+
setLanguage(item.code);
|
|
59
|
+
history.push(to);
|
|
60
|
+
}}
|
|
61
|
+
></Dropdown.Item>
|
|
62
|
+
))}
|
|
63
|
+
</ul>
|
|
64
|
+
</Header.TopDropdownMenu>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
HTMLField,
|
|
4
3
|
ContentMetadata,
|
|
5
|
-
LinksList,
|
|
6
4
|
PublishedModifiedInfo,
|
|
7
5
|
DocumentsList,
|
|
8
6
|
ShareInfo,
|
|
7
|
+
ReferenceInfo,
|
|
9
8
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
10
9
|
import { Grid } from 'semantic-ui-react';
|
|
11
10
|
|
|
12
11
|
function PublicationReportView(props) {
|
|
13
12
|
const { content } = props;
|
|
13
|
+
|
|
14
14
|
return (
|
|
15
15
|
<div className="publication-report-view">
|
|
16
16
|
<div className="ui container">
|
|
@@ -23,40 +23,8 @@ function PublicationReportView(props) {
|
|
|
23
23
|
className="col-left"
|
|
24
24
|
>
|
|
25
25
|
<div className="ui label">Publications and Reports</div>
|
|
26
|
-
<h1>{content.title}</h1>
|
|
27
|
-
<h4>Description</h4>
|
|
28
|
-
<HTMLField
|
|
29
|
-
value={content.long_description}
|
|
30
|
-
className="long_description"
|
|
31
|
-
/>
|
|
32
|
-
<hr />
|
|
33
|
-
|
|
34
|
-
<h4>Reference information</h4>
|
|
35
|
-
|
|
36
|
-
{content?.websites?.length > 0 && (
|
|
37
|
-
<LinksList title="Websites:" value={content.websites} />
|
|
38
|
-
)}
|
|
39
|
-
|
|
40
|
-
{content.source && (
|
|
41
|
-
<>
|
|
42
|
-
<h4>Source:</h4>
|
|
43
|
-
<HTMLField value={content.source} className="source" />
|
|
44
|
-
</>
|
|
45
|
-
)}
|
|
46
|
-
{content?.contributor_list?.length > 0 && (
|
|
47
|
-
<>
|
|
48
|
-
<h4>Contributor:</h4>
|
|
49
|
-
{content.contributor_list
|
|
50
|
-
.map((item) => (
|
|
51
|
-
<>
|
|
52
|
-
{item.title}
|
|
53
|
-
<br />
|
|
54
|
-
</>
|
|
55
|
-
))
|
|
56
|
-
.sort()}
|
|
57
|
-
</>
|
|
58
|
-
)}
|
|
59
26
|
|
|
27
|
+
<ReferenceInfo content={content} />
|
|
60
28
|
<PublishedModifiedInfo {...props} />
|
|
61
29
|
<ShareInfo {...props} />
|
|
62
30
|
</Grid.Column>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
HTMLField,
|
|
4
3
|
ContentMetadata,
|
|
5
|
-
LinksList,
|
|
6
4
|
PublishedModifiedInfo,
|
|
5
|
+
ReferenceInfo,
|
|
7
6
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
8
7
|
import { Grid } from 'semantic-ui-react';
|
|
9
8
|
|
|
@@ -21,36 +20,8 @@ function ToolView(props) {
|
|
|
21
20
|
className="col-left"
|
|
22
21
|
>
|
|
23
22
|
<div className="ui label">Tools</div>
|
|
24
|
-
<h1>{content.title}</h1>
|
|
25
|
-
<h4>Description</h4>
|
|
26
|
-
<HTMLField
|
|
27
|
-
value={content.long_description}
|
|
28
|
-
className="long_description"
|
|
29
|
-
/>
|
|
30
|
-
<hr />
|
|
31
|
-
<h4>Reference information</h4>
|
|
32
23
|
|
|
33
|
-
{content
|
|
34
|
-
<LinksList title="Websites:" value={content.websites} />
|
|
35
|
-
)}
|
|
36
|
-
|
|
37
|
-
{content.source && (
|
|
38
|
-
<>
|
|
39
|
-
<h4>Source:</h4>
|
|
40
|
-
<HTMLField value={content.source} className="source" />
|
|
41
|
-
</>
|
|
42
|
-
)}
|
|
43
|
-
{content?.contributor_list?.length > 0 && (
|
|
44
|
-
<>
|
|
45
|
-
<h4>Contributor</h4>
|
|
46
|
-
{content.contributor_list.sort().map((item) => (
|
|
47
|
-
<>
|
|
48
|
-
{item.title}
|
|
49
|
-
<br />
|
|
50
|
-
</>
|
|
51
|
-
))}
|
|
52
|
-
</>
|
|
53
|
-
)}
|
|
24
|
+
<ReferenceInfo content={content} />
|
|
54
25
|
|
|
55
26
|
<PublishedModifiedInfo {...props} />
|
|
56
27
|
</Grid.Column>
|