@treely/strapi-slices 7.15.1 → 7.15.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treely/strapi-slices",
3
- "version": "7.15.1",
3
+ "version": "7.15.2",
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.",
@@ -43,7 +43,6 @@ export const ProjectInfo: React.FC<ProjectInfoProps> = ({
43
43
  subtitles,
44
44
  }: ProjectInfoProps) => {
45
45
  const { formatMessage, formatNumber, formatDate } = useContext(IntlContext);
46
-
47
46
  return (
48
47
  <Container p="2" width="full">
49
48
  <Heading size="xl" textAlign="left">
@@ -208,36 +207,39 @@ export const ProjectInfo: React.FC<ProjectInfoProps> = ({
208
207
  <></>
209
208
  )}
210
209
  <SimpleGrid columns={[1, null, null, 2]} spacingX="10" spacingY="8">
211
- {project.averageSellableAmountPerYear &&
212
- project.averageSellableAmountPerYear > 0 && (
213
- <Tooltip
214
- label={formatMessage({
215
- id: 'features.projectInfo.properties.projectVolume.toolTip',
216
- })}
217
- >
218
- <Box>
219
- <LabelTextPair
220
- label={formatMessage({
221
- id: 'features.projectInfo.properties.projectVolume.label',
222
- })}
223
- text={formatMessage(
224
- {
225
- id: 'unit.formatter.tonsCo2PerYear',
226
- },
227
- {
228
- number: formatNumber(
229
- convertCo2AmountKgToTons(
230
- project.averageSellableAmountPerYear.toString()
231
- ),
232
- { maximumFractionDigits: 0 }
210
+ {project.averageSellableAmountPerYear > 0 ? (
211
+ <Tooltip
212
+ label={formatMessage({
213
+ id: 'features.projectInfo.properties.projectVolume.toolTip',
214
+ })}
215
+ >
216
+ <Box>
217
+ <LabelTextPair
218
+ label={formatMessage({
219
+ id: 'features.projectInfo.properties.projectVolume.label',
220
+ })}
221
+ text={formatMessage(
222
+ {
223
+ id: 'unit.formatter.tonsCo2PerYear',
224
+ },
225
+ {
226
+ number: formatNumber(
227
+ convertCo2AmountKgToTons(
228
+ project.averageSellableAmountPerYear.toString()
233
229
  ),
234
- }
235
- )}
236
- caption={subtitles.averageSellableAmountPerYearSubtitle}
237
- />
238
- </Box>
239
- </Tooltip>
240
- )}
230
+ { maximumFractionDigits: 0 }
231
+ ),
232
+ }
233
+ )}
234
+ caption={subtitles.averageSellableAmountPerYearSubtitle}
235
+ />
236
+ </Box>
237
+ </Tooltip>
238
+ ) : (
239
+ <Box>
240
+ <CreditsAvailableBadge status={project.creditAvailability} />
241
+ </Box>
242
+ )}
241
243
 
242
244
  {project.riskBuffer && (
243
245
  <Box>
@@ -255,9 +257,13 @@ export const ProjectInfo: React.FC<ProjectInfoProps> = ({
255
257
  )}
256
258
  </SimpleGrid>
257
259
 
258
- <Box mt="2">
259
- <CreditsAvailableBadge status={project.creditAvailability} />
260
- </Box>
260
+ {project.averageSellableAmountPerYear > 0 ? (
261
+ <Box mt="2">
262
+ <CreditsAvailableBadge status={project.creditAvailability} />
263
+ </Box>
264
+ ) : (
265
+ <></>
266
+ )}
261
267
  </Container>
262
268
  );
263
269
  };