From 95f2e82dbbe44b4db7cb20433fc73b1851437e5c Mon Sep 17 00:00:00 2001
From: dobri1408 <50819975+dobri1408@users.noreply.github.com>
Date: Tue, 25 Jul 2023 17:38:47 +0300
Subject: [PATCH 1/3] feat: Use the new @eeacms/countup library refs - #254634
---
package.json | 6 +----
src/StatisticBlock/View.jsx | 44 ++++++++++++--------------------
src/StatisticBlock/View.test.jsx | 6 ++++-
3 files changed, 22 insertions(+), 34 deletions(-)
diff --git a/package.json b/package.json
index b102770..dc32044 100644
--- a/package.json
+++ b/package.json
@@ -17,12 +17,8 @@
"url": "git@github.com:eea/volto-statistic-block.git"
},
"addons": [],
- "resolutions": {
- "react-countup/countup.js": "2.5.0"
- },
"dependencies": {
- "react-countup": "6.3.1",
- "react-visibility-sensor": "5.1.1"
+ "@eeacms/countup": "*"
},
"devDependencies": {
"@cypress/code-coverage": "^3.10.0",
diff --git a/src/StatisticBlock/View.jsx b/src/StatisticBlock/View.jsx
index 4ea39c9..2d18fa4 100644
--- a/src/StatisticBlock/View.jsx
+++ b/src/StatisticBlock/View.jsx
@@ -2,8 +2,7 @@ import React from 'react';
import isNumber from 'lodash/isNumber';
import isNaN from 'lodash/isNaN';
import cx from 'classnames';
-import CountUp from 'react-countup';
-import VisibilitySensor from 'react-visibility-sensor';
+import { CountUp } from '@eeacms/countup';
import { Statistic } from 'semantic-ui-react';
import { UniversalLink } from '@plone/volto/components';
import {
@@ -18,25 +17,6 @@ import {
import './styles.less';
-const CountUpWrapper = ({ countUpRef, start }) => {
- const [visible, setVisible] = React.useState(false);
-
- return (
- {
- start();
- if (isVisible && !visible) {
- setVisible(true);
- }
- }}
- active={!visible}
- delayedCall
- >
-
-
- );
-};
-
const View = ({ data, mode }) => {
const {
horizontal = false,
@@ -93,13 +73,21 @@ const View = ({ data, mode }) => {
{animation.enabled && isNumber(valueNo) && !isNaN(valueNo) ? (
0 ? animation.duration : 2}
- decimals={animation.decimals > 0 ? animation.decimals : 0}
- prefix={animation.prefix || ''}
- suffix={animation.suffix || ''}
- >
- {(props) => }
-
+ isCounting
+ duration={parseInt(
+ animation.duration > 0 ? animation.duration : 2,
+ )}
+ decimalPlaces={
+ animation.decimals > 0 ? animation.decimals : 0
+ }
+ formatter={(value) => {
+ let prefix = animation.prefix || '';
+ let suffix = animation.suffix || '';
+ return (
+ prefix + value.toFixed(animation.decimals) + suffix
+ );
+ }}
+ />
) : (
_serializeNodes(valueNodes)
)}
diff --git a/src/StatisticBlock/View.test.jsx b/src/StatisticBlock/View.test.jsx
index c7bbc51..d35be4b 100644
--- a/src/StatisticBlock/View.test.jsx
+++ b/src/StatisticBlock/View.test.jsx
@@ -7,7 +7,11 @@ import '@testing-library/jest-dom/extend-expect';
jest.mock('lodash/isNumber', () => jest.fn(() => true));
jest.mock('lodash/isNaN', () => jest.fn(() => false));
-jest.mock('react-countup', () => () =>
Mocked CountUp
);
+jest.mock('@eeacms/countup', () => ({
+ CountUp: () => {
+ return Mocked CountUp
;
+ },
+}));
jest.mock('@plone/volto/components', () => ({
UniversalLink: ({ children }) => {children}
,
From f9c224615a638c62f26de1115c1f957827d87949 Mon Sep 17 00:00:00 2001
From: Alin Voinea
Date: Tue, 25 Jul 2023 18:09:02 +0300
Subject: [PATCH 2/3] Release 2.0.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index dc32044..5043cc2 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-statistic-block",
- "version": "1.3.1",
+ "version": "2.0.0",
"description": "@eeacms/volto-statistic-block: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
From 14bd4ceaaca4b6ca49df9bc835e27bdb2b01476c Mon Sep 17 00:00:00 2001
From: EEA Jenkins <@users.noreply.github.com>
Date: Tue, 25 Jul 2023 15:31:06 +0000
Subject: [PATCH 3/3] Automated release 2.0.0
---
CHANGELOG.md | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5000917..5d4828a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
+### [2.0.0](https://github.com/eea/volto-statistic-block/compare/1.3.1...2.0.0) - 25 July 2023
+
+#### :rocket: New Features
+
+- feat: Use the new @eeacms/countup library refs - #254634 [dobri1408 - [`95f2e82`](https://github.com/eea/volto-statistic-block/commit/95f2e82dbbe44b4db7cb20433fc73b1851437e5c)]
+
+#### :hammer_and_wrench: Others
+
+- Release 2.0.0 [Alin Voinea - [`f9c2246`](https://github.com/eea/volto-statistic-block/commit/f9c224615a638c62f26de1115c1f957827d87949)]
### [1.3.1](https://github.com/eea/volto-statistic-block/compare/1.3.0...1.3.1) - 24 July 2023
#### :bug: Bug Fixes
@@ -20,7 +29,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### :house: Internal changes
-- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`3dc3490`](https://github.com/eea/volto-statistic-block/commit/3dc34908cf22514318c3fd737d517c8261da7fd4)]
#### :hammer_and_wrench: Others
@@ -45,30 +53,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- use countup.js@2.5.0 [Miu Razvan - [`9dad099`](https://github.com/eea/volto-statistic-block/commit/9dad099fb6519688752bf4788023712bd9719671)]
- bump version [Miu Razvan - [`e886513`](https://github.com/eea/volto-statistic-block/commit/e886513e63bf480dcdb5c9e0a627b31c6b4e989d)]
-- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`7cf6d5b`](https://github.com/eea/volto-statistic-block/commit/7cf6d5b1427a9f17bb1c740d019130e323668286)]
### [1.1.0](https://github.com/eea/volto-statistic-block/compare/1.0.1...1.1.0) - 27 March 2023
#### :hammer_and_wrench: Others
-- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`1ecdcec`](https://github.com/eea/volto-statistic-block/commit/1ecdcec0ef98c891d9157db9592365fc10760b59)]
-- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`e5f76cc`](https://github.com/eea/volto-statistic-block/commit/e5f76cc8f90dfa21ba1f2bb25b2491ae0e1b102d)]
-- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`439ba7f`](https://github.com/eea/volto-statistic-block/commit/439ba7f0016eb5ba86ef267309e0ddef7b81f379)]
-- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`1e72601`](https://github.com/eea/volto-statistic-block/commit/1e72601f1f9a7e8023c9130407d9ce28f1d7b6f9)]
-- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`9ab65ad`](https://github.com/eea/volto-statistic-block/commit/9ab65ad0f5b300a14590f5f260659749f4831956)]
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`75e506f`](https://github.com/eea/volto-statistic-block/commit/75e506fd7cf92296871ddf52f9b1c82a053ec931)]
-- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`9297e9f`](https://github.com/eea/volto-statistic-block/commit/9297e9fb8a638a1564d7d7a6d2ebbea0056d775e)]
-- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`6dde4aa`](https://github.com/eea/volto-statistic-block/commit/6dde4aae3c87bfe434a28719479e37078db11099)]
-- yarn 3 [Alin Voinea - [`b4949e1`](https://github.com/eea/volto-statistic-block/commit/b4949e18f23a7965c76ef97a5790607a587987dc)]
-- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`8820afa`](https://github.com/eea/volto-statistic-block/commit/8820afa4ab8fcebd17e90522196c1fde8b246e21)]
-- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`8eb5b8d`](https://github.com/eea/volto-statistic-block/commit/8eb5b8de3f87152cb57faeb960233791b328c900)]
-- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`58f36bd`](https://github.com/eea/volto-statistic-block/commit/58f36bd4ae9dcdccbef182789957dbf0bb97da74)]
-- Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`3bb9a21`](https://github.com/eea/volto-statistic-block/commit/3bb9a2128a88c1196258722112a1957f60d332fc)]
### [1.0.1](https://github.com/eea/volto-statistic-block/compare/1.0.0...1.0.1) - 16 November 2022
#### :hammer_and_wrench: Others
- test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`d81878f`](https://github.com/eea/volto-statistic-block/commit/d81878fff2ba1be4446dd330560c46d8161f8bc2)]
-- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`a58f436`](https://github.com/eea/volto-statistic-block/commit/a58f436c5bb052fcdd13b213895c497881e48c67)]
## [1.0.0](https://github.com/eea/volto-statistic-block/compare/0.3.0...1.0.0) - 28 October 2022
#### :nail_care: Enhancements
@@ -80,7 +74,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### :hammer_and_wrench: Others
- Cleanup [Alin Voinea - [`6d5f4a6`](https://github.com/eea/volto-statistic-block/commit/6d5f4a6d8048689e97e567316f24902d0865de88)]
-- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`5fd7ba7`](https://github.com/eea/volto-statistic-block/commit/5fd7ba7a4595e157bdb0ebb0932f1d3afd64b369)]
### [0.3.0](https://github.com/eea/volto-statistic-block/compare/0.2.0...0.3.0) - 19 September 2022
#### :nail_care: Enhancements
@@ -111,7 +104,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### :hammer_and_wrench: Others
- Remove useless from block title [Alin Voinea - [`a3daf0a`](https://github.com/eea/volto-statistic-block/commit/a3daf0ad63666d0cd87eef465f42f525a5a307bc)]
-- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`4a9ea35`](https://github.com/eea/volto-statistic-block/commit/4a9ea35d0717941e9d96a29e46dc85717140fccf)]
### [0.1.1](https://github.com/eea/volto-statistic-block/compare/0.1.0...0.1.1) - 10 March 2022
#### :hammer_and_wrench: Others
@@ -122,5 +114,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### :hammer_and_wrench: Others
-- yarn bootstrap [Alin Voinea - [`ba85706`](https://github.com/eea/volto-statistic-block/commit/ba857067b16dc04f9bc970b0c0d4afd479bb7528)]
- Initial commit [Alin Voinea - [`2e19fe2`](https://github.com/eea/volto-statistic-block/commit/2e19fe2708f89887d2d79f88696e197643ea10f4)]