@eeacms/volto-n2k 0.1.3 → 0.1.6

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,9 +4,31 @@ 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.6](https://github.com/eea/volto-n2k/compare/0.1.5...0.1.6)
8
+
9
+ - Add toolkit in landing page [`b5fae01`](https://github.com/eea/volto-n2k/commit/b5fae01c4e54c6405997bfbd167d5ed3836d880a)
10
+
11
+ #### [0.1.5](https://github.com/eea/volto-n2k/compare/0.1.4...0.1.5)
12
+
13
+ > 28 July 2022
14
+
15
+ - Show language native name [`#6`](https://github.com/eea/volto-n2k/pull/6)
16
+ - Use volto 16 for cypress tests [`dfb57d1`](https://github.com/eea/volto-n2k/commit/dfb57d12d37dbeb1aa8c0d87cf8cc950cdf27d13)
17
+
18
+ #### [0.1.4](https://github.com/eea/volto-n2k/compare/0.1.3...0.1.4)
19
+
20
+ > 15 July 2022
21
+
22
+ - Lazy load d3 [`#5`](https://github.com/eea/volto-n2k/pull/5)
23
+ - Prettier [`43c0a09`](https://github.com/eea/volto-n2k/commit/43c0a090f481f81e7cadcfcda59b5dcc02dd8f1a)
24
+ - Prettier [`553c35b`](https://github.com/eea/volto-n2k/commit/553c35b2c9b34adb8fb630f2ec41f2ffd2cf22b0)
25
+ - Prettier fix [`47619cb`](https://github.com/eea/volto-n2k/commit/47619cb286ff939df397c483c18cc532c58b7547)
26
+
7
27
  #### [0.1.3](https://github.com/eea/volto-n2k/compare/0.1.2...0.1.3)
8
28
 
9
- - Make this compatible with latest changes [`d11991f`](https://github.com/eea/volto-n2k/commit/d11991f3798edebc132929e15bf120ec3d545ab9)
29
+ > 23 June 2022
30
+
31
+ - Make this compatible with latest changes [`#4`](https://github.com/eea/volto-n2k/pull/4)
10
32
 
11
33
  #### [0.1.2](https://github.com/eea/volto-n2k/compare/0.1.1...0.1.2)
12
34
 
package/Jenkinsfile CHANGED
@@ -6,6 +6,7 @@ pipeline {
6
6
  NAMESPACE = "@eeacms"
7
7
  SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu"
8
8
  DEPENDENCIES = "volto-slate @eeacms/volto-datablocks"
9
+ VOLTO = "16.0.0-alpha.14"
9
10
  }
10
11
 
11
12
  stages {
@@ -124,8 +125,8 @@ pipeline {
124
125
  node(label: 'docker') {
125
126
  script {
126
127
  try {
127
- sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
128
- sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress'''
128
+ sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend'''
129
+ sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress'''
129
130
  } finally {
130
131
  try {
131
132
  sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
@@ -27,7 +27,7 @@ coverage-end */
27
27
  export const setupBeforeEach = () => {
28
28
  cy.autologin();
29
29
  cy.createContent({
30
- contentType: 'Folder',
30
+ contentType: 'Document',
31
31
  contentId: 'cypress',
32
32
  contentTitle: 'Cypress',
33
33
  });
package/cypress.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "baseUrl": "http://localhost:3000",
3
3
  "viewportWidth": 1280,
4
- "defaultCommandTimeout": 15000,
4
+ "defaultCommandTimeout": 8888,
5
5
  "reporter": "junit",
6
6
  "video": true,
7
7
  "reporterOptions": {
8
8
  "mochaFile": "cypress/reports/cypress-[hash].xml",
9
9
  "jenkinsMode": true,
10
10
  "toConsole": true
11
+ },
12
+ "chromeWebSecurity": false,
13
+ "retries": {
14
+ "runMode": 8,
15
+ "openMode": 0
11
16
  }
12
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-n2k",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "description": "volto-n2k: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -29,8 +29,8 @@
29
29
  "@eeacms/volto-openlayers-map": "*",
30
30
  "@eeacms/volto-tabs-block": "*",
31
31
  "volto-slate": "*",
32
- "d3": "^7.1.1",
33
- "d3-shape": "^3.0.1",
32
+ "d3": "^7.6.1",
33
+ "d3-shape": "^3.1.0",
34
34
  "react-lazy-load-image-component": "1.5.1",
35
35
  "react-stickynode": "^4.0.0",
36
36
  "react-use-localstorage": "^3.5.3",
@@ -1,18 +1,18 @@
1
1
  import React from 'react';
2
2
  import _uniqueId from 'lodash/uniqueId';
3
- import { pack, hierarchy } from 'd3';
4
- import * as d3 from 'd3';
3
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
5
4
  import { adjustBrightness, getContrastColor } from '@eeacms/volto-n2k/helpers';
6
5
  import { FormattedValue } from '@eeacms/volto-datablocks/Utils';
7
6
  import ChartContext from './ChartContext';
8
7
 
9
8
  function BubbleChart(props) {
10
- const { chartData, interpolation } = props;
9
+ const { d3, chartData, interpolation } = props;
11
10
  const { element, height, width, popup, setPopup } = React.useContext(
12
11
  ChartContext,
13
12
  );
14
- const root = pack().size([width, height]).padding(10)(
15
- hierarchy({ children: chartData })
13
+ const root = d3.pack().size([width, height]).padding(10)(
14
+ d3
15
+ .hierarchy({ children: chartData })
16
16
  .sum((d) => d.value)
17
17
  .sort((a, b) => b.value - a.value),
18
18
  );
@@ -98,4 +98,4 @@ function BubbleChart(props) {
98
98
  </React.Fragment>
99
99
  );
100
100
  }
101
- export default BubbleChart;
101
+ export default injectLazyLibs(['d3'])(BubbleChart);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import * as d3 from 'd3';
3
2
  import { Popup } from 'semantic-ui-react';
3
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
4
4
  import { adjustBrightness } from '@eeacms/volto-n2k/helpers';
5
5
 
6
6
  const Arc = ({ data, index, createArc, format, size }) => {
@@ -73,6 +73,8 @@ const Arc = ({ data, index, createArc, format, size }) => {
73
73
  };
74
74
 
75
75
  const Pie = (props) => {
76
+ const { d3 } = props;
77
+
76
78
  const createPie = d3
77
79
  .pie()
78
80
  .value((d) => d.value)
@@ -122,4 +124,4 @@ const Pie = (props) => {
122
124
  );
123
125
  };
124
126
 
125
- export default Pie;
127
+ export default injectLazyLibs(['d3'])(Pie);
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import { Grid } from 'semantic-ui-react';
3
- import * as d3 from 'd3';
4
- import './style.less';
3
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
5
4
 
6
5
  import Pie from './Pie';
7
6
 
7
+ import './style.less';
8
+
8
9
  const View = (props) => {
9
- const { placeholder = 'No results' } = props;
10
+ const { d3, placeholder = 'No results' } = props;
10
11
  const { x = null, y = null, x_colors = [], precision = 2 } = props.data;
11
12
  const data = props.provider_data || {};
12
13
  const x_values = data?.[x] || [];
@@ -77,4 +78,4 @@ const View = (props) => {
77
78
  );
78
79
  };
79
80
 
80
- export default View;
81
+ export default injectLazyLibs(['d3'])(View);
@@ -6,7 +6,7 @@ import forests from './images/forests.webp';
6
6
  import mountains from './images/mountains.webp';
7
7
  import grasslands from './images/grasslands.webp';
8
8
  import rivers from './images/rivers.webp';
9
- import islands from './images/islands.webp';
9
+ import toolkit from './images/toolkit_icon.webp';
10
10
  import peatlands from './images/peatlands.webp';
11
11
  import natura2000 from './images/natura2000.webp';
12
12
 
@@ -15,7 +15,7 @@ export const tiles = [
15
15
  image: natura2000,
16
16
  title: 'Natura 2000',
17
17
  description: 'NATURA 2000',
18
- link: '/natura2000/natura2000',
18
+ link: '/natura2000/explore-natura2000',
19
19
  },
20
20
  {
21
21
  image: coasts_and_seas,
@@ -54,10 +54,10 @@ export const tiles = [
54
54
  link: '/natura2000/:lang/rivers-and-lakes',
55
55
  },
56
56
  {
57
- image: islands,
58
- title: 'Islands',
59
- description: 'ISLANDS',
60
- link: '/natura2000/:lang/islands',
57
+ image: toolkit,
58
+ title: 'Toolkit',
59
+ description: 'TOOLKIT',
60
+ link: '/natura2000/:lang/toolkit',
61
61
  },
62
62
  ];
63
63
 
@@ -1,13 +1,6 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
- import {
3
- axisBottom,
4
- axisLeft,
5
- format,
6
- select,
7
- scaleBand,
8
- scaleLinear,
9
- } from 'd3';
10
2
  import cx from 'classnames';
3
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
11
4
  import ChartContext from './ChartContext';
12
5
 
13
6
  /**
@@ -19,6 +12,8 @@ import ChartContext from './ChartContext';
19
12
  */
20
13
 
21
14
  function Chart(props) {
15
+ const { d3 } = props;
16
+ const { axisBottom, axisLeft, format, select, scaleBand, scaleLinear } = d3;
22
17
  const [scales, setScales] = useState();
23
18
  const [popup, setPopup] = useState();
24
19
  const chartWrapper = useRef();
@@ -124,4 +119,4 @@ function Chart(props) {
124
119
  );
125
120
  }
126
121
 
127
- export default Chart;
122
+ export default injectLazyLibs(['d3'])(Chart);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { scaleOrdinal, schemeSpectral, stack } from 'd3';
3
2
  import cx from 'classnames';
3
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
4
4
  import { adjustBrightness } from '@eeacms/volto-n2k/helpers';
5
5
  import ChartContext from './ChartContext';
6
6
 
@@ -11,6 +11,8 @@ const getSerieData = (serie) => {
11
11
  };
12
12
 
13
13
  function StackedBars(props) {
14
+ const { d3 } = props;
15
+ const { scaleOrdinal, schemeSpectral, stack } = d3;
14
16
  const {
15
17
  element,
16
18
  height,
@@ -113,4 +115,4 @@ function StackedBars(props) {
113
115
  </React.Fragment>
114
116
  );
115
117
  }
116
- export default StackedBars;
118
+ export default injectLazyLibs(['d3'])(StackedBars);
@@ -123,7 +123,7 @@ const CopyPaste = (props) => {
123
123
  onMouseEnter={(e) => {
124
124
  if (
125
125
  e.altKey &&
126
- e.ctrlKey &&
126
+ e.shiftKey &&
127
127
  toolbar.current &&
128
128
  !toolbar.current.classList.contains('__dev_on')
129
129
  ) {
@@ -6,7 +6,7 @@
6
6
  import React from 'react';
7
7
  import { withRouter, matchPath, generatePath } from 'react-router';
8
8
  import { useSelector } from 'react-redux';
9
- // import langmap from 'langmap';
9
+ import { langmap } from '@plone/volto/helpers';
10
10
  import { flattenToAppURL } from '@plone/volto/helpers';
11
11
  import { Dropdown } from 'semantic-ui-react';
12
12
  import config from '@plone/volto/registry';
@@ -15,32 +15,32 @@ import { getN2kItems, pathExists } from '@eeacms/volto-n2k/helpers';
15
15
  import './styles.less';
16
16
 
17
17
  const LanguageSelector = (props) => {
18
+ const { settings } = config;
18
19
  const content = useSelector((state) => state.content);
19
20
  const n2kItems = getN2kItems(props.navigation.items);
20
21
  const localStorage = props.localStorage;
21
22
  const pathname = props.location.pathname;
22
23
  const currentLang = localStorage.get('N2K_LANGUAGE');
23
24
  const match = matchPath(pathname, {
24
- path: config.settings.multilingualPath,
25
+ path: settings.multilingualPath,
25
26
  exact: true,
26
27
  strict: false,
27
28
  });
28
29
  const hasMultilingualSupport =
29
- match && config.settings.supportedLanguages.includes(match.params.lang);
30
+ match && settings.supportedLanguages.includes(match.params.lang);
30
31
  const translations = hasMultilingualSupport
31
- ? config.settings.supportedLanguages.map((lang) => ({
32
- path: generatePath(config.settings.multilingualPath, {
32
+ ? settings.supportedLanguages.map((lang) => ({
33
+ path: generatePath(settings.multilingualPath, {
33
34
  ...match.params,
34
35
  lang,
35
36
  }),
36
37
  lang,
37
38
  }))
38
39
  : [];
39
- const { settings } = config;
40
40
  const supportedLanguagesOptions = settings.supportedLanguages.map((lang) => ({
41
41
  key: lang,
42
42
  value: lang,
43
- text: lang,
43
+ text: langmap[lang].nativeName,
44
44
  }));
45
45
 
46
46
  return (
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable no-extend-native */
2
2
  import React from 'react';
3
+ import loadable from '@loadable/component';
3
4
 
4
5
  import localStorage from './store';
5
6
 
@@ -7,12 +8,12 @@ import installAppExtras from './components/theme/AppExtras';
7
8
 
8
9
  import { LinkElement } from './components/manage/Blocks/SlateLink/render';
9
10
  import installBodyClass from './components/manage/Blocks/BodyClass';
10
- // import installBubbleChart from './components/manage/Blocks/BubbleChart';
11
+ import installBubbleChart from './components/manage/Blocks/BubbleChart';
11
12
  import installCarouselHorizontal from './components/manage/Blocks/CarouselHorizontal';
12
13
  import installCddaShape from './components/manage/Blocks/CddaShape';
13
14
  import installConnectedList from './components/manage/Blocks/List';
14
15
  import installContactBlock from './components/manage/Blocks/ContactBlock';
15
- // import installExplodedPiesChart from './components/manage/Blocks/ExplodedPiesChart';
16
+ import installExplodedPiesChart from './components/manage/Blocks/ExplodedPiesChart';
16
17
  import installExploreHabitats from './components/manage/Blocks/ExploreHabitats';
17
18
  import installExploreSites from './components/manage/Blocks/ExploreSites';
18
19
  import installExploreSpecies from './components/manage/Blocks/ExploreSpecies';
@@ -35,7 +36,7 @@ import installSpeciesBanner from './components/manage/Blocks/SpeciesBanner';
35
36
  import installSpeciesClassification from './components/manage/Blocks/SpeciesClassification';
36
37
  import installSpeciesDistribution from './components/manage/Blocks/SpeciesDistribution';
37
38
  import installSpeciesProtectedSites from './components/manage/Blocks/SpeciesProtectedSites';
38
- // import installStackedBarChart from './components/manage/Blocks/StackedBarChart';
39
+ import installStackedBarChart from './components/manage/Blocks/StackedBarChart';
39
40
  import installTilesImages from './components/manage/Blocks/TilesImages';
40
41
 
41
42
  import { LINK } from 'volto-slate/constants';
@@ -123,16 +124,21 @@ const applyConfig = (config) => {
123
124
 
124
125
  config.settings.slate.elements[LINK] = LinkElement;
125
126
 
127
+ config.settings.loadables = {
128
+ ...config.settings.loadables,
129
+ d3: loadable.lib(() => import('d3')),
130
+ };
131
+
126
132
  return [
127
133
  installAppExtras,
128
134
 
129
135
  installBodyClass,
130
- // installBubbleChart,
136
+ installBubbleChart,
131
137
  installCarouselHorizontal,
132
138
  installCddaShape,
133
139
  installConnectedList,
134
140
  installContactBlock,
135
- // installExplodedPiesChart,
141
+ installExplodedPiesChart,
136
142
  installExploreHabitats,
137
143
  installExploreSites,
138
144
  installExploreSpecies,
@@ -155,7 +161,7 @@ const applyConfig = (config) => {
155
161
  installSpeciesClassification,
156
162
  installSpeciesDistribution,
157
163
  installSpeciesProtectedSites,
158
- // installStackedBarChart,
164
+ installStackedBarChart,
159
165
  installTilesImages,
160
166
  ].reduce((acc, apply) => apply(acc), config);
161
167
  };
@@ -127,7 +127,7 @@
127
127
  text-align: left;
128
128
  transform: translate(-100%, 0);
129
129
 
130
- @media only screen and (max-width: @largestMobileScreen + 53px) {
130
+ @media only screen and (max-width: calc(@largestMobileScreen + 53px)) {
131
131
  display: none;
132
132
  }
133
133
  }