Skip to content

Commit 3144929

Browse files
committed
trycatch
1 parent 19b7526 commit 3144929

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

packages/builder/src/components/grants/stats/StatCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function StatCard({
1919
p={3}
2020
className={`${
2121
bg ? `bg-${bg}` : ""
22-
} border-grey-100 mx-2 mt-2 sm:table-row md:table-cell`}
22+
} border-grey-100 mx-2 sm:table-row md:table-cell`}
2323
borderWidth={border ? "1px" : "0px"}
2424
borderRadius="md"
2525
minWidth="193px"

packages/builder/src/components/grants/stats/Stats.tsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,20 @@ export default function RoundStats() {
5959
let totalDirectDonations = 0;
6060
let totalDirectDonationCount = 0;
6161

62-
const directDonations: BaseDonorValues[] =
63-
await dataLayer.getDirectDonationsByProjectId({
64-
projectId: props.projectID,
65-
chainIds: allChains.map((chain) => chain.id),
66-
});
62+
try {
63+
const directDonations: BaseDonorValues[] =
64+
await dataLayer.getDirectDonationsByProjectId({
65+
projectId: props.projectID,
66+
chainIds: allChains.map((chain) => chain.id),
67+
});
6768

68-
directDonations.forEach((donation) => {
69-
totalDirectDonations += donation.totalAmountDonatedInUsd;
70-
totalDirectDonationCount += donation.totalDonationsCount;
71-
});
69+
directDonations.forEach((donation) => {
70+
totalDirectDonations += donation.totalAmountDonatedInUsd;
71+
totalDirectDonationCount += donation.totalDonationsCount;
72+
});
73+
} catch (e) {
74+
console.error("Error fetching direct donations", e);
75+
}
7276

7377
if (props.stats?.length > 0) {
7478
props.stats.forEach((stat) => {
@@ -117,20 +121,24 @@ export default function RoundStats() {
117121
container: any,
118122
pt: boolean,
119123
key: string,
120-
spaceBetween?: boolean
124+
shortRow?: boolean
121125
) => (
122126
<div
123127
key={key}
124128
className={`grid ${
125-
spaceBetween ? "md:grid-cols-8" : "md:grid-cols-7"
129+
shortRow ? "md:grid-cols-8" : "md:grid-cols-7"
126130
} sm:grid-cols-1 border-b border-gitcoin-grey-100 pb-10 ${pt && "pt-10"}`}
127131
>
128-
<div className={`${spaceBetween ? "md:col-span-2" : "md:col-span-1"}`}>
132+
<div
133+
className={`${
134+
shortRow ? "md:col-span-2" : "md:col-span-1"
135+
} flex items-center justify-start`}
136+
>
129137
{description}
130138
</div>
131139
<div
132140
className={`${
133-
spaceBetween ? "md:col-span-5" : "md:col-span-6"
141+
shortRow ? "md:col-span-5" : "md:col-span-6"
134142
} sm:col-span-1 md:flex space-between`}
135143
>
136144
{container}
@@ -182,7 +190,7 @@ export default function RoundStats() {
182190
heading="Total Direct Donations"
183191
value={`$${allTimeStats.totalDirectDonations.toFixed(2)}`}
184192
bg="gitcoin-violet-100"
185-
tooltip="The number of contributions this project has received."
193+
tooltip="The amount of contributions this project has received as direct donations."
186194
/>
187195
<StatCard
188196
heading="No. of Contributions"

0 commit comments

Comments
 (0)