Skip to content

Commit

Permalink
fix decimals (#365)
Browse files Browse the repository at this point in the history
* fix decimals

* add loading on reputation-score page
  • Loading branch information
mehdi-torabiv authored Dec 11, 2024
1 parent 0a2566b commit 0a545df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/pages/reputation-score/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useAccount, useReadContract } from 'wagmi';

import { engagementContracts } from '@/lib/contracts/engagement/contracts';

import SimpleBackdrop from '@/components/global/LoadingBackdrop';
import SEO from '@/components/global/SEO';
import TcBoxContainer from '@/components/shared/TcBox/TcBoxContainer';

Expand All @@ -25,13 +26,17 @@ function ReputationScore() {
(contract) => contract.chainId === chainId
);

const { data: hasMinted } = useReadContract({
const { data: hasMinted, isLoading } = useReadContract({
address: engagementContract?.address as `0x${string}`,
abi: engagementContract?.abi as Abi,
functionName: 'balanceOf',
args: [address, dynamicNFTModuleInfo?.metadata[0]?.tokenId],
});

if(isConnected && isLoading) {
return <SimpleBackdrop />
}

return (
<>
<SEO titleTemplate='Reputation Score' />
Expand Down
4 changes: 2 additions & 2 deletions src/pages/reputation-score/score.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const ScorePage = () => {
series: [
{
name: 'Score',
data: [reputationScore ?? 0],
data: [reputationScore ? parseFloat(reputationScore.toFixed(1)) : 0],
tooltip: {
valueSuffix: ' /100',
},
Expand Down Expand Up @@ -177,4 +177,4 @@ const ScorePage = () => {
);
};

export default withRoles(ScorePage, []);
export default ScorePage;

0 comments on commit 0a545df

Please sign in to comment.