@eeacms/volto-n2k 1.0.28 → 1.0.30

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 (39) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/jest-addon.config.js +2 -2
  3. package/package.json +1 -1
  4. package/src/components/manage/Blocks/BubbleChart/Chart.jsx +0 -5
  5. package/src/components/manage/Blocks/CDDACountryProfileMap/Edit.jsx +34 -0
  6. package/src/components/manage/Blocks/CDDACountryProfileMap/View.jsx +208 -0
  7. package/src/components/manage/Blocks/CDDACountryProfileMap/index.js +24 -0
  8. package/src/components/manage/Blocks/CDDACountryProfileMap/schema.js +19 -0
  9. package/src/components/manage/Blocks/CDDACountryProfileMap/style.less +240 -0
  10. package/src/components/manage/Blocks/CddaShape/View.jsx +1 -2
  11. package/src/components/manage/Blocks/ContactBlock/View.jsx +1 -1
  12. package/src/components/manage/Blocks/ContactBlock/styles.less +1 -1
  13. package/src/components/manage/Blocks/ExploreHabitats/View.jsx +1 -2
  14. package/src/components/manage/Blocks/ExploreSites/View.jsx +1 -1
  15. package/src/components/manage/Blocks/ExploreSpecies/View.jsx +1 -1
  16. package/src/components/manage/Blocks/HabitatDistribution/View.jsx +1 -1
  17. package/src/components/manage/Blocks/HabitatProtectedSites/View.jsx +1 -1
  18. package/src/components/manage/Blocks/LabeledList/View.jsx +18 -15
  19. package/src/components/manage/Blocks/LabeledList/style.less +2 -0
  20. package/src/components/manage/Blocks/Landing/Edit.jsx +6 -2
  21. package/src/components/manage/Blocks/List/View.jsx +32 -25
  22. package/src/components/manage/Blocks/List/style.less +2 -0
  23. package/src/components/manage/Blocks/N2KCountryProfileMap/Edit.jsx +34 -0
  24. package/src/components/manage/Blocks/N2KCountryProfileMap/View.jsx +165 -0
  25. package/src/components/manage/Blocks/N2KCountryProfileMap/index.js +24 -0
  26. package/src/components/manage/Blocks/N2KCountryProfileMap/schema.js +19 -0
  27. package/src/components/manage/Blocks/N2KCountryProfileMap/style.less +240 -0
  28. package/src/components/manage/Blocks/SiteProtectedSpecies/style.less +1 -1
  29. package/src/components/manage/Blocks/SiteShape/View.jsx +1 -2
  30. package/src/components/manage/Blocks/SiteSpeciesList/View.jsx +1 -2
  31. package/src/components/manage/Blocks/SpeciesClassification/View.jsx +0 -2
  32. package/src/components/manage/Blocks/SpeciesDistribution/View.jsx +1 -1
  33. package/src/components/manage/Blocks/SpeciesProtectedSites/View.jsx +1 -1
  34. package/src/components/manage/Blocks/StackedBarChart/Chart.jsx +0 -6
  35. package/src/components/manage/Blocks/StatusList/View.jsx +27 -22
  36. package/src/components/manage/Blocks/StatusList/style.less +9 -1
  37. package/src/components/theme/Sitemap/Sitemap.jsx +1 -2
  38. package/src/helpers.js +3 -3
  39. package/src/index.js +4 -2
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
- // import { UniversalLink } from '@plone/volto/components';
3
2
  import './style.less';
4
3
 
5
4
  const View = (props) => {
6
- // const provider_data = props.provider_data || {};
7
5
  return (
8
6
  <div className="species-classification">
9
7
  {props.mode === 'edit' ? <p>Species classification</p> : ''}
@@ -74,9 +74,9 @@ const View = (props) => {
74
74
  center: proj.fromLonLat([20, 50]),
75
75
  showFullExtent: true,
76
76
  zoom: 5,
77
+ ...(options.extent ? { extent: options.extent } : {}),
77
78
  }}
78
79
  pixelRatio={1}
79
- {...options}
80
80
  >
81
81
  <Layers>
82
82
  <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
@@ -70,9 +70,9 @@ const View = (props) => {
70
70
  center: proj.fromLonLat([20, 50]),
71
71
  showFullExtent: true,
72
72
  zoom: 5,
73
+ ...(options.extent ? { extent: options.extent } : {}),
73
74
  }}
74
75
  pixelRatio={1}
75
- {...options}
76
76
  >
77
77
  <Layers>
78
78
  <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
@@ -26,18 +26,12 @@ function Chart(props) {
26
26
  } = props;
27
27
 
28
28
  useEffect(() => {
29
- // dispose();
30
29
  if (xDomain.length && yDomain.length) {
31
30
  makeAxis();
32
31
  }
33
32
  /* eslint-disable-next-line */
34
33
  }, [JSON.stringify(xDomain), JSON.stringify(yDomain)]);
35
34
 
