From 0d14d2f419224ad807933279073a128c8da7a7c3 Mon Sep 17 00:00:00 2001
From: Sem <931684+sembrestels@users.noreply.github.com>
Date: Mon, 23 Sep 2024 17:28:03 +0100
Subject: [PATCH] Increment and decrement votes by 10% in the UI
---
apps/web/src/components/VotingCard.tsx | 21 +++++++++++++++++----
apps/web/src/hooks/useAllocation.ts | 6 +++++-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/apps/web/src/components/VotingCard.tsx b/apps/web/src/components/VotingCard.tsx
index 852480f..43b1cce 100644
--- a/apps/web/src/components/VotingCard.tsx
+++ b/apps/web/src/components/VotingCard.tsx
@@ -90,7 +90,6 @@ const VotingCard = ({
{projects.map((project) => {
- console.log(totalVotes, votingPower);
const voteCount = votes[project.account] || 0;
return (
{totalVotes > 0
- ? Math.round((voteCount / totalVotes) * 100)
+ ? Math.round((voteCount / votingPower) * 100)
: 0}
%
diff --git a/apps/web/src/hooks/useAllocation.ts b/apps/web/src/hooks/useAllocation.ts
index db7f377..fd8d2f6 100644
--- a/apps/web/src/hooks/useAllocation.ts
+++ b/apps/web/src/hooks/useAllocation.ts
@@ -45,7 +45,11 @@ export const useAllocation = (
});
const allocation = data?.allocations?.[0];
if (!allocation) {
- return { data: undefined, isLoading, votingPower: 0 };
+ return {
+ data: undefined,
+ isLoading,
+ votingPower: data?.councilMember?.votingPower ?? 0,
+ };
}
const formattedAllocation: { [grantee: `0x${string}`]: number } =
Object.fromEntries(