@treely/strapi-slices 5.14.0 → 5.15.0

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.
@@ -56,6 +56,7 @@ declare const getMessages: (locale: string) => {
56
56
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
57
57
  'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
58
58
  'features.projectInfo.properties.forecastedAmountYear.label': string;
59
+ 'features.projectInfo.properties.forecastedAmountYear.toolTip': string;
59
60
  'features.projectInfo.properties.riskBuffer': string;
60
61
  'features.projectInfo.properties.year': string;
61
62
  'components.portfolioProjectCard.text.yes': string;
@@ -125,6 +126,7 @@ declare const getMessages: (locale: string) => {
125
126
  'features.projectInfo.properties.verificationStandard.label': string;
126
127
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
127
128
  'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
129
+ 'features.projectInfo.properties.forecastedAmountYear.toolTip': string;
128
130
  'features.projectInfo.properties.forecastedAmountYear.label': string;
129
131
  'features.projectInfo.properties.riskBuffer': string;
130
132
  'features.projectInfo.properties.year': string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treely/strapi-slices",
3
- "version": "5.14.0",
3
+ "version": "5.15.0",
4
4
  "license": "MIT",
5
5
  "author": "Tree.ly FlexCo",
6
6
  "description": "@treely/strapi-slices is a open source library maintained by Tree.ly.",
@@ -1,8 +1,14 @@
1
1
  import React from 'react';
2
- import { render, screen } from '../../../test/testUtils';
2
+ import {
3
+ render,
4
+ screen,
5
+ userEvent,
6
+ waitForElementToBeRemoved,
7
+ } from '../../../test/testUtils';
3
8
  import portfolioProjectMock from '../../../test/mocks/portfolioProjectMock';
4
9
  import ProjectInfo from '.';
5
10
  import { ProjectInfoProps } from './ProjectInfo';
11
+ import messagesEn from './messages.en';
6
12
 
7
13
  const defaultProps: ProjectInfoProps = {
8
14
  project: portfolioProjectMock,
@@ -66,6 +72,24 @@ describe('The ProjectInfo component', () => {
66
72
  expect(screen.getByText('1 year')).toBeInTheDocument();
67
73
  });
68
74
 
75
+ it('sets the tooltip when hovered over the forecasted amount subtitle', async () => {
76
+ setup({
77
+ ...defaultProps,
78
+ });
79
+
80
+ const trigger = screen.getByText('Forecasted amount subtitle');
81
+ await userEvent.hover(trigger);
82
+
83
+ const tooltip = await screen.findByRole('tooltip');
84
+ expect(tooltip).toHaveTextContent(
85
+ messagesEn['features.projectInfo.properties.forecastedAmountYear.toolTip']
86
+ );
87
+
88
+ await userEvent.unhover(trigger);
89
+ await waitForElementToBeRemoved(() => screen.queryByRole('tooltip'));
90
+ expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
91
+ });
92
+
69
93
  it('displays the issuer of the project if it exists', () => {
70
94
  setup({
71
95
  project: {
@@ -8,6 +8,7 @@ import {
8
8
  LabelTextPair,
9
9
  SimpleGrid,
10
10
  Spacer,
11
+ Tooltip,
11
12
  } from 'boemly';
12
13
  import Image from 'next/image';
13
14
  import convertAreaM2ToHa from '../../../utils/convertAreaM2ToHa';
@@ -201,27 +202,33 @@ export const ProjectInfo: React.FC<ProjectInfoProps> = ({
201
202
  <Divider />
202
203
  <Spacer height="8" />
203
204
  <SimpleGrid columns={[1, null, null, 2]} spacingX="10" spacingY="8">
204
- <Box>
205
- <LabelTextPair
206
- label={formatMessage({
207
- id: 'features.projectInfo.properties.forecastedAmountYear.label',
208
- })}
209
- text={formatMessage(
210
- {
211
- id: 'unit.formatter.tonsCo2PerYear',
212
- },
213
- {
214
- number: formatNumber(
215
- convertCo2AmountKgToTons(
216
- project.forecastedAmountYearly.toString()
205
+ <Tooltip
206
+ label={formatMessage({
207
+ id: 'features.projectInfo.properties.forecastedAmountYear.toolTip',
208
+ })}
209
+ >
210
+ <Box>
211
+ <LabelTextPair
212
+ label={formatMessage({
213
+ id: 'features.projectInfo.properties.forecastedAmountYear.label',
214
+ })}
215
+ text={formatMessage(
216
+ {
217
+ id: 'unit.formatter.tonsCo2PerYear',
218
+ },
219
+ {
220
+ number: formatNumber(
221
+ convertCo2AmountKgToTons(
222
+ project.forecastedAmountYearly.toString()
223
+ ),
224
+ { maximumFractionDigits: 0 }
217
225
  ),
218
- { maximumFractionDigits: 0 }
219
- ),
220
- }
221
- )}
222
- caption={subtitles.forecastedAmountSubtitle}
223
- />
224
- </Box>
226
+ }
227
+ )}
228
+ caption={subtitles.forecastedAmountSubtitle}
229
+ />
230
+ </Box>
231
+ </Tooltip>
225
232
 
226
233
  <Box>
227
234
  <LabelTextPair
@@ -12,6 +12,8 @@ const messagesDe = {
12
12
  'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
13
13
  'features.projectInfo.properties.verificationStandard.value.MfKWCH':
14
14
  'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
15
+ 'features.projectInfo.properties.forecastedAmountYear.toolTip':
16
+ 'Dies ist das jährliche Projekt-Senkenvolumen gemäß dem TÜV-geprüften PDD, dieser Wert stellt nicht die aktuellen Verfügbarkeiten dar.',
15
17
  'features.projectInfo.properties.forecastedAmountYear.label':
16
18
  'Projektvolumen',
17
19
  'features.projectInfo.properties.riskBuffer': 'Anteil Risikopuffer',
@@ -14,6 +14,8 @@ const messagesEn = {
14
14
  'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
15
15
  'features.projectInfo.properties.forecastedAmountYear.label':
16
16
  'Project Volume',
17
+ 'features.projectInfo.properties.forecastedAmountYear.toolTip':
18
+ "This is the yearly project sink volume according to the TÜV-verified PDD, this value doesn't represent current availabilities.",
17
19
  'features.projectInfo.properties.riskBuffer': 'Risk Buffer Share',
18
20
 
19
21
  'features.projectInfo.properties.year':