@treely/strapi-slices 7.14.0 → 7.15.1
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/dist/components/portfolio/ProjectInfo/ProjectInfo.d.ts +1 -1
- package/dist/components/portfolio/ProjectInfo/messages.de.d.ts +2 -2
- package/dist/components/portfolio/ProjectInfo/messages.en.d.ts +2 -2
- package/dist/integrations/strapi/getFpmProjectById.d.ts +3 -0
- package/dist/models/fpm/FPMProject.d.ts +1 -0
- package/dist/rootMessages.de.d.ts +2 -2
- package/dist/rootMessages.en.d.ts +2 -2
- package/dist/slices/ProjectFacts/ProjectFacts.d.ts +1 -1
- package/dist/strapi-slices.cjs.development.js +94 -15
- package/dist/strapi-slices.cjs.development.js.map +1 -1
- package/dist/strapi-slices.cjs.production.min.js +1 -1
- package/dist/strapi-slices.cjs.production.min.js.map +1 -1
- package/dist/strapi-slices.esm.js +94 -15
- package/dist/strapi-slices.esm.js.map +1 -1
- package/dist/utils/getMessages.d.ts +4 -4
- package/package.json +1 -1
- package/src/components/portfolio/ProjectInfo/ProjectInfo.test.tsx +10 -5
- package/src/components/portfolio/ProjectInfo/ProjectInfo.tsx +31 -24
- package/src/components/portfolio/ProjectInfo/messages.de.ts +3 -4
- package/src/components/portfolio/ProjectInfo/messages.en.ts +3 -4
- package/src/integrations/strapi/getFpmProjectById.test.ts +24 -0
- package/src/integrations/strapi/getFpmProjectById.ts +12 -0
- package/src/models/fpm/FPMProject.ts +1 -0
- package/src/slices/ProjectFacts/ProjectFacts.stories.tsx +2 -1
- package/src/slices/ProjectFacts/ProjectFacts.test.tsx +54 -6
- package/src/slices/ProjectFacts/ProjectFacts.tsx +49 -4
- package/src/slices/TextWithCard/TextWithCard.stories.tsx +1 -0
- package/src/test/integrationMocks/fpmProjectMock.ts +1 -0
- package/src/utils/shuffleElements.test.ts +30 -12
|
@@ -10,7 +10,7 @@ export interface ProjectInfoProps {
|
|
|
10
10
|
projectTypeSubtitle?: string;
|
|
11
11
|
projectDeveloperSubtitle?: string;
|
|
12
12
|
verificationStandardSubtitle?: string;
|
|
13
|
-
|
|
13
|
+
averageSellableAmountPerYearSubtitle?: string;
|
|
14
14
|
riskBufferSubtitle?: string;
|
|
15
15
|
buyCreditsSubtitle?: string;
|
|
16
16
|
};
|
|
@@ -9,8 +9,8 @@ declare const messagesDe: {
|
|
|
9
9
|
'features.projectInfo.properties.verificationStandard.label': string;
|
|
10
10
|
'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
|
|
11
11
|
'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
|
|
12
|
-
'features.projectInfo.properties.
|
|
13
|
-
'features.projectInfo.properties.
|
|
12
|
+
'features.projectInfo.properties.projectVolume.toolTip': string;
|
|
13
|
+
'features.projectInfo.properties.projectVolume.label': string;
|
|
14
14
|
'features.projectInfo.properties.riskBuffer': string;
|
|
15
15
|
'features.projectInfo.properties.year': string;
|
|
16
16
|
};
|
|
@@ -9,8 +9,8 @@ declare const messagesEn: {
|
|
|
9
9
|
'features.projectInfo.properties.verificationStandard.label': string;
|
|
10
10
|
'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
|
|
11
11
|
'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
|
|
12
|
-
'features.projectInfo.properties.
|
|
13
|
-
'features.projectInfo.properties.
|
|
12
|
+
'features.projectInfo.properties.projectVolume.label': string;
|
|
13
|
+
'features.projectInfo.properties.projectVolume.toolTip': string;
|
|
14
14
|
'features.projectInfo.properties.riskBuffer': string;
|
|
15
15
|
'features.projectInfo.properties.year': string;
|
|
16
16
|
};
|
|
@@ -62,8 +62,8 @@ declare const rootMessagesDe: {
|
|
|
62
62
|
'features.projectInfo.properties.verificationStandard.label': string;
|
|
63
63
|
'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
|
|
64
64
|
'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
|
|
65
|
-
'features.projectInfo.properties.
|
|
66
|
-
'features.projectInfo.properties.
|
|
65
|
+
'features.projectInfo.properties.projectVolume.toolTip': string;
|
|
66
|
+
'features.projectInfo.properties.projectVolume.label': string;
|
|
67
67
|
'features.projectInfo.properties.riskBuffer': string;
|
|
68
68
|
'features.projectInfo.properties.year': string;
|
|
69
69
|
'features.portfolio.documentsDownloadList.projectDocuments': string;
|
|
@@ -62,8 +62,8 @@ declare const rootMessagesEn: {
|
|
|
62
62
|
'features.projectInfo.properties.verificationStandard.label': string;
|
|
63
63
|
'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
|
|
64
64
|
'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
|
|
65
|
-
'features.projectInfo.properties.
|
|
66
|
-
'features.projectInfo.properties.
|
|
65
|
+
'features.projectInfo.properties.projectVolume.label': string;
|
|
66
|
+
'features.projectInfo.properties.projectVolume.toolTip': string;
|
|
67
67
|
'features.projectInfo.properties.riskBuffer': string;
|
|
68
68
|
'features.projectInfo.properties.year': string;
|
|
69
69
|
'features.portfolio.documentsDownloadList.projectDocuments': string;
|
|
@@ -23,7 +23,7 @@ export interface ProjectFactsProps {
|
|
|
23
23
|
projectTypeSubtitle?: string;
|
|
24
24
|
projectDeveloperSubtitle?: string;
|
|
25
25
|
verificationStandardSubtitle?: string;
|
|
26
|
-
|
|
26
|
+
averageSellableAmountPerYearSubtitle?: string;
|
|
27
27
|
riskBufferSubtitle?: string;
|
|
28
28
|
buyCreditsSubtitle?: string;
|
|
29
29
|
contactTitle?: string;
|
|
@@ -1433,8 +1433,8 @@ var messagesDe$7 = {
|
|
|
1433
1433
|
'features.projectInfo.properties.verificationStandard.label': 'Verifizierungsstandard',
|
|
1434
1434
|
'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
|
|
1435
1435
|
'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
|
|
1436
|
-
'features.projectInfo.properties.
|
|
1437
|
-
'features.projectInfo.properties.
|
|
1436
|
+
'features.projectInfo.properties.projectVolume.toolTip': 'Dies ist die durchschnittliche Anzahl der Credits, die pro Jahr ausgestellt werden. Dieser Wert entspricht nicht den Verfügbarkeiten.',
|
|
1437
|
+
'features.projectInfo.properties.projectVolume.label': 'Projektvolumen',
|
|
1438
1438
|
'features.projectInfo.properties.riskBuffer': 'Anteil Risikopuffer',
|
|
1439
1439
|
'features.projectInfo.properties.year': '{years} {years, plural, one {Jahr} other {Jahre} }'
|
|
1440
1440
|
};
|
|
@@ -1574,8 +1574,8 @@ var messagesEn$3 = {
|
|
|
1574
1574
|
'features.projectInfo.properties.verificationStandard.label': 'Verification Standard',
|
|
1575
1575
|
'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
|
|
1576
1576
|
'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
|
|
1577
|
-
'features.projectInfo.properties.
|
|
1578
|
-
'features.projectInfo.properties.
|
|
1577
|
+
'features.projectInfo.properties.projectVolume.label': 'Project Volume',
|
|
1578
|
+
'features.projectInfo.properties.projectVolume.toolTip': "This is the average amount of credits that are issued per year. This value doesn't represent availabilities.",
|
|
1579
1579
|
'features.projectInfo.properties.riskBuffer': 'Risk Buffer Share',
|
|
1580
1580
|
'features.projectInfo.properties.year': '{years} {years, plural, one {year} other {years} }'
|
|
1581
1581
|
};
|
|
@@ -5608,37 +5608,37 @@ var ProjectInfo = function ProjectInfo(_ref) {
|
|
|
5608
5608
|
style: {
|
|
5609
5609
|
objectFit: 'contain'
|
|
5610
5610
|
}
|
|
5611
|
-
})))) : React__default.default.createElement(React__default.default.Fragment, null), project.
|
|
5611
|
+
})))) : React__default.default.createElement(React__default.default.Fragment, null), project.averageSellableAmountPerYear && project.averageSellableAmountPerYear > 0 || project.riskBuffer ? React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(boemly.Spacer, {
|
|
5612
5612
|
height: "8"
|
|
5613
5613
|
}), React__default.default.createElement(boemly.Divider, null), React__default.default.createElement(boemly.Spacer, {
|
|
5614
5614
|
height: "8"
|
|
5615
|
-
}), React__default.default.createElement(boemly.SimpleGrid, {
|
|
5615
|
+
})) : React__default.default.createElement(React__default.default.Fragment, null), React__default.default.createElement(boemly.SimpleGrid, {
|
|
5616
5616
|
columns: [1, null, null, 2],
|
|
5617
5617
|
spacingX: "10",
|
|
5618
5618
|
spacingY: "8"
|
|
5619
|
-
}, React__default.default.createElement(boemly.Tooltip, {
|
|
5619
|
+
}, project.averageSellableAmountPerYear && project.averageSellableAmountPerYear > 0 && React__default.default.createElement(boemly.Tooltip, {
|
|
5620
5620
|
label: formatMessage({
|
|
5621
|
-
id: 'features.projectInfo.properties.
|
|
5621
|
+
id: 'features.projectInfo.properties.projectVolume.toolTip'
|
|
5622
5622
|
})
|
|
5623
5623
|
}, React__default.default.createElement(boemly.Box, null, React__default.default.createElement(boemly.LabelTextPair, {
|
|
5624
5624
|
label: formatMessage({
|
|
5625
|
-
id: 'features.projectInfo.properties.
|
|
5625
|
+
id: 'features.projectInfo.properties.projectVolume.label'
|
|
5626
5626
|
}),
|
|
5627
5627
|
text: formatMessage({
|
|
5628
5628
|
id: 'unit.formatter.tonsCo2PerYear'
|
|
5629
5629
|
}, {
|
|
5630
|
-
number: formatNumber(convertCo2AmountKgToTons(project.
|
|
5630
|
+
number: formatNumber(convertCo2AmountKgToTons(project.averageSellableAmountPerYear.toString()), {
|
|
5631
5631
|
maximumFractionDigits: 0
|
|
5632
5632
|
})
|
|
5633
5633
|
}),
|
|
5634
|
-
caption: subtitles.
|
|
5635
|
-
}))), React__default.default.createElement(boemly.Box, null, React__default.default.createElement(boemly.LabelTextPair, {
|
|
5634
|
+
caption: subtitles.averageSellableAmountPerYearSubtitle
|
|
5635
|
+
}))), project.riskBuffer && React__default.default.createElement(boemly.Box, null, React__default.default.createElement(boemly.LabelTextPair, {
|
|
5636
5636
|
label: formatMessage({
|
|
5637
5637
|
id: 'features.projectInfo.properties.riskBuffer'
|
|
5638
5638
|
}),
|
|
5639
5639
|
text: formatNumber(project.riskBuffer / 100, FORMAT_AS_PERCENT_CONFIG),
|
|
5640
5640
|
caption: subtitles.riskBufferSubtitle
|
|
5641
|
-
})))
|
|
5641
|
+
}))), React__default.default.createElement(boemly.Box, {
|
|
5642
5642
|
mt: "2"
|
|
5643
5643
|
}, React__default.default.createElement(CreditsAvailableBadge, {
|
|
5644
5644
|
status: project.creditAvailability
|
|
@@ -5742,18 +5742,97 @@ var Contact = function Contact(_ref) {
|
|
|
5742
5742
|
}) : React__default.default.createElement(React__default.default.Fragment, null)));
|
|
5743
5743
|
};
|
|
5744
5744
|
|
|
5745
|
+
var getFpmProjectById = /*#__PURE__*/function () {
|
|
5746
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(projectId) {
|
|
5747
|
+
var fpmResponse;
|
|
5748
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5749
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5750
|
+
case 0:
|
|
5751
|
+
_context.next = 2;
|
|
5752
|
+
return fpmClient.get("/public/projects/" + projectId);
|
|
5753
|
+
case 2:
|
|
5754
|
+
fpmResponse = _context.sent;
|
|
5755
|
+
return _context.abrupt("return", fpmResponse.data);
|
|
5756
|
+
case 4:
|
|
5757
|
+
case "end":
|
|
5758
|
+
return _context.stop();
|
|
5759
|
+
}
|
|
5760
|
+
}, _callee);
|
|
5761
|
+
}));
|
|
5762
|
+
return function getFpmProjectById(_x) {
|
|
5763
|
+
return _ref.apply(this, arguments);
|
|
5764
|
+
};
|
|
5765
|
+
}();
|
|
5766
|
+
|
|
5745
5767
|
var ProjectFacts = function ProjectFacts(_ref) {
|
|
5746
5768
|
var slice = _ref.slice,
|
|
5747
5769
|
project = _ref.project;
|
|
5748
|
-
|
|
5770
|
+
var _useState = React.useState(project),
|
|
5771
|
+
enhancedProject = _useState[0],
|
|
5772
|
+
setEnhancedProject = _useState[1];
|
|
5773
|
+
var _useState2 = React.useState(false),
|
|
5774
|
+
isLoading = _useState2[0],
|
|
5775
|
+
setIsLoading = _useState2[1];
|
|
5776
|
+
React.useEffect(function () {
|
|
5777
|
+
var fetchCompleteProjectData = /*#__PURE__*/function () {
|
|
5778
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5779
|
+
var completeFpmProject, mergedProject;
|
|
5780
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5781
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5782
|
+
case 0:
|
|
5783
|
+
if (!(project && project.id)) {
|
|
5784
|
+
_context.next = 17;
|
|
5785
|
+
break;
|
|
5786
|
+
}
|
|
5787
|
+
setIsLoading(true);
|
|
5788
|
+
_context.prev = 2;
|
|
5789
|
+
_context.next = 5;
|
|
5790
|
+
return getFpmProjectById(project.id);
|
|
5791
|
+
case 5:
|
|
5792
|
+
completeFpmProject = _context.sent;
|
|
5793
|
+
// Merge the complete FPM data with existing project data (preserving Strapi fields like slug, portfolioHost, thumbnail)
|
|
5794
|
+
mergedProject = _extends({}, completeFpmProject, {
|
|
5795
|
+
slug: project.slug,
|
|
5796
|
+
portfolioHost: project.portfolioHost,
|
|
5797
|
+
thumbnail: project.thumbnail
|
|
5798
|
+
});
|
|
5799
|
+
setEnhancedProject(mergedProject);
|
|
5800
|
+
_context.next = 14;
|
|
5801
|
+
break;
|
|
5802
|
+
case 10:
|
|
5803
|
+
_context.prev = 10;
|
|
5804
|
+
_context.t0 = _context["catch"](2);
|
|
5805
|
+
console.error('Error fetching complete project data:', _context.t0);
|
|
5806
|
+
// Fallback to original project data if fetch fails
|
|
5807
|
+
setEnhancedProject(project);
|
|
5808
|
+
case 14:
|
|
5809
|
+
_context.prev = 14;
|
|
5810
|
+
setIsLoading(false);
|
|
5811
|
+
return _context.finish(14);
|
|
5812
|
+
case 17:
|
|
5813
|
+
case "end":
|
|
5814
|
+
return _context.stop();
|
|
5815
|
+
}
|
|
5816
|
+
}, _callee, null, [[2, 10, 14, 17]]);
|
|
5817
|
+
}));
|
|
5818
|
+
return function fetchCompleteProjectData() {
|
|
5819
|
+
return _ref2.apply(this, arguments);
|
|
5820
|
+
};
|
|
5821
|
+
}();
|
|
5822
|
+
fetchCompleteProjectData();
|
|
5823
|
+
}, [project]);
|
|
5824
|
+
if (!enhancedProject) {
|
|
5749
5825
|
return React__default.default.createElement(React__default.default.Fragment, null, "Invalid configuration, check if a project this id exists in the FPM");
|
|
5750
5826
|
}
|
|
5827
|
+
if (isLoading) {
|
|
5828
|
+
return React__default.default.createElement(boemly.DefaultSectionContainer, null, React__default.default.createElement(boemly.Wrapper, null, React__default.default.createElement("div", null, "Loading project data...")));
|
|
5829
|
+
}
|
|
5751
5830
|
return React__default.default.createElement(boemly.DefaultSectionContainer, null, React__default.default.createElement(boemly.Wrapper, null, React__default.default.createElement(boemly.Flex, {
|
|
5752
5831
|
flexDir: ['column', null, null, 'row'],
|
|
5753
5832
|
gap: "4",
|
|
5754
5833
|
width: "full"
|
|
5755
5834
|
}, React__default.default.createElement(ProjectInfo, {
|
|
5756
|
-
project:
|
|
5835
|
+
project: enhancedProject,
|
|
5757
5836
|
subtitles: slice
|
|
5758
5837
|
}), React__default.default.createElement(boemly.Flex, {
|
|
5759
5838
|
flexDir: "column",
|