Skip to content

Commit

Permalink
Merge pull request #24 from PotLock/staging
Browse files Browse the repository at this point in the history
Staging => Main
  • Loading branch information
M-Rb3 authored Apr 30, 2024
2 parents bff3e28 + d241b6e commit 24b5943
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ const Card = (props: any) => {

const { name, description } = profile;

const donationsForProject = potId
? PotSDK.getDonationsForProject(potId, projectId)
: DonateSDK.getDonationsForRecipient(projectId);
const donationsForProject =
potId && !payoutDetails
? PotSDK.getDonationsForProject(potId, projectId)
: !potId
? DonateSDK.getDonationsForRecipient(projectId)
: [];

useEffect(() => {
if (profile !== null && !ready) {
Expand All @@ -59,6 +62,7 @@ const Card = (props: any) => {
}, [profile, donationsForProject]);

const totalAmountNear = useMemo(() => {
if (payoutDetails) return payoutDetails.totalAmount;
if (!donationsForProject) return "0";
let totalDonationAmountNear = new Big(0);
for (const donation of donationsForProject) {
Expand All @@ -67,7 +71,7 @@ const Card = (props: any) => {
}
}
return totalDonationAmountNear.toString();
}, [donationsForProject]);
}, [donationsForProject, payoutDetails]);

const getImageSrc = (image: any) => {
const defaultImageUrl = "https://ipfs.near.social/ipfs/bafkreih4i6kftb34wpdzcuvgafozxz6tk6u4f5kcr2gwvtvxikvwriteci";
Expand Down

0 comments on commit 24b5943

Please sign in to comment.