Skip to content

Commit

Permalink
fix: registered credits in compliance credits tab
Browse files Browse the repository at this point in the history
  • Loading branch information
blushi committed Dec 9, 2024
1 parent de77bea commit a4733b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function ProjectBatchTotals({
sx = [],
className,
}: {
totals: BatchTotalsForProject;
totals: BatchTotalsForProject & { registeredAmount?: number };
projectWithOrderData?: NormalizeProject;
soldOutProjectsIds: string[];
sx?: SxProps<Theme>;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a4733b0

Please sign in to comment.