Skip to content

Commit 188a84b

Browse files
committed
fix total rewards
1 parent 8158738 commit 188a84b

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

packages/web/src/components/Reward/Reward.component.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type RewardProps = {
1010
stakedQuantity: number;
1111
badge?: string;
1212
hideText?: boolean;
13+
shouldDivide?: boolean;
1314
};
1415

1516
function Reward({
@@ -20,13 +21,15 @@ function Reward({
2021
stakedQuantity,
2122
badge,
2223
hideText,
24+
shouldDivide,
2325
}: RewardProps) {
2426
function formattedBalance(balance: string, decimals: number) {
2527
const decimalsBig = new Big(10).pow(decimals ?? 0);
2628
const balanceBig = new Big(balance ?? 0);
2729
const stakedBig = new Big(stakedQuantity === 0 ? 1 : stakedQuantity);
28-
29-
return balanceBig.div(decimalsBig).div(stakedBig).toFixed(2);
30+
if (shouldDivide)
31+
return balanceBig.div(decimalsBig).div(stakedBig).toFixed(2);
32+
else return balanceBig.div(decimalsBig).toFixed(2);
3033
}
3134

3235
function renderImage() {

packages/web/src/components/modules/nft/nft-staking-card.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type NFTStakingCardProps = HTMLAttributes<HTMLButtonElement> & {
1818
logoless?: boolean;
1919
wallet?: string;
2020
collection?: string | undefined;
21+
shouldDivide?: boolean;
2122
};
2223

2324
export function NFTStakingCard(props: NFTStakingCardProps) {
@@ -99,6 +100,7 @@ export function NFTStakingCard(props: NFTStakingCardProps) {
99100
stakedQuantity={nftQuantity}
100101
badge={props.wallet}
101102
hideText={props.logoless}
103+
shouldDivide={props.shouldDivide}
102104
/>
103105
);
104106
};

packages/web/src/pages/nft-staking/NFTStackProject.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ export function NFTStakingProjectComponent(props: NFTStakingProjectProps) {
426426
wallet={accountId ? undefined : "Connect Wallet"}
427427
onClick={accountId ? undefined : connectWallet}
428428
collection={collection.id}
429+
shouldDivide={false}
429430
/>
430431

431432
<div className="rounded-lg bg-white-600 p-6">
@@ -506,6 +507,7 @@ export function NFTStakingProjectComponent(props: NFTStakingProjectProps) {
506507
name={collection.name}
507508
rewards={collection.rewards}
508509
collection={collection.id}
510+
shouldDivide={true}
509511
/>
510512
<Tutorial items={stepItems as []} />
511513
</div>

packages/web/src/pages/nft-staking/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export const NFTStaking = () => {
165165
name={staking?.collection_meta?.name}
166166
rewards={staking?.rewards}
167167
collection={staking?.collection_id}
168+
shouldDivide={true}
168169
/>
169170
);
170171
};

0 commit comments

Comments
 (0)