@eeacms/volto-cca-policy 0.2.43 → 0.2.44

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,20 @@ 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.44](https://github.com/eea/volto-cca-policy/compare/0.2.43...0.2.44) - 20 June 2024
8
+
9
+ #### :nail_care: Enhancements
10
+
11
+ - change(block): RAST svg styling [kreafox - [`da47397`](https://github.com/eea/volto-cca-policy/commit/da47397a0513b8ff55a3796712b7f70c64ec2966)]
12
+
13
+ #### :house: Internal changes
14
+
15
+ - style: Automated code fix [eea-jenkins - [`b41cc24`](https://github.com/eea/volto-cca-policy/commit/b41cc24fcaf25a32af2fed778af7183b942c2dbd)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - Fix bugs [Tiberiu Ichim - [`9585833`](https://github.com/eea/volto-cca-policy/commit/9585833739e2e951bff24c5a33c2d99ab36fb0c1)]
20
+ - Update snapshots [Tiberiu Ichim - [`15a62cf`](https://github.com/eea/volto-cca-policy/commit/15a62cf96d5b112e1d3cf1df44c6758ce0e2d73c)]
7
21
  ### [0.2.43](https://github.com/eea/volto-cca-policy/compare/0.2.42...0.2.43) - 13 June 2024
8
22
 
9
23
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
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",
@@ -6,7 +6,7 @@ import View from './CollectionStatsView';
6
6
  import TransparentOverlay from '../../TransparentOverlay';
7
7
 
8
8
  const Edit = (props) => {
9
- const schema = Schema();
9
+ const schema = Schema(props.data);
10
10
  return (
11
11
  <>
12
12
  <TransparentOverlay>
@@ -66,21 +66,29 @@ const makeSearchBlockQuery = ({ base, query, field, value }) => {
66
66
  return `${base}?${params}`;
67
67
  };
68
68
 
69
- const makeEEASearchQuery = ({ base, field, value }) => {
69
+ const makeEEASearchQuery = ({ base, field, value, extraFilters }) => {
70
70
  // TODO: don't hardcode the language
71
- const rest =
72
- 'filters[1][field]=issued.date' +
73
- '&filters[1][values][0]=Last 5 years' +
74
- '&filters[1][type]=any' +
75
- '&filters[2][field]=language' +
76
- '&filters[2][values][0]=en' +
77
- '&filters[2][type]=any' +
78
- '&sort-field=issued.date' +
79
- '&sort-direction=desc';
80
-
81
- const filter = `filters[0][field]=${field}&filters[0][type]=any&filters[0][values][0]=${value}`;
82
-
83
- return `${base}?size=n_10_n&${filter}&${rest}`;
71
+ const allFields = [
72
+ ['issued.date', 'Last 5 years'],
73
+ ['language', 'en'],
74
+ [field, value],
75
+ ...(extraFilters?.map(({ id, value }) => [id, value]) || []),
76
+ ];
77
+
78
+ const rest = '&sort-field=issued.date&sort-direction=desc';
79
+
80
+ // See FilterAceContentView
81
+ const filters = allFields
82
+ .map(([name, anyValue], index) =>
83
+ [
84
+ `filters[${index}][field]=${name}`,
85
+ `filters[${index}][type]=any`,
86
+ `filters[${index}][values][0]=${anyValue}`,
87
+ ].join('&'),
88
+ )
89
+ .join('&');
90
+
91
+ return `${base}?size=n_10_n&${filters}&${rest}`;
84
92
  };
85
93
 
86
94
  const urlBuilders = {
@@ -116,6 +124,7 @@ export default function CollectionStatsView(props) {
116
124
 
117
125
  const keys = Object.keys(stats);
118
126
  const urlHandler = urlBuilders[queryParameterStyle] || nop;
127
+ const extraFilters = data?.extraFilters || [];
119
128
 
120
129
  return (
121
130
  (field && keys.length > 0 && (
@@ -133,6 +142,7 @@ export default function CollectionStatsView(props) {
133
142
  query: query.query,
134
143
  field: groupDefinition.searchFieldName || field,
135
144
  value: kV,
145
+ extraFilters,
136
146
  })}
137
147
  >
138
148
  <IconComponent
@@ -3,14 +3,36 @@ import {
3
3
  hasDateOperation,
4
4
  } from '@plone/volto/components/manage/Blocks/Search/utils';
5
5
 
6
- const Schema = () => {
6
+ const ExtraFilter = (_) => ({
7
+ title: 'Extra Filters',
8
+ fieldsets: [{ id: 'default', fields: ['id', 'value'], title: 'Default' }],
9
+ properties: {
10
+ id: {
11
+ title: 'Field ID',
12
+ },
13
+ value: {
14
+ title: 'Filter value',
15
+ },
16
+ },
17
+ required: [],
18
+ });
19
+
20
+ const Schema = (formData) => {
21
+ const isEEASearch = formData?.queryParameterStyle === 'EEASemanticSearch';
22
+
7
23
  return {
8
24
  title: 'Collection Statistics',
9
25
  fieldsets: [
10
26
  {
11
27
  id: 'default',
12
28
  title: 'Default',
13
- fields: ['aggregateField', 'queryParameterStyle', 'href', 'showLabel'],
29
+ fields: [
30
+ 'aggregateField',
31
+ 'queryParameterStyle',
32
+ 'href',
33
+ 'showLabel',
34
+ ...(isEEASearch ? ['extraFilters'] : []),
35
+ ],
14
36
  },
15
37
  {
16
38
  id: 'query',
@@ -68,6 +90,12 @@ const Schema = () => {
68
90
  selectedItemAttrs: [],
69
91
  allowExternals: true,
70
92
  },
93
+ extraFilters: {
94
+ title: 'Extra filters',
95
+ widget: 'object_list',
96
+ schema: ExtraFilter({ formData }),
97
+ // schemaExtender: (schema) => schema,
98
+ },
71
99
  },
72
100
  required: [],
73
101
  };
@@ -1,11 +1,17 @@
1
1
  import React from 'react';
2
2
  import { UniversalLink } from '@plone/volto/components';
3
+ import cx from 'classnames';
3
4
  import './styles.less';
4
5
 
5
- const LinkWrap = ({ item, pathname, children, isActive }) => {
6
+ const LinkWrap = ({ item, children, isActive, className }) => {
6
7
  return item ? (
7
- <UniversalLink item={item} className="step-link">
8
- <g className={isActive ? 'link-active' : ''}>
8
+ <UniversalLink
9
+ item={item}
10
+ className={cx('step-link', className, {
11
+ active: isActive,
12
+ })}
13
+ >
14
+ <g>
9
15
  <title>{item.title}</title>
10
16
  {children}
11
17
  </g>
@@ -15,8 +21,6 @@ const LinkWrap = ({ item, pathname, children, isActive }) => {
15
21
  );
16
22
  };
17
23
 
18
- // export default function RASTView(props) {
19
- // const RASTView = (props) => {
20
24
  export default function RASTMap(props) {
21
25
  const { path, pathname, activeMenu, skip_items } = props;
22
26
  const currentPath = path || pathname;
@@ -29,7 +33,7 @@ export default function RASTMap(props) {
29
33
 
30
34
  if (activeMenu !== null) {
31
35
  if (data.includes(activeMenu.toString())) {
32
- currentMenu = -1;
36
+ currentMenu = null;
33
37
  } else {
34
38
  let activeMenuMinus = 0;
35
39
  for (let i = 0; i < data.length; i++) {
@@ -40,7 +44,11 @@ export default function RASTMap(props) {
40
44
  }
41
45
 
42
46
  return (
43
- <div className="rast-map-block">
47
+ <div
48
+ className={cx('rast-map-block', {
49
+ landing: currentMenu === null,
50
+ })}
51
+ >
44
52
  <svg
45
53
  width="290"
46
54
  height="280"
@@ -337,6 +345,7 @@ export default function RASTMap(props) {
337
345
  item={items[0]}
338
346
  pathname={currentPath}
339
347
  isActive={currentMenu === 0 ? true : false}
348
+ className="step-0"
340
349
  >
341
350
  <path
342
351
  d="M210.5 32C222.4 32 232 41.6 232 53.5C232 65.4 222.4 75 210.5 75C198.6 75 189 65.4 189 53.5C189 41.6 198.6 32 210.5 32Z"
@@ -356,6 +365,7 @@ export default function RASTMap(props) {
356
365
  item={items[1]}
357
366
  pathname={currentPath}
358
367
  isActive={currentMenu === 1 ? true : false}
368
+ className="step-1"
359
369
  >
360
370
  <path
361
371
  d="M260.5 128C272.4 128 282 137.6 282 149.5C282 161.4 272.4 171 260.5 171C248.6 171 239 161.4 239 149.5C239 137.6 248.6 128 260.5 128Z"
@@ -375,6 +385,7 @@ export default function RASTMap(props) {
375
385
  item={items[2]}
376
386
  pathname={currentPath}
377
387
  isActive={currentMenu === 2 ? true : false}
388
+ className="step-2"
378
389
  >
379
390
  <path
380
391
  d="M210.5 228C222.4 228 232 237.6 232 249.5C232 261.4 222.4 271 210.5 271C198.6 271 189 261.4 189 249.5C189 237.6 198.6 228 210.5 228Z"
@@ -394,6 +405,7 @@ export default function RASTMap(props) {
394
405
  item={items[3]}
395
406
  pathname={currentPath}
396
407
  isActive={currentMenu === 3 ? true : false}
408
+ className="step-3"
397
409
  >
398
410
  <path
399
411
  d="M82.5 228C94.4 228 104 237.6 104 249.5C104 261.4 94.4 271 82.5 271C70.6 271 61 261.4 61 249.5C61 237.6 70.6 228 82.5 228Z"
@@ -413,6 +425,7 @@ export default function RASTMap(props) {
413
425
  item={items[4]}
414
426
  pathname={currentPath}
415
427
  isActive={currentMenu === 4 ? true : false}
428
+ className="step-4"
416
429
  >
417
430
  <path
418
431
  d="M29.5 128C41.4 128 51 137.6 51 149.5C51 161.4 41.4 171 29.5 171C17.6 171 8 161.4 8 149.5C8 137.6 17.6 128 29.5 128Z"
@@ -432,6 +445,7 @@ export default function RASTMap(props) {
432
445
  item={items[5]}
433
446
  pathname={currentPath}
434
447
  isActive={currentMenu === 5 ? true : false}
448
+ className="step-5"
435
449
  >
436
450
  <path
437
451
  d="M82.5 32C94.4 32 104 41.6 104 53.5C104 65.4 94.4 75 82.5 75C70.6 75 61 65.4 61 53.5C61 41.6 70.6 32 82.5 32Z"
@@ -3,52 +3,104 @@
3
3
 
4
4
  @import (multiple, reference, optional) '../../theme.config';
5
5
 
6
- .rast-block {
7
- a rect.circle:hover {
8
- fill: #183 !important;
9
- }
6
+ .rast-map-block {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ margin-bottom: 2em;
10
11
 
11
- // a rect.circle {
12
- // pointer-events: all !important;
13
- // }
12
+ &:not(.landing) {
13
+ .step-0:not(.active) g path:nth-of-type(1) {
14
+ fill: #0c3330;
15
+ }
14
16
 
15
- // svg,
16
- // svg * {
17
- // pointer-events: none;
18
- // }
17
+ .step-1:not(.active) g path:nth-of-type(1) {
18
+ fill: #031624;
19
+ }
19
20
 
20
- .step-link:hover {
21
- .circle {
22
- filter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 1));
21
+ .step-2:not(.active) g path:nth-of-type(1) {
22
+ fill: #081936;
23
23
  }
24
- }
25
24
 
26
- .link-active {
27
- .circle {
28
- filter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 1));
25
+ .step-3:not(.active) g path:nth-of-type(1) {
26
+ fill: #262c4e;
29
27
  }
28
+
29
+ .step-4:not(.active) g path:nth-of-type(1) {
30
+ fill: #534022;
31
+ }
32
+
33
+ .step-5:not(.active) g path:nth-of-type(1) {
34
+ fill: #39531f;
35
+ }
36
+
37
+ .step-link {
38
+ path:nth-of-type(2),
39
+ path:nth-of-type(3) {
40
+ fill: #929eaf;
41
+ }
42
+ }
43
+ }
44
+
45
+ .step-link {
46
+ transform-box: fill-box;
47
+ transform-origin: 50% 50%;
48
+ transition: 0.3s all;
49
+ }
50
+
51
+ .step-0.step-link:hover g path:nth-of-type(1),
52
+ .step-0.step-link.active g path:nth-of-type(1) {
53
+ fill: #155246;
54
+ }
55
+
56
+ .step-1.step-link:hover g path:nth-of-type(1),
57
+ .step-1.step-link.active g path:nth-of-type(1) {
58
+ fill: #062435;
30
59
  }
31
60
 
32
- .item.active a {
33
- font-weight: bold;
61
+ .step-2.step-link:hover g path:nth-of-type(1),
62
+ .step-2.step-link.active g path:nth-of-type(1) {
63
+ fill: #0d284f;
34
64
  }
35
65
 
36
- .ui.accordion .active.content {
37
- padding: 1rem 1rem !important;
66
+ .step-3.step-link:hover g path:nth-of-type(1),
67
+ .step-3.step-link.active g path:nth-of-type(1) {
68
+ fill: #434772;
38
69
  }
39
70
 
40
- .substep a {
41
- color: inherit;
71
+ .step-4.step-link:hover g path:nth-of-type(1),
72
+ .step-4.step-link.active g path:nth-of-type(1) {
73
+ fill: #926830;
42
74
  }
43
75
 
44
- .substep:not(:last-child) {
45
- padding-bottom: 0.8em;
76
+ .step-5.step-link:hover g path:nth-of-type(1),
77
+ .step-5.step-link.active g path:nth-of-type(1) {
78
+ fill: #64862c;
46
79
  }
47
80
 
48
- .rast-map-block {
49
- display: flex;
50
- align-items: center;
51
- justify-content: center;
52
- margin-bottom: 2em;
81
+ .step-link:hover,
82
+ .step-link.active {
83
+ transform: scale(1.3, 1.3);
84
+
85
+ path:nth-of-type(2),
86
+ path:nth-of-type(3) {
87
+ fill: #fff;
88
+ }
89
+
90
+ .step-link .item.active a {
91
+ font-weight: bold;
92
+ }
93
+
94
+ .ui.accordion .active.content {
95
+ padding: 1rem 1rem !important;
96
+ }
97
+
98
+ .substep a {
99
+ color: inherit;
100
+ }
101
+
102
+ .substep:not(:last-child) {
103
+ padding-bottom: 0.8em;
104
+ }
53
105
  }
54
106
  }
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
- import { expandToBackendURL } from '@plone/volto/helpers';
3
- import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
4
- import { Grid, Container, Segment, Button, Icon } from 'semantic-ui-react';
2
+ import { Grid, Container, Segment } from 'semantic-ui-react';
5
3
  import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
6
4
  import {
7
5
  SubjectTags,
@@ -11,15 +9,7 @@ import {
11
9
  import { filterBlocks } from '@eeacms/volto-cca-policy/utils';
12
10
  import { PortalMessage } from '@eeacms/volto-cca-policy/components';
13
11
 
14
- const messages = defineMessages({
15
- downloadEvent: {
16
- id: 'Download this event in iCal format',
17
- defaultMessage: 'Download this event in iCal format',
18
- },
19
- });
20
-
21
12
  function EventView(props) {
22
- const intl = useIntl();
23
13
  const { content } = props;
24
14
  const {
25
15
  blocks: filtered_blocks,
@@ -56,41 +46,6 @@ function EventView(props) {
56
46
  <Grid.Column mobile={12} tablet={12} computer={4}>
57
47
  <Segment>
58
48
  <EventDetails {...props} />
59
- {content?.event_url && (
60
- <>
61
- <h4>
62
- <FormattedMessage id="Web" defaultMessage="Web" />
63
- </h4>
64
- <p>
65
- <a href={content.event_url} target="_blank">
66
- <FormattedMessage
67
- id="Visit external website"
68
- defaultMessage="Visit external website"
69
- />
70
- </a>
71
- </p>
72
- </>
73
- )}
74
-
75
- <div className="download-event">
76
- <a
77
- className="ics-download"
78
- target="_blank"
79
- rel="noreferrer"
80
- href={`${expandToBackendURL(content['@id'])}/ics_view`}
81
- >
82
- <Button
83
- className="icon inverted primary labeled"
84
- title={intl.formatMessage(messages.downloadEvent)}
85
- >
86
- <Icon name="calendar alternate outline" />
87
- <FormattedMessage
88
- id="Download Event"
89
- defaultMessage="Download Event"
90
- />
91
- </Button>
92
- </a>
93
- </div>
94
49
  </Segment>
95
50
  </Grid.Column>
96
51
  </Grid.Row>
@@ -1,17 +1,18 @@
1
1
  import React, { Fragment } from 'react';
2
+ import { expandToBackendURL } from '@plone/volto/helpers';
2
3
  import { Link } from 'react-router-dom';
3
- import { FormattedMessage } from 'react-intl';
4
- import { UniversalLink } from '@plone/volto/components';
5
- import config from '@plone/volto/registry';
4
+ import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
6
5
  import {
7
6
  Segment,
8
7
  Image,
9
8
  ListItem,
10
9
  List,
11
- Button,
12
10
  Icon,
13
11
  Label,
12
+ Button,
14
13
  } from 'semantic-ui-react';
14
+ import { UniversalLink } from '@plone/volto/components';
15
+ import config from '@plone/volto/registry';
15
16
  import {
16
17
  CASE_STUDY,
17
18
  PUBLICATION_REPORT,
@@ -22,9 +23,12 @@ import {
22
23
  } from '@eeacms/volto-cca-policy/helpers/Constants';
23
24
  import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
24
25
  import { makeContributionsSearchQuery } from '@eeacms/volto-cca-policy/helpers';
25
- import { useIntl, defineMessages } from 'react-intl';
26
26
 
27
27
  const messages = defineMessages({
28
+ downloadEvent: {
29
+ id: 'Download this event in iCal format',
30
+ defaultMessage: 'Download this event in iCal format',
31
+ },
28
32
  documents: {
29
33
  id: 'Documents',
30
34
  defaultMessage: 'Documents',
@@ -449,8 +453,29 @@ export const SubjectTags = (props) => {
449
453
  ) : null;
450
454
  };
451
455
 
456
+ export const WebDetails = (props) => {
457
+ const { content } = props;
458
+ const eventUrl = content?.event_url;
459
+ return eventUrl ? (
460
+ <>
461
+ <h4>
462
+ <FormattedMessage id="Web" defaultMessage="Web" />
463
+ </h4>
464
+ <p>
465
+ <a href={eventUrl} target="_blank">
466
+ <FormattedMessage
467
+ id="Visit external website"
468
+ defaultMessage="Visit external website"
469
+ />
470
+ </a>
471
+ </p>
472
+ </>
473
+ ) : null;
474
+ };
475
+
452
476
  export const EventDetails = (props) => {
453
477
  const { content } = props;
478
+ const intl = useIntl();
454
479
 
455
480
  return (
456
481
  <>
@@ -479,6 +504,28 @@ export const EventDetails = (props) => {
479
504
  <p>{content.contact_email}</p>
480
505
  </>
481
506
  )}
507
+
508
+ <WebDetails {...props} />
509
+
510
+ <div className="download-event">
511
+ <a
512
+ className="ics-download"
513
+ target="_blank"
514
+ rel="noreferrer"
515
+ href={`${expandToBackendURL(content['@id'])}/ics_view`}
516
+ >
517
+ <Button
518
+ className="icon inverted primary labeled"
519
+ title={intl.formatMessage(messages.downloadEvent)}
520
+ >
521
+ <Icon name="calendar alternate outline" />
522
+ <FormattedMessage
523
+ id="Download Event"
524
+ defaultMessage="Download Event"
525
+ />
526
+ </Button>
527
+ </a>
528
+ </div>
482
529
  </>
483
530
  );
484
531
  };