@eeacms/volto-cca-policy 0.1.71 → 0.1.73

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.
Files changed (22) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +2 -2
  3. package/src/components/MigrationButtons.jsx +41 -0
  4. package/src/components/manage/Blocks/CountryMapHeatIndex/View.js +4 -3
  5. package/src/components/manage/Blocks/CountryMapHeatIndex/styles.less +133 -0
  6. package/src/components/manage/Blocks/CountryMapObservatory/{CountryMapObservatoryEdit.js → CountryMapObservatoryEdit.jsx} +1 -1
  7. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +230 -0
  8. package/src/components/manage/Blocks/CountryMapObservatory/index.js +1 -1
  9. package/src/components/manage/Blocks/CountryMapObservatory/styles.less +51 -0
  10. package/src/components/manage/Blocks/CountryMapProfile/View.js +3 -2
  11. package/src/components/manage/Blocks/CountryMapProfile/styles.less +234 -0
  12. package/src/components/manage/Blocks/RASTBlock/styles.less +21 -19
  13. package/src/components/manage/Blocks/withResponsiveContainer.js +3 -2
  14. package/src/index.js +20 -8
  15. package/theme/globals/site.overrides +0 -76
  16. package/src/components/manage/Blocks/CountryMapHeatIndex/styles.css +0 -131
  17. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryView.js +0 -93
  18. package/src/components/manage/Blocks/CountryMapObservatory/euro-countries-simplified.js +0 -46195
  19. package/src/components/manage/Blocks/CountryMapObservatory/flags.js +0 -57
  20. package/src/components/manage/Blocks/CountryMapObservatory/map-utils.js +0 -264
  21. package/src/components/manage/Blocks/CountryMapObservatory/styles.css +0 -49
  22. package/src/components/manage/Blocks/CountryMapProfile/styles.css +0 -232
