@eeacms/volto-cca-policy 0.1.66 → 0.1.68

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
@@ -4,6 +4,66 @@ 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.68](https://github.com/eea/volto-cca-policy/compare/0.1.67...0.1.68) - 30 January 2024
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: preview image in search listing [kreafox - [`77025e2`](https://github.com/eea/volto-cca-policy/commit/77025e2c65e73d2b25a85a3a601195cf5b654a45)]
12
+ - fix: stories search listing + show images [kreafox - [`04eac85`](https://github.com/eea/volto-cca-policy/commit/04eac854b915051534cec0f4c03cd86aca95ef75)]
13
+
14
+ #### :nail_care: Enhancements
15
+
16
+ - change: update icon [kreafox - [`5abd305`](https://github.com/eea/volto-cca-policy/commit/5abd305ad658e4a8bd8d2351a86448e4724ee287)]
17
+ - change: color in observatory search [kreafox - [`5711c4f`](https://github.com/eea/volto-cca-policy/commit/5711c4fc08a1e71fe74fb918da41e2f4cc173d7b)]
18
+ - change: separate mission styling [kreafox - [`4b4749a`](https://github.com/eea/volto-cca-policy/commit/4b4749abce6a871d3d595391f72520ae22bfeacf)]
19
+
20
+ #### :hammer_and_wrench: Others
21
+
22
+ - Refs #161485 - update icons [Tripon Eugen - [`91f0bee`](https://github.com/eea/volto-cca-policy/commit/91f0bee22c78854b0f4be2dcb56bf0d00a3bd6e5)]
23
+ - Refs #161485 - set portal types icons [Tripon Eugen - [`055f26a`](https://github.com/eea/volto-cca-policy/commit/055f26accc79ed56b10f539449e88d030171df3b)]
24
+ - Compute icons for clusters [Tiberiu Ichim - [`cdbe2cd`](https://github.com/eea/volto-cca-policy/commit/cdbe2cdda3b59110b136b0e947c0c97dc8965df6)]
25
+ - Refs #161485 - health impacts facet default sort order [Tripon Eugen - [`535ab04`](https://github.com/eea/volto-cca-policy/commit/535ab04547c00cdbf109c07a8c6cfe425ab04916)]
26
+ - Refs #161485 - filter test add one more [Tripon Eugen - [`fa93935`](https://github.com/eea/volto-cca-policy/commit/fa93935e380cfe13203a3a241b85102c3d48d36f)]
27
+ - Refs #161485 - filter test change check element [Tripon Eugen - [`e40a029`](https://github.com/eea/volto-cca-policy/commit/e40a02902e61338a1bacec8b1e17171194528c93)]
28
+ - Refs #161485 - filter test for sonarqube [Tripon Eugen - [`f764310`](https://github.com/eea/volto-cca-policy/commit/f7643109e63ebeb881d6ea825ba00eb7a2a18646)]
29
+ - Refs #161485 - filter test for sonarqube [Tripon Eugen - [`2b85fcc`](https://github.com/eea/volto-cca-policy/commit/2b85fcc99aaf5e030a982ea67c796bde28053552)]
30
+ - Refs #161485 - filter test for sonarqube [Tripon Eugen - [`2566360`](https://github.com/eea/volto-cca-policy/commit/25663608f5f851dec8a5d83d740008ebff5df233)]
31
+ - Refs #161485 - filter test for sonarqube [Tripon Eugen - [`b09873c`](https://github.com/eea/volto-cca-policy/commit/b09873c7f3b764030897bd042a3169b411b9deec)]
32
+ - Refs #161485 - filter test for sonarqube [Tripon Eugen - [`7df5146`](https://github.com/eea/volto-cca-policy/commit/7df5146e0f6b27accf8fd5a5964f5454c078900a)]
33
+ - Refs #161485 - sonarqube [Tripon Eugen - [`20b5781`](https://github.com/eea/volto-cca-policy/commit/20b5781e07ed0bbb0017ba4644122171dda4d6c5)]
34
+ - Refs #161485 - sonarqube [Tripon Eugen - [`26eab80`](https://github.com/eea/volto-cca-policy/commit/26eab80e3fd2ef1d8bcf7f7c1fc959598e90474a)]
35
+ - Refs #161485 - duplicated lines [Tripon Eugen - [`0b2f187`](https://github.com/eea/volto-cca-policy/commit/0b2f187771a9c9bb0a4eedb84d5ebdb4ccbe81aa)]
36
+ - Refs #161485 - update health facets [Tripon Eugen - [`2c132bb`](https://github.com/eea/volto-cca-policy/commit/2c132bb71822d8873cda6ffe562c0522e3f0c151)]
37
+ - Refs #161485 - update health facets from develop [Tripon Eugen - [`a974d79`](https://github.com/eea/volto-cca-policy/commit/a974d7988e558e4a02eca9807331740214854ea6)]
38
+ - Refs #161485 - facets comment custom sort [Tripon Eugen - [`80d78c9`](https://github.com/eea/volto-cca-policy/commit/80d78c9c9b9118ea505a42af47263d05748e52bf)]
39
+ - Refs #263399 - Fix eslint errors. [GhitaB - [`d0595d1`](https://github.com/eea/volto-cca-policy/commit/d0595d12018bdec0582370204aa8afce3cb1010b)]
40
+ - Refs #263399 - Fix eslint errors. [GhitaB - [`c881386`](https://github.com/eea/volto-cca-policy/commit/c8813864b93a53d5f581b33fee45140790834d51)]
41
+ - Add physical-breadcrumbs [Tiberiu Ichim - [`3f365f8`](https://github.com/eea/volto-cca-policy/commit/3f365f8c9529ff082b6599d0c425d7ef1bafc951)]
42
+ - Revert "test: Update jest,Jenkinsfile,lint to volto-addons-template PR30". [GhitaB - [`fd821d1`](https://github.com/eea/volto-cca-policy/commit/fd821d1629dca31bb2de6e06752e6e57d3d44651)]
43
+ - Improve code - fix duplicate common facets: objectProvides, language, issued_date. [GhitaB - [`935855a`](https://github.com/eea/volto-cca-policy/commit/935855a9e6a745ca598cf50f7fac216fd11ade08)]
44
+ - test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`9533869`](https://github.com/eea/volto-cca-policy/commit/95338695df80637079e3b032cb40e9db8e678635)]
45
+ - Improve code - fix duplicate common facets: include_archived. [GhitaB - [`1a72756`](https://github.com/eea/volto-cca-policy/commit/1a7275684cefae5584a47c2af926bcd93243a934)]
46
+ - Improve code - fix duplicate common facets: include_archived. [GhitaB - [`1a3785a`](https://github.com/eea/volto-cca-policy/commit/1a3785a46cf912588ff68f62bdbf03f17012e550)]
47
+ - Improve code - fix duplicate /Blocks/withResponsiveContainer.js. [GhitaB - [`7d375f2`](https://github.com/eea/volto-cca-policy/commit/7d375f2ed38931be198f8c9d5c40366edc9c3185)]
48
+ - Improve code /components/theme/Views/CaseStudyView.jsx. [GhitaB - [`875f512`](https://github.com/eea/volto-cca-policy/commit/875f512eb1bed848ef76aa90700ba72ac63d01e9)]
49
+ - Clean code in Blocks/TransRegionSelect/countries.js. [GhitaB - [`2af2206`](https://github.com/eea/volto-cca-policy/commit/2af2206154f22a4bbbd8c25f8cd9aec0640a1df2)]
50
+ - Revert "test: Update jest,Jenkinsfile,lint to volto-addons-template PR30" [David Ichim - [`ab43cb2`](https://github.com/eea/volto-cca-policy/commit/ab43cb21236dc39d51e01003807f8f1020a4e64b)]
51
+ - Set main search as default [Tiberiu Ichim - [`2877ce4`](https://github.com/eea/volto-cca-policy/commit/2877ce43b178899df48fc655594a50d696ccc2ea)]
52
+ - test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`9c94b78`](https://github.com/eea/volto-cca-policy/commit/9c94b78d04c18691fa04b9fdaaf61a052cbc89a6)]
53
+ - Fix custom facet values in health observatory [Tiberiu Ichim - [`c6ddacf`](https://github.com/eea/volto-cca-policy/commit/c6ddacf318e24b1b32cc58c2cda5b5acabd9ffad)]
54
+ - Comment code [Tiberiu Ichim - [`f552df1`](https://github.com/eea/volto-cca-policy/commit/f552df196f15e4d9726ec5f1060314a6f92f8e0f)]
55
+ - Fix facets for main search [Tiberiu Ichim - [`2defd05`](https://github.com/eea/volto-cca-policy/commit/2defd05596f490dd5b434a4f4a4156d423578f36)]
56
+ - Update menu for translated search menu (fix show children) [Ghiță Bizău - [`d03f8c3`](https://github.com/eea/volto-cca-policy/commit/d03f8c322790e67c91d0e58803640237444bdd52)]
57
+ - Add dependency on volto-searchlib [Tiberiu Ichim - [`955edee`](https://github.com/eea/volto-cca-policy/commit/955edee904da8cb0292b6ffef5c9f493101baf43)]
58
+ - Cleanup facets in cca search [Tiberiu Ichim - [`bf0e7cb`](https://github.com/eea/volto-cca-policy/commit/bf0e7cb7805b7844fe741d44b4b05ec29447d96d)]
59
+ - Refs #161485 - observatory search update settings [Tripon Eugen - [`06f483f`](https://github.com/eea/volto-cca-policy/commit/06f483fe95f1b791cbd20206099730175df945cf)]
60
+ - Refs #161485 - observatory search update settings [Tripon Eugen - [`b4f3530`](https://github.com/eea/volto-cca-policy/commit/b4f353025c52e2a85268750fb97074963bb2dd32)]
61
+ ### [0.1.67](https://github.com/eea/volto-cca-policy/compare/0.1.66...0.1.67) - 26 January 2024
62
+
63
+ #### :hammer_and_wrench: Others
64
+
65
+ - Refs #263399 - Fix eslint errors. [GhitaB - [`71adad4`](https://github.com/eea/volto-cca-policy/commit/71adad443cacc47d548600a6c81c5a886dd8ecae)]
66
+ - Refs #263399 - Fix eslint errors. [GhitaB - [`a5259d9`](https://github.com/eea/volto-cca-policy/commit/a5259d92432e63e091aa3394ec9b944d628e948c)]
7
67
  ### [0.1.66](https://github.com/eea/volto-cca-policy/compare/0.1.65...0.1.66) - 26 January 2024
8
68
 
9
69
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.66",
3
+ "version": "0.1.68",
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",
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { MemoryRouter } from 'react-router-dom';
3
+ import configureStore from 'redux-mock-store';
4
+ import { render } from '@testing-library/react';
5
+ import '@testing-library/jest-dom/extend-expect';
6
+ import { Provider } from 'react-intl-redux';
7
+ import Filter from './Filter';
8
+
9
+ const mockStore = configureStore();
10
+
11
+ describe('Filter', () => {
12
+ it('should render the component', () => {
13
+ const data = {
14
+ thematicMapMode: 'hhap',
15
+ setThematicMapMode(param) {
16
+ return param;
17
+ },
18
+ };
19
+
20
+ const store = mockStore({
21
+ userSession: { token: '1234' },
22
+ intl: {
23
+ locale: 'en',
24
+ messages: {},
25
+ },
26
+ });
27
+
28
+ const { container } = render(
29
+ <Provider store={store}>
30
+ <MemoryRouter>
31
+ <Filter {...data} />
32
+ </MemoryRouter>
33
+ </Provider>,
34
+ );
35
+ expect(container.querySelector('#sections-selector')).toBeInTheDocument();
36
+ });
37
+ });
@@ -1,45 +1,6 @@
1
+ import { euCountryNames } from '../countryMap.js';
1
2
  export function getFocusCountryNames() {
2
- return [
3
- 'Albania',
4
- 'Austria',
5
- 'Belgium',
6
- 'Bosnia-Herzegovina',
7
- 'Bosnia and Herzegovina',
8
- 'Bulgaria',
9
- 'Cyprus',
10
- 'Croatia',
11
- 'Czechia',
12
- 'Denmark',
13
- 'Estonia',
14
- 'Finland',
15
- 'France',
16
- 'Germany',
17
- 'Greece',
18
- 'Hungary',
19
- 'Iceland',
20
- 'Ireland',
21
- 'Italy',
22
- 'Latvia',
23
- 'Lithuania',
24
- 'Luxembourg',
25
- 'Malta',
26
- 'Montenegro',
27
- 'Netherlands',
28
- 'North Macedonia',
29
- 'Poland',
30
- 'Portugal',
31
- 'Romania',
32
- 'Serbia',
33
- 'Slovakia',
34
- 'Slovenia',
35
- 'Spain',
36
- 'Sweden',
37
- 'United Kingdom',
38
- 'Liechtenstein',
39
- 'Norway',
40
- 'Switzerland',
41
- 'Turkey',
42
- ];
3
+ return euCountryNames;
43
4
  }
44
5
 
45
6
  export function getFocusCountriesFeature(world) {
@@ -123,9 +84,175 @@ export function renderCountriesBox(opts, d3, d3Geo) {
123
84
  renderCountry(map, country, path, countries, x, y, d3, countries_metadata);
124
85
  });
125
86
 
87
+ var mo = {
88
+ svg: svg,
89
+ world: world,
90
+ viewport: [width, height],
91
+ countries: ['Malta', 'Liechtenstein', 'Luxembourg'],
92
+ start: [width + 10, 10],
93
+ side: 'left',
94
+ // 'size': 80,
95
+ // 'space': 6,
96
+ };
97
+ drawMaplets(mo, d3);
98
+
126
99
  return path;
127
100
  }
128
101
 
102
+ function filterCountriesByNames(countries, filterIds) {
103
+ var features = {
104
+ type: 'FeatureCollection',
105
+ features: [],
106
+ };
107
+
108
+ // console.log('filterids', filterIds);
109
+ // filterIds has "Kosovo (under UNSCR 1244/99)" SHRT_ENGL is Kosovo
110
+ // filterIds has "Bosnia-Herzegovina", SHRT_ENGL is "Bosnia and Herzegovina"
111
+
112
+ // debugger;
113
+ countries.forEach(function (c) {
114
+ // var correct_name =
115
+ // correct_country_names[c.properties.SHRT_ENGL] || c.properties.SHRT_ENGL;
116
+ if (filterIds.indexOf(c.properties.SHRT_ENGL) === -1) {
117
+ return;
118
+ }
119
+ features.features.push(c);
120
+ });
121
+ return features;
122
+ }
123
+
124
+ function drawMaplets(opts, d3) {
125
+ var svg = opts.svg;
126
+ var world = opts.world;
127
+ var viewport = opts.viewport;
128
+ var start = opts.start;
129
+ var side = opts.side;
130
+
131
+ var g = svg // the map will be drawn in this group
132
+ .append('g')
133
+ .attr('class', 'maplet-container');
134
+ var countries = opts.countries;
135
+
136
+ // debugger;
137
+
138
+ countries.forEach(function (name, index) {
139
+ var feature = filterCountriesByNames(world, [name]);
140
+ var boxw = 50;
141
+ var boxh = 50;
142
+ var space = 10;
143
+
144
+ var mapletWorld = world.filter(function (country) {
145
+ return country.properties.SHRT_ENGL === name;
146
+ });
147
+
148
+ var msp = getMapletStartingPoint(
149
+ viewport,
150
+ start,
151
+ index,
152
+ side,
153
+ space,
154
+ [boxw, boxh],
155
+ 0,
156
+ );
157
+
158
+ var zo = {
159
+ world: mapletWorld,
160
+ svg: g,
161
+ coordinates: {
162
+ x: msp.x,
163
+ y: msp.y,
164
+ width: boxw,
165
+ height: boxh,
166
+ },
167
+ focusCountries: {
168
+ names: [name],
169
+ feature: feature,
170
+ },
171
+ zoom: 0.5,
172
+ isMaplet: true,
173
+ };
174
+ drawMaplet(zo, d3);
175
+ });
176
+ }
177
+
178
+ function drawMaplet(opts, d3) {
179
+ var msp = opts.coordinates;
180
+ var svg = opts.svg;
181
+ svg
182
+ .append('rect')
183
+ .attr('class', 'maplet-outline')
184
+ .attr('x', msp.x)
185
+ .attr('y', msp.y)
186
+ .attr('width', msp.width)
187
+ .attr('height', msp.height);
188
+
189
+ // var path = renderCountriesBox(opts, d3);
190
+ // renderCountryLabel(opts.focusCountries.feature.features[0], path, true);
191
+ }
192
+
193
+ function getMapletStartingPoint(
194
+ viewport, // an array of two integers, width and height
195
+ startPoint, // an array of two numbers, x, y for position in viewport
196
+ index, // integer, position in layout
197
+ side, // one of ['top', 'bottom', 'left', right']
198
+ spacer, // integer with amount of space to leave between Maplets
199
+ boxDim, // array of two numbers, box width and box height
200
+ titleHeight, // height of title box
201
+ ) {
202
+ // return value is array of x,y
203
+ // x: horizontal coordinate
204
+ // y: vertical coordinate
205
+
206
+ var bws = boxDim[0] + spacer; // box width including space to the right
207
+ var bhs = boxDim[1] + spacer + titleHeight;
208
+
209
+ var mutator = travelToOppositeMutator(startPoint, viewport, [bws, bhs]);
210
+
211
+ var mutPoint = [startPoint[0], startPoint[1]];
212
+
213
+ for (var i = 0; i < index; i++) {
214
+ mutPoint = mutator(mutPoint, index);
215
+ }
216
+
217
+ // TODO: this could be improved, there are many edge cases
218
+ switch (side) {
219
+ case 'top':
220
+ mutPoint[1] = startPoint[1];
221
+ break;
222
+ case 'bottom':
223
+ mutPoint[1] = startPoint[1] - bhs;
224
+ break;
225
+ case 'left':
226
+ mutPoint[0] = startPoint[0];
227
+ break;
228
+ case 'right':
229
+ default:
230
+ mutPoint[0] = startPoint[0] - bws;
231
+ break;
232
+ }
233
+
234
+ return {
235
+ x: mutPoint[0],
236
+ y: mutPoint[1],
237
+ };
238
+ }
239
+
240
+ function travelToOppositeMutator(start, viewport, delta) {
241
+ // point: the point we want to mutate
242
+ // start: starting point (the initial anchor point)
243
+ // viewport: array of width, height
244
+ // delta: array of dimensions to travel
245
+
246
+ var center = [viewport[0] / 2, viewport[1] / 2];
247
+
248
+ var dirx = start[0] > center[0] ? -1 : 1;
249
+ var diry = start[1] > center[1] ? -1 : 1;
250
+ return function (point) {
251
+ var res = [point[0] + delta[0] * dirx, point[1] + delta[1] * diry];
252
+ return res;
253
+ };
254
+ }
255
+
129
256
  function renderGraticule(container, klass, steps, pathTransformer, d3Geo) {
130
257
  container // draw primary graticule lines
131
258
  .append('g')
@@ -1,36 +1,6 @@
1
+ import { euCountryNames } from '../countryMap.js';
1
2
  export function getFocusCountryNames() {
2
- return [
3
- 'Austria',
4
- 'Belgium',
5
- 'Cyprus',
6
- 'Czechia',
7
- 'Denmark',
8
- 'Estonia',
9
- 'Finland',
10
- 'France',
11
- 'Germany',
12
- 'Greece',
13
- 'Hungary',
14
- 'Iceland',
15
- 'Ireland',
16
- 'Italy',
17
- 'Lithuania',
18
- 'Luxembourg',
19
- 'Malta',
20
- 'Netherlands',
21
- 'Poland',
22
- 'Portugal',
23
- 'Romania',
24
- 'Slovakia',
25
- 'Slovenia',
26
- 'Spain',
27
- 'Sweden',
28
- 'United Kingdom',
29
- 'Liechtenstein',
30
- 'Norway',
31
- 'Switzerland',
32
- 'Turkey',
33
- ];
3
+ return euCountryNames;
34
4
  }
35
5
 
36
6
  export function getFocusCountriesFeature(world) {
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { MemoryRouter } from 'react-router-dom';
3
+ import configureStore from 'redux-mock-store';
4
+ import { render } from '@testing-library/react';
5
+ import '@testing-library/jest-dom/extend-expect';
6
+ import { Provider } from 'react-intl-redux';
7
+ import Filter from './Filter';
8
+
9
+ const mockStore = configureStore();
10
+
11
+ describe('Filter', () => {
12
+ it('should render the component', () => {
13
+ const data = {
14
+ thematicMapMode: 'hhap',
15
+ setThematicMapMode(param) {
16
+ return param;
17
+ },
18
+ };
19
+
20
+ const store = mockStore({
21
+ userSession: { token: '1234' },
22
+ intl: {
23
+ locale: 'en',
24
+ messages: {},
25
+ },
26
+ });
27
+
28
+ const { container } = render(
29
+ <Provider store={store}>
30
+ <MemoryRouter>
31
+ <Filter {...data} />
32
+ </MemoryRouter>
33
+ </Provider>,
34
+ );
35
+ expect(container.querySelector('#sections-selector')).toBeInTheDocument();
36
+ });
37
+ });
@@ -1,39 +1,6 @@
1
+ import { euCountryNames } from '../countryMap.js';
1
2
  export function getFocusCountryNames() {
2
- return [
3
- 'Austria',
4
- 'Belgium',
5
- 'Bulgaria',
6
- 'Cyprus',
7
- 'Croatia',
8
- 'Czechia',
9
- 'Denmark',
10
- 'Estonia',
11
- 'Finland',
12
- 'France',
13
- 'Germany',
14
- 'Greece',
15
- 'Hungary',
16
- 'Iceland',
17
- 'Ireland',
18
- 'Italy',
19
- 'Latvia',
20
- 'Lithuania',
21
- 'Luxembourg',
22
- 'Malta',
23
- 'Netherlands',
24
- 'Poland',
25
- 'Portugal',
26
- 'Romania',
27
- 'Slovakia',
28
- 'Slovenia',
29
- 'Spain',
30
- 'Sweden',
31
- 'United Kingdom',
32
- 'Liechtenstein',
33
- 'Norway',
34
- 'Switzerland',
35
- 'Turkey',
36
- ];
3
+ return euCountryNames;
37
4
  }
38
5
 
39
6
  export function getFocusCountriesFeature(world) {
@@ -0,0 +1,41 @@
1
+ export const euCountryNames = [
2
+ 'Albania',
3
+ 'Austria',
4
+ 'Belgium',
5
+ 'Bosnia-Herzegovina',
6
+ 'Bosnia and Herzegovina',
7
+ 'Bulgaria',
8
+ 'Cyprus',
9
+ 'Croatia',
10
+ 'Czechia',
11
+ 'Denmark',
12
+ 'Estonia',
13
+ 'Finland',
14
+ 'France',
15
+ 'Germany',
16
+ 'Greece',
17
+ 'Hungary',
18
+ 'Iceland',
19
+ 'Ireland',
20
+ 'Italy',
21
+ 'Latvia',
22
+ 'Lithuania',
23
+ 'Luxembourg',
24
+ 'Malta',
25
+ 'Montenegro',
26
+ 'Netherlands',
27
+ 'North Macedonia',
28
+ 'Poland',
29
+ 'Portugal',
30
+ 'Romania',
31
+ 'Serbia',
32
+ 'Slovakia',
33
+ 'Slovenia',
34
+ 'Spain',
35
+ 'Sweden',
36
+ 'United Kingdom',
37
+ 'Liechtenstein',
38
+ 'Norway',
39
+ 'Switzerland',
40
+ 'Turkey',
41
+ ];
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { getBaseUrl } from '@plone/volto/helpers';
3
+ import { Breadcrumb } from 'semantic-ui-react';
4
+ import { useSelector, useDispatch } from 'react-redux';
5
+ import { Link, useLocation } from 'react-router-dom';
6
+ import { defineMessages, useIntl } from 'react-intl';
7
+
8
+ import ContentsBreadcrumbsRootItem from '@plone/volto/components/manage/Contents/ContentsBreadcrumbsRootItem';
9
+
10
+ import { getPhysicalBreadcrumbs } from '@eeacms/volto-cca-policy/store';
11
+
12
+ const messages = defineMessages({
13
+ home: {
14
+ id: 'Home',
15
+ defaultMessage: 'Home',
16
+ },
17
+ root: {
18
+ id: 'Root',
19
+ defaultMessage: 'Root',
20
+ },
21
+ });
22
+
23
+ const ContentsBreadcrumbs = () => {
24
+ const items = useSelector((state) => state.physicalBreadcrumbs.items || []);
25
+ const intl = useIntl();
26
+ const pathname = useLocation().pathname;
27
+ const dispatch = useDispatch();
28
+
29
+ React.useEffect(() => {
30
+ const url = getBaseUrl(pathname);
31
+ dispatch(getPhysicalBreadcrumbs(url));
32
+ }, [dispatch, pathname]);
33
+
34
+ return (
35
+ <Breadcrumb>
36
+ <Link
37
+ to="/contents"
38
+ className="section"
39
+ title={intl.formatMessage(messages.root)}
40
+ >
41
+ <ContentsBreadcrumbsRootItem />
42
+ </Link>
43
+ {items.map((breadcrumb, index, breadcrumbs) => [
44
+ <Breadcrumb.Divider key={`divider-${breadcrumb.url}`} />,
45
+ index < breadcrumbs.length - 1 ? (
46
+ <Link
47
+ key={breadcrumb.url}
48
+ to={`${breadcrumb.url}/contents`}
49
+ className="section"
50
+ >
51
+ {breadcrumb.nav_title || breadcrumb.title}
52
+ </Link>
53
+ ) : (
54
+ <Breadcrumb.Section key={breadcrumb.url} active>
55
+ {breadcrumb.nav_title || breadcrumb.title}
56
+ </Breadcrumb.Section>
57
+ ),
58
+ ])}
59
+ </Breadcrumb>
60
+ );
61
+ };
62
+
63
+ export default ContentsBreadcrumbs;
@@ -0,0 +1,3 @@
1
+ Based on https://github.com/plone/volto/blob/bb1753d13d2adfa4ee33aaed5a0606ac0255d1f8/packages/volto/src/components/manage/Contents/ContentsBreadcrumbs.jsx
2
+
3
+ Customized because we want to use the @physical-breadcrumbs instead of the regular breadcrumbs. Needs dedicated endpoint support
package/src/index.js CHANGED
@@ -23,6 +23,7 @@ import europeanComissionLogo from '@eeacms/volto-cca-policy/../theme/assets/imag
23
23
 
24
24
  import installBlocks from './components/manage/Blocks';
25
25
  import installSearchEngine from './search';
26
+ import installStore from './store';
26
27
 
27
28
  import GeocharsWidget from './components/theme/Widgets/GeocharsWidget';
28
29
  import GeolocationWidget from './components/theme/Widgets/GeolocationWidget';
@@ -346,12 +347,6 @@ const applyConfig = (config) => {
346
347
  config = installExpressMiddleware(config);
347
348
  }
348
349
 
349
- // fixes bug caused by https://github.com/eea/volto-eea-website-theme/commit/94078403458a5a3ea725ce9126fffed9d463097d
350
- config.settings.apiExpanders.push({
351
- match: '',
352
- GET_CONTENT: ['breadcrumbs'], // 'navigation', 'actions', 'types'],
353
- });
354
-
355
350
  config.addonRoutes = [
356
351
  {
357
352
  path: `/(${config.settings?.supportedLanguages.join(
@@ -363,7 +358,7 @@ const applyConfig = (config) => {
363
358
  ...(config.addonRoutes || []),
364
359
  ];
365
360
 
366
- return compose(installBlocks, installSearchEngine)(config);
361
+ return compose(installBlocks, installSearchEngine, installStore)(config);
367
362
  };
368
363
 
369
364
  export default applyConfig;
@@ -14,12 +14,54 @@ export const clusters = {
14
14
  name: 'op_cluster',
15
15
  field: 'objectProvides',
16
16
  clusters: [
17
- // {
18
- // name: 'Type1',
19
- // icon: { name: 'bullhorn' },
20
- // values: ['Video', 'Guidance'],
21
- // defaultResultView: 'horizontalCard',
22
- // },
17
+ {
18
+ name: 'Case studies',
19
+ icon: { name: 'file text' },
20
+ values: ['Case study'],
21
+ defaultResultView: 'horizontalCard',
22
+ },
23
+ {
24
+ name: 'Guidance',
25
+ icon: { name: 'compass' },
26
+ values: ['Guidance'],
27
+ defaultResultView: 'horizontalCard',
28
+ },
29
+ {
30
+ name: 'Indicators',
31
+ icon: { name: 'area chart' },
32
+ values: ['Indicator'],
33
+ defaultResultView: 'horizontalCard',
34
+ },
35
+ {
36
+ name: 'Information portals',
37
+ icon: { name: 'info circle' },
38
+ values: ['Information portal'],
39
+ defaultResultView: 'horizontalCard',
40
+ },
41
+ {
42
+ name: 'Publications and reports',
43
+ icon: { name: 'newspaper' },
44
+ values: ['Publication reference'],
45
+ defaultResultView: 'horizontalCard',
46
+ },
47
+ {
48
+ name: 'Research and knowledge projects',
49
+ icon: { name: 'university' },
50
+ values: ['Research and knowledge project'],
51
+ defaultResultView: 'horizontalCard',
52
+ },
53
+ {
54
+ name: 'Tools',
55
+ icon: { name: 'wrench' },
56
+ values: ['Tool'],
57
+ defaultResultView: 'horizontalCard',
58
+ },
59
+ {
60
+ name: 'Videos',
61
+ icon: { name: 'video play' },
62
+ values: ['Video'],
63
+ defaultResultView: 'horizontalCard',
64
+ },
23
65
  ],
24
66
  };
25
67
 
@@ -53,7 +95,17 @@ export default function installMainSearch(config) {
53
95
  cca_include_in_search_observatory: 'true',
54
96
  },
55
97
  });
56
-
98
+ ccaHealthSearch.contentSectionsParams = {
99
+ enable: true,
100
+ sectionFacetsField: 'op_cluster',
101
+ sections: clusters.clusters,
102
+ clusterMapping: Object.assign(
103
+ {},
104
+ ...clusters.clusters.map(({ name, values }) =>
105
+ Object.assign({}, ...values.map((v) => ({ [v]: name }))),
106
+ ),
107
+ ),
108
+ };
57
109
  ccaHealthSearch.permanentFilters.push({
58
110
  terms: {
59
111
  objectProvides: [
@@ -110,5 +162,12 @@ export default function installMainSearch(config) {
110
162
  process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
111
163
  }
112
164
 
165
+ ccaHealthSearch.icons['Content types'] = Object.assign(
166
+ {
167
+ ...ccaHealthSearch.icons['Content types'],
168
+ },
169
+ ...clusters.clusters.map((cluster) => ({ [cluster.name]: cluster.icon })),
170
+ );
171
+
113
172
  return config;
114
173
  }
@@ -26,8 +26,20 @@ const healthImpacts = {
26
26
  isFilterable: false,
27
27
  show: 10000,
28
28
  isMulti: true,
29
+ alwaysVisible: true,
29
30
  // sortOn: 'custom',
30
31
  // sortOnCustomLabel: 'Alphabetical',
32
+ facetValues: [
33
+ 'Air pollution and aero-allergens',
34
+ 'Climate-sensitive diseases',
35
+ 'Droughts and floods',
36
+ 'Heat',
37
+ 'Wildfires',
38
+ '-NONSPECIFIC-',
39
+ ],
40
+ sortOn: 'custom',
41
+ sortOrder: 'ascending',
42
+ sortOnCustomLabel: 'Alphabetical',
31
43
  };
32
44
 
33
45
  const partnerContributions = {
@@ -39,6 +51,7 @@ const partnerContributions = {
39
51
  isFilterable: false,
40
52
  show: 10000,
41
53
  isMulti: true,
54
+ alwaysVisible: true,
42
55
  // sortOn: 'custom',
43
56
  // sortOnCustomLabel: 'Alphabetical',
44
57
  };
@@ -0,0 +1,11 @@
1
+ import { GET_PHYSICAL_BREADCRUMBS } from '../constants';
2
+
3
+ export function getPhysicalBreadcrumbs(url) {
4
+ return {
5
+ type: GET_PHYSICAL_BREADCRUMBS,
6
+ request: {
7
+ op: 'get',
8
+ path: `${url}/@physical-breadcrumbs`,
9
+ },
10
+ };
11
+ }
@@ -0,0 +1 @@
1
+ export const GET_PHYSICAL_BREADCRUMBS = 'GET_PHYSICAL_BREADCRUMBS';
@@ -0,0 +1,7 @@
1
+ import physicalBreadcrumbs from './reducers/physical-breadcrumbs';
2
+ export { getPhysicalBreadcrumbs } from './actions/physical-breadcrumbs';
3
+
4
+ export default function installStore(config) {
5
+ config.addonReducers.physicalBreadcrumbs = physicalBreadcrumbs;
6
+ return config;
7
+ }
@@ -0,0 +1,46 @@
1
+ import { map } from 'lodash';
2
+ import { flattenToAppURL } from '@plone/volto/helpers';
3
+
4
+ import { GET_PHYSICAL_BREADCRUMBS } from '../constants';
5
+
6
+ const initialState = {
7
+ error: null,
8
+ items: [],
9
+ root: null,
10
+ loaded: false,
11
+ loading: false,
12
+ };
13
+
14
+ export default function physicalBreadcrumbs(state = initialState, action = {}) {
15
+ switch (action.type) {
16
+ case `${GET_PHYSICAL_BREADCRUMBS}_PENDING`:
17
+ return {
18
+ ...state,
19
+ error: null,
20
+ loaded: false,
21
+ loading: true,
22
+ };
23
+ case `${GET_PHYSICAL_BREADCRUMBS}_SUCCESS`:
24
+ return {
25
+ ...state,
26
+ error: null,
27
+ items: map(action.result.items, (item) => ({
28
+ title: item.title,
29
+ url: flattenToAppURL(item['@id']),
30
+ })),
31
+ root: flattenToAppURL(action.result.root),
32
+ loaded: true,
33
+ loading: false,
34
+ };
35
+ case `${GET_PHYSICAL_BREADCRUMBS}_FAIL`:
36
+ return {
37
+ ...state,
38
+ error: action.error,
39
+ items: [],
40
+ loaded: false,
41
+ loading: false,
42
+ };
43
+ default:
44
+ return state;
45
+ }
46
+ }
@@ -273,3 +273,12 @@ body.subsite {
273
273
  display: flex;
274
274
  margin-right: auto;
275
275
  }
276
+
277
+ body.searchlib-page .searchlib-block {
278
+ .ui.secondary.pointing.content-section-tabs.menu {
279
+ .active.item .tab-icon .count {
280
+ background-color: @ccaGreenColor;
281
+ border-color: @ccaGreenColor;
282
+ }
283
+ }
284
+ }
@@ -10,6 +10,7 @@
10
10
 
11
11
  // @primaryColor: @green-6;
12
12
  @secondaryColor: #005c97;
13
+ @ccaGreenColor: #8a9c39;
13
14
 
14
15
  // @linkColor: @secondaryColor;
15
16
  // @linkHoverColor: @primaryColor;