From a4733b0f33f7cb95252b91d1e65f0b871f9474f3 Mon Sep 17 00:00:00 2001 From: blushi Date: Mon, 9 Dec 2024 14:18:00 +0100 Subject: [PATCH] fix: registered credits in compliance credits tab --- .../molecules/ProjectBatchTotals/ProjectBatchTotals.tsx | 8 ++++++-- .../organisms/ProjectTopSection/ProjectTopSection.tsx | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/web-marketplace/src/components/molecules/ProjectBatchTotals/ProjectBatchTotals.tsx b/web-marketplace/src/components/molecules/ProjectBatchTotals/ProjectBatchTotals.tsx index 48d83b965c..fac963a200 100644 --- a/web-marketplace/src/components/molecules/ProjectBatchTotals/ProjectBatchTotals.tsx +++ b/web-marketplace/src/components/molecules/ProjectBatchTotals/ProjectBatchTotals.tsx @@ -39,7 +39,7 @@ export function ProjectBatchTotals({ sx = [], className, }: { - totals: BatchTotalsForProject; + totals: BatchTotalsForProject & { registeredAmount?: number }; projectWithOrderData?: NormalizeProject; soldOutProjectsIds: string[]; sx?: SxProps; @@ -86,7 +86,11 @@ export function ProjectBatchTotals({ ? _(REGISTERED_CREDITS_TOOLTIP) : _(ISSUED_CREDITS_TOOLTIP) } - number={totals.tradableAmount + totals.retiredAmount} + number={ + isComplianceProject + ? totals.registeredAmount + : totals.tradableAmount + totals.retiredAmount + } formatNumberOptions={{ ...quantityFormatNumberOptions, maximumFractionDigits: MAX_FRACTION_DIGITS_PROJECT_CREDITS, diff --git a/web-marketplace/src/components/organisms/ProjectTopSection/ProjectTopSection.tsx b/web-marketplace/src/components/organisms/ProjectTopSection/ProjectTopSection.tsx index b9a9701055..70dee50661 100644 --- a/web-marketplace/src/components/organisms/ProjectTopSection/ProjectTopSection.tsx +++ b/web-marketplace/src/components/organisms/ProjectTopSection/ProjectTopSection.tsx @@ -14,7 +14,6 @@ import Section from 'web-components/src/components/section'; import { Body, Label, Title } from 'web-components/src/components/typography'; import { pxToRem } from 'web-components/src/theme/muiTheme'; -import { BatchTotalsForProject } from 'types/ledger/ecocredit'; import { useLedger } from 'ledger'; import { selectedLanguageAtom } from 'lib/atoms/languageSwitcher.atoms'; import { client as sanityClient } from 'lib/clients/sanity'; @@ -216,8 +215,8 @@ function ProjectTopSection({ const isTerrasosProjectPage = projectPageMetadata?.['@type'] === 'TerrasosProjectInfo'; - const batchTotals: BatchTotalsForProject = { - cancelledAmount: + const batchTotals = { + registeredAmount: normalizedProject?.complianceCredits.creditsRegistered ?? 0, retiredAmount: normalizedProject?.complianceCredits.creditsRetired ?? 0, tradableAmount: normalizedProject?.complianceCredits.creditsAvailable ?? 0,