Skip to content

Commit

Permalink
fix: fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
snoopy1412 committed Sep 13, 2024
1 parent 0423ccb commit 23b6b6e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/balance-description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const BalanceDescription = ({
balance,
symbol,
isLoading,
fractionDigits = 2,
fractionDigits = 3,
text = 'Balance'
}: BalanceDescriptionProps) => {
const balanceBN = new BigNumber(balance || '0');
Expand Down
2 changes: 1 addition & 1 deletion src/components/formatted-number-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface FormattedNumberTooltipProps {
}

const FormattedNumberTooltip = React.forwardRef<HTMLDivElement, FormattedNumberTooltipProps>(
({ value, fractionDigits = 2, className, children }, ref) => {
({ value, fractionDigits = 3, className, children }, ref) => {
const formattedValue = formatNumericValue(value, fractionDigits);
const renderContent = children || ((formattedValue: string) => formattedValue);

Expand Down
16 changes: 8 additions & 8 deletions src/view/claim/_components/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { Button, Skeleton } from '@nextui-org/react';

import Avatar from '@/components/avatar';
import { StakingAccountWithStatus } from '@/hooks/useStakingAccountWithStatus';
import { formatNumericValue, toShortAddress } from '@/utils';
import { toShortAddress } from '@/utils';
import { formatEther } from 'viem';
import FormattedNumberTooltip from '@/components/formatted-number-tooltip';

export interface ClaimableReward extends StakingAccountWithStatus {
reward: bigint;
Expand Down Expand Up @@ -36,10 +37,7 @@ function ClaimableRewardCard({
}
}, [onClick]);

const formattedBalance = formatNumericValue(
reward?.reward ? formatEther(reward?.reward) : '0',
2
);
const formattedBalance = reward?.reward ? formatEther(reward?.reward) : '0';

return (
<div style={style}>
Expand All @@ -61,9 +59,11 @@ function ClaimableRewardCard({
{rewardIsLoading ? (
<Skeleton className="h-[0.875rem] w-[0.875rem] rounded-medium" />
) : (
<span className="text-[0.875rem] font-bold text-primary">
{formattedBalance.fixed}
</span>
<FormattedNumberTooltip value={formattedBalance}>
{(formattedValue) => (
<span className="text-[0.875rem] font-bold text-primary">{formattedValue}</span>
)}
</FormattedNumberTooltip>
)}
</div>
<Button
Expand Down

0 comments on commit 23b6b6e

Please sign in to comment.