@@ -0,0 +1,234 @@
1
+ .countryMapProfile {
2
+ &.sized-wrapper {
3
+ width: 100%;
4
+ height: 80vh;
5
+ }
6
+
7
+ #country_map {
8
+ position: relative;
9
+ margin: 50px;
10
+ fill: #fff;
11
+ }
12
+
13
+ .tooltip {
14
+ position: absolute;
15
+ z-index: 10;
16
+ display: none;
17
+ padding: 3px;
18
+ background-color: #2a2a2a;
19
+ border-radius: 3px;
20
+ color: white;
21
+ font-size: 10px;
22
+ }
23
+
24
+ .graticule {
25
+ fill: none;
26
+ stroke: black;
27
+ stroke-dasharray: 10, 10;
28
+ stroke-width: 1;
29
+ }
30
+
31
+ .semi-graticule {
32
+ fill: none;
33
+ stroke: gray;
34
+ stroke-dasharray: 1, 1;
35
+ stroke-width: 0.6;
36
+ }
37
+
38
+ .country-outline path {
39
+ fill: #e9e9e9;
40
+ }
41
+
42
+ .country-outline path {
43
+ fill: #f5f5f5;
44
+ stroke: #d1d1d1;
45
+ stroke-width: 1;
46
+ }
47
+
48
+ .country-available path {
49
+ fill: #0170b7;
50
+ }
51
+
52
+ .legend {
53
+ .legend-text {
54
+ width: 16em;
55
+ }
56
+
57
+ .legend-el {
58
+ display: flex;
59
+ flex-direction: row;
60
+ padding: 0.8em 0;
61
+ }
62
+
63
+ .legend-box {
64
+ width: 31px;
65
+ height: 19px;
66
+ margin-right: 0.5em;
67
+ }
68
+
69
+ .content-available {
70
+ background-color: #0170b7;
71
+ }
72
+
73
+ .no-content {
74
+ background-color: #72dffe;
75
+ }
76
+
77
+ .no-focus {
78
+ background-color: #efe7d4;
79
+ }
80
+
81
+ .country-notreported {
82
+ background-color: #fed7da;
83
+ }
84
+
85
+ .country-none {
86
+ background-color: #c0c0c0;
87
+ }
88
+
89
+ .country-outside {
90
+ background-color: #e0e0e0;
91
+ }
92
+ }
93
+
94
+ .legend.nasnap-legend {
95
+ display: block;
96
+
97
+ .country-nasnap {
98
+ background-color: #0071b3;
99
+ }
100
+
101
+ .country-nas {
102
+ background-color: #78d9fc;
103
+ }
104
+
105
+ .country-nap {
106
+ background-color: #11cbff;
107
+ }
108
+
109
+ .country-sap {
110
+ background-image: url("data:image/svg+xml,<svg id='sappatternId' width='100%' height='100%' xmlns='http://www.w3.org/2000/svg'><defs><pattern id='sappattern' patternUnits='userSpaceOnUse' width='8' height='5' patternTransform='scale(1) rotate(45)'><rect x='0' y='0' width='100%' height='100%' fill='hsla(0,0%,100%,1)'/><line x1='0' y='0' x2='0' y2='11.5' stroke='black' stroke-width='1'/></pattern></defs><rect width='800%' height='800%' transform='translate(0,0)' fill='url(%23sappattern)'/></svg>");
111
+ }
112
+
113
+ .country-nodata {
114
+ background-color: #efe7d4;
115
+ }
116
+ }
117
+
118
+ .legend.portals-legend {
119
+ .country-hazards {
120
+ background-color: #acedff;
121
+ }
122
+
123
+ .country-adaptation {
124
+ background-color: #11cbff;
125
+ }
126
+
127
+ .country-both {
128
+ background-color: #0170b7;
129
+ }
130
+
131
+ .country-not-specified {
132
+ background-color: #fff3ac;
133
+ }
134
+
135
+ .country-none {
136
+ background-color: #efe7d4;
137
+ }
138
+
139
+ .country-outside {
140
+ background-color: #e0e0e0;
141
+ }
142
+
143
+ .country-noportal {
144
+ background-color: #c0c0c0;
145
+ }
146
+ }
147
+
148
+ .country-blue path {
149
+ cursor: pointer;
150
+ // fill: @secondary-blue;
151
+ }
152
+
153
+ .country-notreported path {
154
+ cursor: pointer;
155
+ fill: #fed7da;
156
+ }
157
+
158
+ .country-noportal path {
159
+ cursor: pointer;
160
+ fill: #e0e0e0;
161
+ }
162
+
163
+ .country-nasnapsap path {
164
+ cursor: pointer;
165
+ fill: url(#nasnapsap);
166
+ }
167
+
168
+ .country-nassap path {
169
+ cursor: pointer;
170
+ fill: url(#nassap);
171
+ }
172
+
173
+ .country-napsap path {
174
+ cursor: pointer;
175
+ fill: url(#napsap);
176
+ }
177
+
178
+ .country-nasnapsap path {
179
+ cursor: pointer;
180
+ fill: url(#nasnapsap);
181
+ }
182
+
183
+ .country-nasnap path {
184
+ cursor: pointer;
185
+ fill: #007db6;
186
+ }
187
+
188
+ .country-nas path {
189
+ cursor: pointer;
190
+ fill: #78d9fc;
191
+ }
192
+
193
+ .country-nap path {
194
+ cursor: pointer;
195
+ fill: #11cbff;
196
+ }
197
+
198
+ .country-none path {
199
+ cursor: pointer;
200
+ fill: #e0e0e0;
201
+ }
202
+
203
+ .country-nodata path {
204
+ cursor: pointer;
205
+ fill: #f5f5f5;
206
+ }
207
+
208
+ .country-outline.ue path:hover {
209
+ fill: #8a9c3a;
210
+ }
211
+
212
+ #map-tooltip {
213
+ position: absolute;
214
+ width: 400px;
215
+ padding: 1em;
216
+ border: 1px solid #c7c7c7;
217
+ background-color: #f7f7f7;
218
+ }
219
+
220
+ #country-name a {
221
+ text-decoration: none;
222
+ }
223
+
224
+ #country-name .tooltip-country-flag {
225
+ position: absolute;
226
+ top: 10px;
227
+ right: 1em;
228
+ }
229
+
230
+ #tooltip-content {
231
+ padding-top: 1em;
232
+ border-top: 2px solid #005c96;
233
+ }
234
+ }
@@ -3,32 +3,34 @@
3
3
 
4
4
  @import (multiple, reference, optional) '../../theme.config';
5
5
 
