diff --git a/apps/potlock/widget/Index.jsx b/apps/potlock/widget/Index.jsx
index f4898174..f0efc14c 100644
--- a/apps/potlock/widget/Index.jsx
+++ b/apps/potlock/widget/Index.jsx
@@ -72,8 +72,6 @@ if (state.registryAdmins === null) {
State.update({ registryAdmins });
}
-console.log("state: ", state);
-
const tabContentWidget = {
[CREATE_PROJECT_TAB]: "Project.Create",
[EDIT_PROJECT_TAB]: "Project.Create",
diff --git a/apps/potlock/widget/Project/DonationsInfo.jsx b/apps/potlock/widget/Project/DonationsInfo.jsx
index be2ff8b5..ff09265b 100644
--- a/apps/potlock/widget/Project/DonationsInfo.jsx
+++ b/apps/potlock/widget/Project/DonationsInfo.jsx
@@ -59,30 +59,54 @@ const donationsForProject = Near.view(donationContractId, "get_donations_for_rec
recipient_id: props.projectId,
});
-const [totalDonations, totalDonors] = useMemo(() => {
+const [totalDonations, totalDonors, totalReferralFees] = useMemo(() => {
if (!donationsForProject) {
return ["", ""];
}
const donors = [];
let totalDonationAmount = new Big(0);
+ let totalReferralFees = new Big(0);
for (const donation of donationsForProject) {
if (!donors.includes(donation.donor_id)) {
donors.push(donation.donor_id);
}
- totalDonationAmount = totalDonationAmount.plus(new Big(donation.total_amount));
+ const totalAmount = new Big(donation.total_amount);
+ const referralAmount = new Big(donation.referrer_fee || "0");
+ const protocolAmount = new Big(donation.protocol_fee || "0");
+ totalDonationAmount = totalDonationAmount.plus(
+ totalAmount.minus(referralAmount).minus(protocolAmount)
+ );
+ totalReferralFees = totalReferralFees.plus(referralAmount);
}
- return [totalDonationAmount.div(1e24).toNumber().toFixed(2), donors.length];
+ return [
+ totalDonationAmount.div(1e24).toNumber().toFixed(2),
+ donors.length,
+ totalReferralFees.div(1e24).toNumber().toFixed(2),
+ ];
}, [donationsForProject]);
return (
- ${totalDonations}
+
+ {props.nearToUsd
+ ? `$${(totalDonations * props.nearToUsd).toFixed(2)}`
+ : `${totalDonations} N`}
+
Contributed
{totalDonors}
{totalDonors === 1 ? "Donor" : "Donors"}
+
+
+ {" "}
+ {props.nearToUsd
+ ? `$${(totalReferralFees * props.nearToUsd).toFixed(2)}`
+ : `${totalReferralFees} N`}
+
+ Referral Fees
+
);
diff --git a/build/potlock/src/Index.jsx b/build/potlock/src/Index.jsx
index f4898174..f0efc14c 100644
--- a/build/potlock/src/Index.jsx
+++ b/build/potlock/src/Index.jsx
@@ -72,8 +72,6 @@ if (state.registryAdmins === null) {
State.update({ registryAdmins });
}
-console.log("state: ", state);
-
const tabContentWidget = {
[CREATE_PROJECT_TAB]: "Project.Create",
[EDIT_PROJECT_TAB]: "Project.Create",
diff --git a/build/potlock/src/Project/DonationsInfo.jsx b/build/potlock/src/Project/DonationsInfo.jsx
index be2ff8b5..ff09265b 100644
--- a/build/potlock/src/Project/DonationsInfo.jsx
+++ b/build/potlock/src/Project/DonationsInfo.jsx
@@ -59,30 +59,54 @@ const donationsForProject = Near.view(donationContractId, "get_donations_for_rec
recipient_id: props.projectId,
});
-const [totalDonations, totalDonors] = useMemo(() => {
+const [totalDonations, totalDonors, totalReferralFees] = useMemo(() => {
if (!donationsForProject) {
return ["", ""];
}
const donors = [];
let totalDonationAmount = new Big(0);
+ let totalReferralFees = new Big(0);
for (const donation of donationsForProject) {
if (!donors.includes(donation.donor_id)) {
donors.push(donation.donor_id);
}
- totalDonationAmount = totalDonationAmount.plus(new Big(donation.total_amount));
+ const totalAmount = new Big(donation.total_amount);
+ const referralAmount = new Big(donation.referrer_fee || "0");
+ const protocolAmount = new Big(donation.protocol_fee || "0");
+ totalDonationAmount = totalDonationAmount.plus(
+ totalAmount.minus(referralAmount).minus(protocolAmount)
+ );
+ totalReferralFees = totalReferralFees.plus(referralAmount);
}
- return [totalDonationAmount.div(1e24).toNumber().toFixed(2), donors.length];
+ return [
+ totalDonationAmount.div(1e24).toNumber().toFixed(2),
+ donors.length,
+ totalReferralFees.div(1e24).toNumber().toFixed(2),
+ ];
}, [donationsForProject]);
return (
- ${totalDonations}
+
+ {props.nearToUsd
+ ? `$${(totalDonations * props.nearToUsd).toFixed(2)}`
+ : `${totalDonations} N`}
+
Contributed
{totalDonors}
{totalDonors === 1 ? "Donor" : "Donors"}
+
+
+ {" "}
+ {props.nearToUsd
+ ? `$${(totalReferralFees * props.nearToUsd).toFixed(2)}`
+ : `${totalReferralFees} N`}
+
+ Referral Fees
+
);