36
- // const dispose = () => {
37
- // const svg = select(svgRef.current);
38
- // svg.selectAll('*').remove();
39
- // };
40
-
41
35
  const makeAxis = () => {
42
36
  const svg = select(svgRef.current);
43
37
  // Scales
@@ -33,28 +33,33 @@ const View = (props) => {
33
33
  return (
34
34
  <div className="connected-status-list">
35
35
  {props.mode === 'edit' ? <p>Connected status list</p> : ''}
36
- <ul>
37
- {Array(Math.max(0, columns))
38
- .fill()
39
- .map((_, column) => {
40
- const status =
41
- status_labels[
42
- provider_data[data.status]?.[column]?.toLowerCase()
43
- ] || status_labels.unknown;
44
- return (
45
- <li
46
- key={`connected-list-${column}`}
47
- className={cx(`status-${status.value}`)}
48
- >
49
- <span className="value">
50
- {provider_data[data.value][column]}
51
- </span>
52
- <Icon name={arrowSVG} size="16px" />
53
- <span className="status">{status.title}</span>
54
- </li>
55
- );
56
- })}
57
- </ul>
36
+ {!!columns && (
37
+ <ul>
38
+ {Array(Math.max(0, columns))
39
+ .fill()
40
+ .map((_, column) => {
41
+ const status =
42
+ status_labels[
43
+ provider_data[data.status]?.[column]?.toLowerCase()
44
+ ] || status_labels.unknown;
45
+ return (
46
+ <li
47
+ key={`connected-list-${column}`}
48
+ className={cx(`status-${status.value}`)}
49
+ >
50
+ {provider_data[data.value] && (
51
+ <span className="value">
52
+ {provider_data[data.value][column]}
53
+ </span>
54
+ )}
55
+ <Icon name={arrowSVG} size="16px" />
56
+ <span className="status">{status.title}</span>
57
+ </li>
58
+ );
59
+ })}
60
+ </ul>
61
+ )}
62
+ {!columns && <p className="no-results">-</p>}
58
63
  </div>
59
64
  );
60
65
  };
@@ -1,4 +1,11 @@
1
+ @import (multiple, reference, optional) '../../theme.config';
2
+
3
+ @type: extra;
4
+ @element: custom;
5
+
1
6
  .connected-status-list {
7
+ margin-bottom: 1rem;
8
+
2
9
  ul {
3
10
  padding-left: 0;
4
11
  margin-left: -0.5rem;
@@ -40,6 +47,7 @@
40
47
 
41
48
  &.status-bad {
42
49
  background-color: #dd552b;
50
+ color: #fff;
43
51
 
44
52
  .icon {
45
53
  rotate: 45deg;
@@ -47,7 +55,7 @@
47
55
  }
48
56
 
49
57
  &.status-unkown {
50
- background-color: #afb0b3;
58
+ background-color: @grey-2;
51
59
  }
52
60
  }
53
61
  }
@@ -8,10 +8,9 @@ import PropTypes from 'prop-types';
8
8
  import { compose } from 'redux';
9
9
  import { connect } from 'react-redux';
10
10
  import { matchPath } from 'react-router';
11
- import { asyncConnect } from '@plone/volto/helpers';
11
+ import { asyncConnect, Helmet } from '@plone/volto/helpers';
12
12
  import { defineMessages, injectIntl } from 'react-intl';
13
13
  import { Container } from 'semantic-ui-react';
14
- import { Helmet } from '@plone/volto/helpers';
15
14
  import { Link } from 'react-router-dom';
16
15
  import config from '@plone/volto/registry';
17
16
  import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
package/src/helpers.js CHANGED
@@ -53,12 +53,12 @@ export function sortBy(obj, property, order = 'ASC') {
53
53
  }
54
54
 
55
55
  export const componentToHex = (c) => {
56
- var hex = parseInt(c).toString(16);
56
+ const hex = parseInt(c).toString(16);
57
57
  return hex.length === 1 ? '0' + hex : hex;
58
58
  };
59
59
 
60
60
  function hexToRgb(hex) {
61
- var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
61
+ let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
62
62
  return result
63
63
  ? [
64
64
  parseInt(result[1], 16),
@@ -86,7 +86,7 @@ export const getContrastColor = (rgb) => {
86
86
  };
87
87
 
88
88
  export const adjustBrightness = (col, amt) => {
89
- var usePound = false;
89
+ let usePound = false;
90
90
 
91
91
  if (col.includes('rgb(')) {
92
92
  const rgb = col
package/src/index.js CHANGED
@@ -42,13 +42,13 @@ import installSpeciesDistribution from './components/manage/Blocks/SpeciesDistri
42
42
  import installSpeciesProtectedSites from './components/manage/Blocks/SpeciesProtectedSites';
43
43
  import installStackedBarChart from './components/manage/Blocks/StackedBarChart';
44
44
  import installTilesImages from './components/manage/Blocks/TilesImages';
45
+ import installN2KCountryProfileMap from './components/manage/Blocks/N2KCountryProfileMap';
46
+ import installCDDACountryProfileMap from './components/manage/Blocks/CDDACountryProfileMap';
45
47
 
46
48
  import { LINK } from '@plone/volto-slate/constants';
47
49
 
48
50
  import { gridSizes, variants } from './grid';
49
51
 
50
- // import './less/styles.less';
51
-
52
52
  Array.prototype.sortByProperty = function (property, order = 'ASC') {
53
53
  return this.sort((a, b) => {
54
54
  if (a[property] < b[property]) return order === 'ASC' ? -1 : 1;
@@ -158,6 +158,8 @@ const applyConfig = (config) => {
158
158
  installSpeciesProtectedSites,
159
159
  installStackedBarChart,
160
160
  installTilesImages,
161
+ installN2KCountryProfileMap,
162
+ installCDDACountryProfileMap,
161
163
  ].reduce((acc, apply) => apply(acc), config);
162
164
  };
163
165