6
- a rect.circle:hover {
7
- fill: #183 !important;
8
- }
6
+ .rast-block {
7
+ a rect.circle:hover {
8
+ fill: #183 !important;
9
+ }
9
10
 
10
- a rect.circle {
11
- pointer-events: all !important;
12
- }
11
+ a rect.circle {
12
+ pointer-events: all !important;
13
+ }
13
14
 
14
- svg,
15
- svg * {
16
- pointer-events: none;
17
- }
15
+ svg,
16
+ svg * {
17
+ pointer-events: none;
18
+ }
19
+
20
+ .link-active {
21
+ .circle,
22
+ .circle:hover {
23
+ fill: @green-1;
24
+ }
25
+ }
18
26
 
19
- .link-active {
20
- .circle,
21
27
  .circle:hover {
22
28
  fill: @green-1;
23
29
  }
24
- }
25
30
 
26
- .circle:hover {
27
- fill: @green-1;
28
- }
29
-
30
- .rast-block .item.active a {
31
- font-weight: bold;
31
+ .item.active a {
32
+ font-weight: bold;
33
+ }
32
34
  }
33
35
 
34
36
  .rast-map-block {
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
 
3
- const withResponsiveContainer = (WrappedComponent) => {
3
+ const withResponsiveContainer = (className) => (WrappedComponent) => {
4
4
  return (props) => {
5
5
  const [size, setSize] = React.useState();
6
+ const klass = className ? `${className} sized-wrapper` : 'sized-wrapper';
6
7
  return (
7
8
  <div
8
- className="sized-wrapper"
9
+ className={klass}
9
10
  ref={(node) => {
10
11
  // console.log(node, node.clientHeight);
11
12
  if (node && !size)
package/src/index.js CHANGED
@@ -27,13 +27,14 @@ import installStore from './store';
27
27
 
28
28
  import GeocharsWidget from './components/theme/Widgets/GeocharsWidget';
29
29
  import GeolocationWidget from './components/theme/Widgets/GeolocationWidget';
30
+ import MigrationButtons from './components/MigrationButtons';
31
+
32
+ import { blockAvailableInMission } from '@eeacms/volto-cca-policy/utils';
30
33
 
31
34
  const getEnv = () => (typeof window !== 'undefined' ? window.env : process.env);
32
35
 
33
36
  const pathToNegRegex = (p) => `(?!(${p}))`;
34
37
 
35
- const restrictedBlocks = ['countryFlag'];
36
-
37
38
  const applyConfig = (config) => {
38
39
  const env = getEnv();
39
40
 
@@ -189,12 +190,15 @@ const applyConfig = (config) => {
189
190
  config.blocks.blocksConfig.video.restricted = false;
190
191
  }
191
192
 
192
- // Disable blocks
193
- restrictedBlocks.forEach((block) => {
194
- if (config.blocks.blocksConfig[block]) {
195
- config.blocks.blocksConfig[block].restricted = true;
196
- }
197
- });
193
+ // Disable blocks on Mission
194
+ if (config.blocks.blocksConfig.countryFlag) {
195
+ config.blocks.blocksConfig.countryFlag = {
196
+ ...config.blocks.blocksConfig.countryFlag,
197
+ restricted: ({ properties, block }) => {
198
+ return blockAvailableInMission(properties, block);
199
+ },
200
+ };
201
+ }
198
202
 
199
203
  // Move blocks to Site group
200
204
  const move_to_site = [
@@ -448,6 +452,14 @@ const applyConfig = (config) => {
448
452
  ...(config.addonRoutes || []),
449
453
  ];
450
454
 
455
+ config.settings.appExtras = [
456
+ ...(config.settings.appExtras || []),
457
+ {
458
+ match: '',
459
+ component: MigrationButtons,
460
+ },
461
+ ];
462
+
451
463
  return compose(installBlocks, installSearchEngine, installStore)(config);
452
464
  };
453
465
 
@@ -148,82 +148,6 @@ div.content-metadata {
148
148
  }
149
149
  }
150
150
 
151
- body.view-viewview .full {
152
- position: relative !important;
153
- right: 50%;
154
- left: 50%;
155
- width: 100vw !important;
156
- max-width: initial !important;
157
- margin-right: -50vw !important;
158
- margin-left: -50vw !important;
159
-
160
- > div {
161
- display: block;
162
- width: 100% !important;
163
- margin-right: auto !important;
164
- margin-left: auto !important;
165
- }
166
- }
167
-
168
- body.view-viewview.has-toolbar:not(.has-sidebar):not(.has-sidebar-collapsed) {
169
- .full > div {
170
- width: calc(100% - @toolbarWidth) !important;
171
- }
172
- }
173
-
174
- @media screen and (min-width: @largestMobileScreen) {
175
- body.view-viewview.has-toolbar.has-sidebar {
176
- .full > div {
177
- width: calc(100% - (@toolbarWidth + @sidebarWidth)) !important;
178
- }
179
- }
180
-
181
- body.view-viewview.has-toolbar.has-sidebar-collapsed {
182
- .full > div {
183
- width: calc(100% - (@toolbarWidth + @collapsedToolbarWidth)) !important;
184
- }
185
- }
186
-
187
- body.view-viewview.has-toolbar-collapsed:not(.has-sidebar):not(.has-sidebar-collapsed) {
188
- .full > div {
189
- width: calc(100% - @collapsedToolbarWidth) !important;
190
- }
191
- }
192
-
193
- body.view-viewview.has-toolbar-collapsed.has-sidebar {
194
- .full > div {
195
- .full-width-block {
196
- width: calc(100% - (@collapsedToolbarWidth + @sidebarWidth)) !important;
197
- }
198
- }
199
- }
200
-
201
- body.view-viewview.has-toolbar-collapsed.has-sidebar-collapsed {
202
- .full > div {
203
- width: calc(
204
- 100% - (@collapsedToolbarWidth + @collapsedToolbarWidth)
205
- ) !important;
206
- }
207
- }
208
- }
209
-
210
- @media only screen and (max-width: 767px) {
211
- body.view-viewview.has-toolbar-collapsed.has-sidebar-collapsed
212
- .full.full-width-block,
213
- body.view-viewview.has-toolbar.has-sidebar-collapsed .full.full-width-block {
214
- width: 100% !important;
215
- }
216
- }
217
-
218
- @media screen and (max-width: @largestMobileScreen) {
219
- body.view-viewview.has-toolbar:not(.has-sidebar):not(.has-sidebar-collapsed),
220
- body.view-viewview.has-toolbar-collapsed:not(.has-sidebar):not(.has-sidebar-collapsed) {
221
- .full > div {
222
- width: 100% !important;
223
- }
224
- }
225
- }
226
-
227
151
  .listing-body-dates:empty {
228
152
  margin-bottom: 0;
229
153
  }
@@ -1,131 +0,0 @@
1
- .sized-wrapper {
2
- width: 100%;
3
- height: 80vh;
4
- }
5
-
6
- #country_map {
7
- position: relative;
8
- margin: 50px;
9
- fill: #fff;
10
- }
11
-
12
- .tooltip {
13
- position: absolute;
14
- z-index: 10;
15
- display: none;
16
- padding: 3px;
17
- background-color: #2a2a2a;
18
- border-radius: 3px;
19
- color: white;
20
- font-size: 10px;
21
- }
22
-
23
- .graticule {
24
- fill: none;
25
- stroke: black;
26
- stroke-dasharray: 10, 10;
27
- stroke-width: 1;
28
- }
29
-
30
- .semi-graticule {
31
- fill: none;
32
- stroke: gray;
33
- stroke-dasharray: 1, 1;
34
- stroke-width: 0.6;
35
- }
36
-
37
- .country-outline path {
38
- fill: #e9e9e9;
39
- }
40
-
41
- .country-outline path {
42
- fill: #f5f5f5;
43
- stroke: #d1d1d1;
44
- stroke-width: 1;
45
- }
46
-
47
- .country-available path {
48
- fill: #0170b7;
49
- }
50
-
51
- .legend {
52
- .legend-text {
53
- width: 16em;
54
- }
55
-
56
- .legend-el {
57
- display: flex;
58
- flex-direction: row;
59
- padding: 0.8em 0;
60
- }
61
-
62
- .legend-box {
63
- width: 31px;
64
- height: 19px;
65
- margin-right: 0.5em;
66
- }
67
- }
68
-
69
- span.country-national-hhap {
70
- background: #0170b7;
71
- }
72
-
73
- span.country-subnational-hhap {
74
- background: #8baece;
75
- }
76
-
77
- span.country-no-hhap {
78
- background: #868686;
79
- }
80
-
81
- span.country-none {
82
- background-color: #bfbfbf !important;
83
- }
84
-
85
- .country-nationalhhap path {
86
- cursor: pointer;
87
- fill: #0170b7 !important;
88
- }
89
-
90
- .country-no-hhap path {
91
- cursor: pointer;
92
- fill: #868686 !important;
93
- }
94
-
95
- .country-subnationalhhap path {
96
- cursor: pointer;
97
- fill: #8baece !important;
98
- }
99
-
100
- .country-none path {
101
- cursor: pointer;
102
- fill: #bfbfbf !important;
103
- }
104
-
105
- .country-nodata path {
106
- cursor: pointer;
107
- fill: #efe7d4 !important;
108
- }
109
-
110
- #map-tooltip {
111
- position: absolute;
112
- width: 400px;
113
- padding: 1em;
114
- border: 1px solid #c7c7c7;
115
- background-color: #f7f7f7;
116
- }
117
-
118
- #country-name a {
119
- text-decoration: none;
120
- }
121
-
122
- #country-name .tooltip-country-flag {
123
- position: absolute;
124
- top: 10px;
125
- right: 1em;
126
- }
127
-
128
- #tooltip-content {
129
- padding-top: 1em;
130
- border-top: 2px solid #005c96;
131
- }
@@ -1,93 +0,0 @@
1
- import React, { useRef, useEffect } from 'react';
2
- import './styles.css';
3
- import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
4
- import { compose } from 'redux';
5
- import { clientOnly } from '@eeacms/volto-cca-policy/helpers';
6
- import withResponsiveContainer from './../withResponsiveContainer.js';
7
- import { renderCountriesBox } from './map-utils.js';
8
- import {
9
- getFocusCountriesFeature,
10
- getFocusCountryNames,
11
- withCountriesData,
12
- } from '@eeacms/volto-cca-policy/helpers/country_map/countryMap.js';
13
-
14
- const CountryMapObservatoryView = (props) => {
15
- const svgRef = useRef(null);
16
- const { d3, d3Geo, size, cpath } = props;
17
- const { height, width } = size;
18
-
19
- useEffect(() => {
20
- // D3 Code
21
-
22
- // Dimensions
23
- //const parentDiv = document.getElementById('page-document');
24
- let dimensions = {
25
- //width: parentDiv.offsetWidth,
26
- width,
27
- height,
28
- margins: 50,
29
- };
30
-
31
- dimensions.containerWidth = dimensions.width - dimensions.margins * 2;
32
- dimensions.containerHeight = dimensions.height - dimensions.margins * 2;
33
-
34
- //const d3 = loadable.lib(() => import('d3'));
35
- // SELECTIONS
36
- const svg = d3
37
- .select(svgRef.current)
38
- .attr('id', 'country_map')
39
- //.classed("line-chart", true)
40
- .attr('width', dimensions.width)
41
- .attr('height', dimensions.height);
42
- //console.log('SVG x-y', svg.getBBox());
43
- /*
44
- const container = svg
45
- .append('g')
46
- .classed('container', true)
47
- .attr(
48
- 'transform',
49
- `translate(${dimensions.margins}, ${dimensions.margins})`,
50
- );
51
- */
52
-
53
- //console.log('cpath', cpath);
54
- //console.log(fpath);
55
- //console.log('Flags',flags);
56
- //console.log('filtered', getFocusCountriesFeature(cpath));
57
-
58
- window.countrySettings = cpath.features;
59
-
60
- var opts = {
61
- world: cpath.features,
62
- svg: svg,
63
- coordinates: {
64
- x: 0,
65
- y: 0,
66
- width: dimensions.containerWidth,
67
- height: dimensions.containerHeight,
68
- },
69
- focusCountries: {
70
- names: getFocusCountryNames(),
71
- feature: getFocusCountriesFeature(cpath),
72
- },
73
- zoom: 0.95,
74
- };
75
- renderCountriesBox(opts, d3, d3Geo);
76
- // Draw Circle
77
- //container.append("circle").attr("r", 25).style("color","blue");
78
- }, [props.Data, d3, width, height, cpath, d3Geo]); // redraw chart if data changes
79
-
80
- return <svg ref={svgRef} />;
81
- };
82
-
83
- export default compose(
84
- clientOnly,
85
- injectLazyLibs(['d3', 'd3Geo']),
86
- withResponsiveContainer,
87
- withCountriesData,
88
- )(CountryMapObservatoryView);
89
-
90
- // import loadable from '@loadable/component';
91
- //import * as d3 from 'd3';
92
- // import cpath from './euro-countries-simplified';
93
- //