@eeacms/volto-cca-policy 0.1.81 → 0.1.83

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,11 +4,39 @@ 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.81](https://github.com/eea/volto-cca-policy/compare/0.1.80...0.1.81) - 21 February 2024
7
+ ### [0.1.83](https://github.com/eea/volto-cca-policy/compare/0.1.82...0.1.83) - 26 February 2024
8
8
 
9
9
  #### :hammer_and_wrench: Others
10
10
 
11
- - Don't hide the section header [Tiberiu Ichim - [`f7d9ded`](https://github.com/eea/volto-cca-policy/commit/f7d9ded5932b8636d3f485e5184639f8d88f3d33)]
11
+ - Refs #265786 - Fix go to contact info (in case of email vs website url). [GhitaB - [`38029dc`](https://github.com/eea/volto-cca-policy/commit/38029dc5bcb21423b8b9edea8aef9627cc06b8a5)]
12
+ - Refs #265786 - Fix go to contact info (in case of email vs website url). [GhitaB - [`4a45be0`](https://github.com/eea/volto-cca-policy/commit/4a45be04c57305874fb38952a354c7fc2e630c10)]
13
+ - Refs #265786 - Event cards listing: fix icon to stay on the same line. [GhitaB - [`d7c32ae`](https://github.com/eea/volto-cca-policy/commit/d7c32aed9d0a66cd618daeb38ae8a8bb9c400be4)]
14
+ - Refs #265786 - Event cards listing: improve styles, add email info and subjects tags. [GhitaB - [`3c92d54`](https://github.com/eea/volto-cca-policy/commit/3c92d54ceb88a4dd28536e99398412e1e4532b8d)]
15
+ - Refs #265786 - Event cards listing: improve styles, improve day display. [GhitaB - [`80b0fe0`](https://github.com/eea/volto-cca-policy/commit/80b0fe047f254483664e5528871e1d51c02830e1)]
16
+ - Refs #265786 - Implement events cards listing variation to be used for listing events. [GhitaB - [`73a77f2`](https://github.com/eea/volto-cca-policy/commit/73a77f2430568f3b20749f77c986720c6a5dab81)]
17
+ - Add Display customization, to avoid crash in homepage [Tiberiu Ichim - [`6e3196b`](https://github.com/eea/volto-cca-policy/commit/6e3196b4298c0ec6adfb73df682b9adfa3cd9fae)]
18
+ ### [0.1.82](https://github.com/eea/volto-cca-policy/compare/0.1.81...0.1.82) - 24 February 2024
19
+
20
+ #### :house: Internal changes
21
+
22
+ - style: Automated code fix [eea-jenkins - [`3107391`](https://github.com/eea/volto-cca-policy/commit/31073918d51bcd0adbe929cfea001671b892e04f)]
23
+
24
+ #### :hammer_and_wrench: Others
25
+
26
+ - Code cleanup [Tiberiu Ichim - [`47a937c`](https://github.com/eea/volto-cca-policy/commit/47a937c76eeb4d31cf69bdfc84986b4a7b5a53fb)]
27
+ - Use a json file [Tiberiu Ichim - [`cd5307e`](https://github.com/eea/volto-cca-policy/commit/cd5307e14b72e27582e323fa5bd7355e246c886e)]
28
+ - Eslint [Tiberiu Ichim - [`9a79b88`](https://github.com/eea/volto-cca-policy/commit/9a79b882251c83c523c5ac3cfc4d74bed10f2727)]
29
+ - Eslint [Tiberiu Ichim - [`367d0b6`](https://github.com/eea/volto-cca-policy/commit/367d0b632f09e2d7d47289e777019d3257982c0d)]
30
+ - Show tags in news item [Tiberiu Ichim - [`4660adc`](https://github.com/eea/volto-cca-policy/commit/4660adc38a9cc7d0f34db021918e6148f1aef367)]
31
+ - Add newsitem view [Tiberiu Ichim - [`ce83fec`](https://github.com/eea/volto-cca-policy/commit/ce83feca8dc01df52cb410c0a1da748663f75271)]
32
+ - Show blocks in CCAEventView [Tiberiu Ichim - [`89e0e78`](https://github.com/eea/volto-cca-policy/commit/89e0e7864a9a490812bc2599ac0a5c8bca3668b4)]
33
+ - Add event view view [Tiberiu Ichim - [`a4dfcd7`](https://github.com/eea/volto-cca-policy/commit/a4dfcd7b4d560db839eb7d6b116584e82d2bb706)]
34
+ - Fix hit enter in layout settings block [Tiberiu Ichim - [`5774d3e`](https://github.com/eea/volto-cca-policy/commit/5774d3e1d6332b8661aa1a78a9b300820b2d4f1c)]
35
+ - test: increase coverage [kreafox - [`334a6a3`](https://github.com/eea/volto-cca-policy/commit/334a6a374d6af8e4856c1be5bcee073a619c88af)]
36
+ - test: fix ES lint warnings [kreafox - [`e884310`](https://github.com/eea/volto-cca-policy/commit/e88431084ddaa6298541ac2a9edefcc45b26ea0e)]
37
+ - Add details [Tiberiu Ichim - [`ad521be`](https://github.com/eea/volto-cca-policy/commit/ad521bed6f11d4fdf8590eac5dc9f5352d05dd27)]
38
+ ### [0.1.81](https://github.com/eea/volto-cca-policy/compare/0.1.80...0.1.81) - 21 February 2024
39
+
12
40
  ### [0.1.80](https://github.com/eea/volto-cca-policy/compare/0.1.79...0.1.80) - 21 February 2024
13
41
 
14
42
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.81",
3
+ "version": "0.1.83",
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 @@
1
+ export BannerTitle from './theme/BannerTitle/BannerTitle';
@@ -0,0 +1,167 @@
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 './styles.less';
7
+ import { ConditionalLink } from '@plone/volto/components';
8
+ import { Icon } from 'semantic-ui-react';
9
+ import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
10
+ import { Card, Grid } from 'semantic-ui-react';
11
+ import { Label } from 'semantic-ui-react';
12
+
13
+ const Separator = () => {
14
+ return <div className="sep">&nbsp;&nbsp;⎯&nbsp;&nbsp;</div>;
15
+ };
16
+
17
+ const StartDate = (start) => {
18
+ const start_date = new Date(start);
19
+
20
+ const day = start_date.getDate();
21
+ const monthIndex = start_date.getMonth();
22
+
23
+ const monthNames = [
24
+ 'Jan',
25
+ 'Feb',
26
+ 'Mar',
27
+ 'Apr',
28
+ 'May',
29
+ 'Jun',
30
+ 'Jul',
31
+ 'Aug',
32
+ 'Sep',
33
+ 'Oct',
34
+ 'Nov',
35
+ 'Dec',
36
+ ];
37
+
38
+ const monthName = monthNames[monthIndex];
39
+
40
+ const dayOfWeek = start_date
41
+ .toLocaleDateString('en', { weekday: 'short' })
42
+ .substring(0, 2);
43
+
44
+ return (
45
+ <div className="start-date">
46
+ <p className="day">{dayOfWeek}</p>
47
+ <p className="date">
48
+ {day}.{monthName}.
49
+ </p>
50
+ </div>
51
+ );
52
+ };
53
+
54
+ const EventCardsListingView = ({ items, isEditMode, token }) => {
55
+ const go_to_contact = (contact_info) => {
56
+ if (contact_info.includes('@')) {
57
+ return `mailto:${contact_info}`;
58
+ }
59
+ return contact_info;
60
+ };
61
+
62
+ return (
63
+ <div className={cx('ui fluid eventCards')}>
64
+ {items.map((item, index) => (
65
+ <div
66
+ className={cx('u-item listing-item simple-listing-item')}
67
+ key={item['@id']}
68
+ >
69
+ <div className="wrapper">
70
+ <Card fluid>
71
+ <Card.Content>
72
+ <Grid stackable columns={12}>
73
+ <Grid.Column width={2}>
74
+ {!!item.start && StartDate(item.start)}
75
+ </Grid.Column>
76
+ <Grid.Column width={10}>
77
+ <div className="event-details">
78
+ <h3 className={'listing-header'}>
79
+ <a href={item.event_url}>
80
+ {item.title ? item.title : item.id}
81
+ </a>
82
+ </h3>
83
+ <div className="listing-body-dates">
84
+ {!!item.start && (
85
+ <span className="event-date">
86
+ <Icon className="ri-calendar-line" />
87
+ <When
88
+ start={item.start}
89
+ end={item.end}
90
+ whole_day={true}
91
+ open_end={item.open_end}
92
+ />
93
+ </span>
94
+ )}
95
+ </div>
96
+ <div className="listing-body-dates">
97
+ {!!item['location'] && (
98
+ <span className="event-date">
99
+ <Icon className="map marker alternate" />
100
+ {item['location']}
101
+ </span>
102
+ )}
103
+ </div>
104
+ {item.description && (
105
+ <p className={'listing-description'}>
106
+ {item.description}
107
+ </p>
108
+ )}
109
+ <div className="bottom-info">
110
+ {!!item.subjects && item.subjects.length > 0 && (
111
+ <>
112
+ <div className="subjects">
113
+ {item.subjects.map((tag) => (
114
+ <Label key={tag} size="small">
115
+ {tag}
116
+ </Label>
117
+ ))}
118
+ </div>
119
+
120
+ <Separator />
121
+ </>
122
+ )}
123
+ <div className="source">
124
+ <ConditionalLink item={item} condition={!isEditMode}>
125
+ Climate Adapt page for this event
126
+ </ConditionalLink>
127
+ </div>
128
+ {!!item.contact_email && (
129
+ <>
130
+ <Separator />
131
+ <div className="email-info">
132
+ <Icon className="mail" />
133
+ <a
134
+ className="contact_email"
135
+ title=""
136
+ href={go_to_contact(item.contact_email)}
137
+ target="_blank"
138
+ rel="noreferrer"
139
+ >
140
+ {item.contact_email}
141
+ </a>
142
+ </div>
143
+ </>
144
+ )}
145
+ </div>
146
+ </div>
147
+ </Grid.Column>
148
+ </Grid>
149
+ </Card.Content>
150
+ </Card>
151
+ </div>
152
+ </div>
153
+ ))}
154
+ </div>
155
+ );
156
+ };
157
+
158
+ EventCardsListingView.propTypes = {
159
+ items: PropTypes.arrayOf(PropTypes.any).isRequired,
160
+ isEditMode: PropTypes.bool,
161
+ };
162
+
163
+ export default compose(
164
+ connect((state) => ({
165
+ token: state.userSession.token,
166
+ })),
167
+ )(EventCardsListingView);
@@ -1,5 +1,6 @@
1
1
  import OrganisationCardsListingView from './OrganisationCardsListingView';
2
2
  import IndicatorCardsListingView from './IndicatorCardsListingView';
3
+ import EventCardsListingView from './EventCardsListingView';
3
4
 
4
5
  export default function installListing(config) {
5
6
  config.blocks.blocksConfig.listing = {
@@ -20,6 +21,13 @@ export default function installListing(config) {
20
21
  isDefault: false,
21
22
  fullobjects: true,
22
23
  },
24
+ {
25
+ id: 'eventCards',
26
+ title: 'Event Cards',
27
+ template: EventCardsListingView,
28
+ isDefault: false,
29
+ fullobjects: true,
30
+ },
23
31
  ],
24
32
  };
25
33
 
@@ -44,3 +44,58 @@ div.indicatorCards {
44
44
  margin-bottom: 1em !important;
45
45
  }
46
46
  }
47
+
48
+ // Event Cards Listing
49
+ div.eventCards {
50
+ div.simple-listing-item {
51
+ border-bottom: 1px solid #ddd !important;
52
+ }
53
+
54
+ a {
55
+ color: #006bb8 !important;
56
+ }
57
+
58
+ div.start-date {
59
+ max-width: 80px;
60
+
61
+ .day {
62
+ border-bottom: 3px solid #ef7000;
63
+ color: #ef7000;
64
+ font-size: 2.5em;
65
+ font-weight: 900;
66
+ }
67
+
68
+ .date {
69
+ font-size: 1.5em;
70
+ font-weight: 600;
71
+ }
72
+ }
73
+
74
+ div.bottom-info {
75
+ display: flex;
76
+ flex-wrap: wrap;
77
+ align-items: center;
78
+ justify-content: flex-start;
79
+
80
+ .sep {
81
+ position: relative;
82
+ top: -2px;
83
+ color: #ddd;
84
+ }
85
+
86
+ .email-info {
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: flex-start;
90
+ }
91
+
92
+ div.subjects {
93
+ .label {
94
+ margin-right: 0.3em;
95
+ margin-bottom: 0.3em;
96
+ background: #eee;
97
+ color: #3d5265;
98
+ }
99
+ }
100
+ }
101
+ }
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
- import { compose } from 'redux';
3
2
  import { Link } from 'react-router-dom';
4
3
  import { Dropdown } from 'semantic-ui-react';
5
- import { connect, useDispatch, useSelector } from 'react-redux';
4
+ import { useDispatch, useSelector } from 'react-redux';
6
5
  import { getQueryStringResults } from '@plone/volto/actions';
7
- import { regionCountries } from './countries';
6
+ import regionCountries from './countries.json';
8
7
 
9
8
  const getSiblings = (items) => {
10
9
  const regionsDropdown = (items || []).map((item) => {
@@ -24,8 +23,9 @@ const getSiblings = (items) => {
24
23
  return regionsDropdown;
25
24
  };
26
25
 
27
- const TransRegionSelectView = (props) => {
28
- const { id, data, content } = props;
26
+ export default function TransRegionSelectView(props) {
27
+ const { id, data } = props;
28
+ const content = useSelector((state) => state.content.data);
29
29
  const { title } = content;
30
30
  const dispatch = useDispatch();
31
31
  const querystringResults = useSelector(
@@ -86,7 +86,7 @@ const TransRegionSelectView = (props) => {
86
86
  title === 'Other regions' ? null : (
87
87
  <h5>Region's countries:</h5>
88
88
  )}
89
- {regionCountries
89
+ {regionCountries.countries
90
90
  .filter((item) => item.region === title)
91
91
  .map((item, i) => (
92
92
  <div className="countries-listing" key={i}>
@@ -115,10 +115,4 @@ const TransRegionSelectView = (props) => {
115
115
  </div>
116
116
  </div>
117
117
  );
118
- };
119
-
120
- export default compose(
121
- connect((state, props) => ({
122
- content: state.content.data,
123
- })),
124
- )(TransRegionSelectView);
118
+ }
@@ -0,0 +1,150 @@
1
+ {
2
+ "countries": [
3
+ {
4
+ "region": "Adriatic-Ionian Area",
5
+ "countries": [
6
+ ["Croatia", "/countries/croatia"],
7
+ ["Greece", "/countries/greece"],
8
+ ["Italy", "/countries/italy"],
9
+ ["Slovenia", "/countries/slovenia"],
10
+ ["Albania", ""],
11
+ ["Bosnia and Herzegovina", ""],
12
+ ["Montenegro", ""],
13
+ ["Republic of North Macedonia", ""],
14
+ ["Serbia", ""]
15
+ ]
16
+ },
17
+ {
18
+ "region": "Alpine Space",
19
+ "countries": [
20
+ ["Austria", "/countries/austria"],
21
+ ["France", "/countries/france"],
22
+ ["Germany", "/countries/germany"],
23
+ ["Italy", "/countries/italy"],
24
+ ["Slovenia", "/countries/slovenia"],
25
+ ["Liechtenstein", ""],
26
+ ["Switzerland", "/countries/switzerland"]
27
+ ]
28
+ },
29
+ {
30
+ "region": "Northern Periphery and Arctic",
31
+ "countries": [
32
+ ["Finland", "/countries/finland"],
33
+ ["Ireland", "/countries/ireland"],
34
+ ["Sweden", "/countries/sweden"],
35
+ ["Iceland", "/countries/iceland"],
36
+ ["Norway", "/countries/norway"],
37
+ ["Greenland", ""],
38
+ ["Faroe Islands", ""]
39
+ ]
40
+ },
41
+ {
42
+ "region": "Atlantic Area",
43
+ "countries": [
44
+ ["France", "/countries/france"],
45
+ ["Ireland", "/countries/ireland"],
46
+ ["Portugal", "/countries/portugal"],
47
+ ["Spain", "/countries/spain"]
48
+ ]
49
+ },
50
+ {
51
+ "region": "Baltic Sea",
52
+ "countries": [
53
+ ["Denmark", "/countries/denmark"],
54
+ ["Estonia", "/countries/estonia"],
55
+ ["Finland", "/countries/finland"],
56
+ ["Germany", "/countries/germany"],
57
+ ["Latvia", "/countries/latvia"],
58
+ ["Lithuania", "/countries/lithuania"],
59
+ ["Poland", "/countries/poland"],
60
+ ["Sweden", "/countries/sweden"],
61
+ ["Norway", "/countries/norway"]
62
+ ]
63
+ },
64
+ {
65
+ "region": "Central Europe",
66
+ "countries": [
67
+ ["Austria", "/countries/austria"],
68
+ ["Croatia", "/countries/croatia"],
69
+ ["Czechia", "/countries/czech-republic"],
70
+ ["Germany", "/countries/germany"],
71
+ ["Hungary", "/countries/hungary"],
72
+ ["Italy", "/countries/italy"],
73
+ ["Poland", "/countries/poland"],
74
+ ["Slovakia", "/countries/slovakia"],
75
+ ["Slovenia", "/countries/slovenia"]
76
+ ]
77
+ },
78
+ {
79
+ "region": "Danube Area",
80
+ "countries": [
81
+ ["Austria", "/countries/austria"],
82
+ ["Bulgaria", "/countries/bulgaria"],
83
+ ["Croatia", "/countries/croatia"],
84
+ ["Czechia", "/countries/czech-republic"],
85
+ ["Germany", "/countries/germany"],
86
+ ["Hungary", "/countries/hungary"],
87
+ ["Romania", "/countries/romania"],
88
+ ["Slovakia", "/countries/slovakia"],
89
+ ["Slovenia", "/countries/slovenia"],
90
+ ["Bosnia and Herzegovina, ", ""],
91
+ ["Montenegro", ""],
92
+ ["Serbia", ""],
93
+ ["Ukraine", ""],
94
+ ["Republic of Moldova", ""]
95
+ ]
96
+ },
97
+ {
98
+ "region": "Mediterranean Area",
99
+ "countries": [
100
+ ["Albania", ""],
101
+ ["Bosnia and Herzegovina", ""],
102
+ ["Bulgaria", "/countries/bulgaria"],
103
+ ["Croatia", "/countries/croatia"],
104
+ ["Cyprus", "/countries/cyprus"],
105
+ ["France", "/countries/france"],
106
+ ["Greece", "/countries/greece"],
107
+ ["Italy", "/countries/italy"],
108
+ ["Malta", "/countries/malta"],
109
+ ["Montenegro", ""],
110
+ ["Portugal", "/countries/portugal"],
111
+ ["Republic of North Macedonia", ""],
112
+ ["Slovenia", "/countries/slovenia"],
113
+ ["Spain", "/countries/spain"]
114
+ ]
115
+ },
116
+ {
117
+ "region": "North Sea Region",
118
+ "countries": [
119
+ ["Belgium", "/countries/belgium"],
120
+ ["Denmark", "/countries/denmark"],
121
+ ["Germany", "/countries/germany"],
122
+ ["France", "/countries/france"],
123
+ ["Netherlands", "/countries/netherlands"],
124
+ ["Sweden", "/countries/sweden"],
125
+ ["Norway", "/countries/norway"]
126
+ ]
127
+ },
128
+ {
129
+ "region": "North-West Europe",
130
+ "countries": [
131
+ ["Belgium", "/countries/belgium"],
132
+ ["France", "/countries/france"],
133
+ ["Germany", "/countries/germany"],
134
+ ["Ireland", "/countries/ireland"],
135
+ ["Luxembourg", "/countries/luxembourg"],
136
+ ["Netherlands", "/countries/netherlands"],
137
+ ["Switzerland", "/countries/switzerland"]
138
+ ]
139
+ },
140
+ {
141
+ "region": "South-West Europe",
142
+ "countries": [
143
+ ["France", "/countries/france"],
144
+ ["Portugal", "/countries/portugal"],
145
+ ["Spain", "/countries/spain"],
146
+ ["Andorra", ""]
147
+ ]
148
+ }
149
+ ]
150
+ }