From 73989ce0bee80107da275b75727002be0b296cd6 Mon Sep 17 00:00:00 2001 From: "Shiv Bhonde | shivbhonde.eth" Date: Mon, 26 Feb 2024 16:34:13 +0530 Subject: [PATCH] Stats tweaks (#42) --- .../app/_components/EcosystemGrants.tsx | 39 +++++-------- .../nextjs/app/_components/GrantsStats.tsx | 55 +++++++++--------- .../nextjs/public/assets/stats-active.png | Bin 0 -> 4922 bytes .../public/assets/stats-eth-granted.png | Bin 0 -> 6570 bytes packages/nextjs/public/assets/stats-total.png | Bin 0 -> 1508 bytes .../services/database/ecosystemGrants.json | 25 ++++++++ packages/nextjs/services/database/grants.ts | 19 +++--- 7 files changed, 72 insertions(+), 66 deletions(-) create mode 100644 packages/nextjs/public/assets/stats-active.png create mode 100644 packages/nextjs/public/assets/stats-eth-granted.png create mode 100644 packages/nextjs/public/assets/stats-total.png create mode 100644 packages/nextjs/services/database/ecosystemGrants.json diff --git a/packages/nextjs/app/_components/EcosystemGrants.tsx b/packages/nextjs/app/_components/EcosystemGrants.tsx index f0b7835..f261ef3 100644 --- a/packages/nextjs/app/_components/EcosystemGrants.tsx +++ b/packages/nextjs/app/_components/EcosystemGrants.tsx @@ -1,4 +1,5 @@ import Image from "next/image"; +import ecosystemGrants from "~~/services/database/ecosystemGrants.json"; const EcosystemGrantsCard = ({ title, @@ -16,7 +17,7 @@ const EcosystemGrantsCard = ({ return (
- {title} + {title}

{title}

@@ -27,7 +28,7 @@ const EcosystemGrantsCard = ({
Amount: - {amountGranted} + {amountGranted} ETH
Twitter @@ -48,30 +49,16 @@ export const EcosystemGrants = () => {
- {/* Jessy's Hacker House */} - - {/* Solidty By Example */} - - {/* Winter */} - + {ecosystemGrants.grants.map((grant, index) => ( + + ))}
diff --git a/packages/nextjs/app/_components/GrantsStats.tsx b/packages/nextjs/app/_components/GrantsStats.tsx index 0a19213..86eb251 100644 --- a/packages/nextjs/app/_components/GrantsStats.tsx +++ b/packages/nextjs/app/_components/GrantsStats.tsx @@ -1,40 +1,37 @@ import Image from "next/image"; +import ecosystemGrants from "~~/services/database/ecosystemGrants.json"; import { getGrantsStats } from "~~/services/database/grants"; +const Stat = ({ label, imgLink, value }: { label: string; imgLink: string; value: string | number }) => { + return ( +
+
+ {label} +

{value}

+
+

{label}

+
+ ); +}; + export const GrantsStats = async () => { const stats = await getGrantsStats(); + + const sum = ecosystemGrants.grants.reduce( + (acc, grant) => acc + parseFloat(grant.amountGranted), + stats.total_eth_granted, + ); + const totalEthGranted = Number.isInteger(sum) ? sum : sum.toFixed(2); + + const totalGrants = ecosystemGrants.grants.length + stats.total_grants; + return (
-
-
-
- diamon icon -

{stats.total_completed_grants}

-
-

Total Grants

-
-
-
- diamon icon -

{stats.total_grants}

-
-

Submissions

-
-
-
- diamon icon -

{stats.total_eth_granted}

-
-

ETH Granted

-
-
-
- diamon icon -

{stats.total_active_grants}

-
-

Active Grants

-
+
+ + +
diff --git a/packages/nextjs/public/assets/stats-active.png b/packages/nextjs/public/assets/stats-active.png new file mode 100644 index 0000000000000000000000000000000000000000..86fcd066d43148057e6ea4212193d9850dfc89a6 GIT binary patch literal 4922 zcmV-A6UFR_P)($CLOCs$m5$WX28;OBV2$59NtW z4|#y_5yya#kO*$`f)F2`$wMCaP}(TGfQiQsM6qO)vLgkQ5HgmCfkZIe->rLk?$q?h zt?H_tp04^!cY0>JtLk>$f1P{Ix#yfaA?uhkZPv7!RM^f~H7zo2(XJL zdC7nY(`HONdDYdEGIQU8Oy4pi6}B%fzp*OMonDgV?;$9x)Y$D_gK?#4b$+?)o_V?R zo=n85FiN;yWM^$k&i(q7yzqQ$QsRfcndTH%n8ty!rDVkA%d7I*E0KMzP(0qVr!K=nCQ@9CR^+Q+ zIv~G)HIfR$0e+;17oHi4KPfdSAc7KNYVTf|oSc*j#Ui?JL82&o+-WM$`QY)HoTz=iY)@n7WFdQI_hbfUO>!ZRZ zWVSvkY{tsjvsToDtojzma~{C)oM+gmNRb1YCr-$bPkypZ2*up&tSmh8h}3rN>U$29 z$s?cm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!&r zwWv{9k;Gm=p7OuE_12&N>vu1o3m!PDT*l`i5vSGTqs$lo$3TVdLIfe)x#`>e67NPl zW&St$tRV&jvr|up@5zcUmvyC#Dq;^q*0Zra?o-)Yr`StmhyUm=7c;z1q zT7x&#(&z`IM8X8^1+HfoH$sxEuq52MId0y&#%|Z|Rj!XN^Q6lz^T8D5rYRV+X|bnt zehNSKK(nwg)tq(UlcA9~bX5Xjm$KIfxBn=|z}}1?oqLMA!b`yF)Tf5T3B>j!d@rWL z9#wcYouf>OW?P{ngA1|hXJJX4k&T#-dYog8AIHDD*6TVp-omB(wIoGwi+KK%UY3z( z(L~Zam!l>zNv!s%$|%7?-a{}giSJxC>%&HwCH~iv_-Sqh9RIp$lf6h0V1o98^PzOl z!%0C3#hk>Zc+LACgy11)CO=%Z>4V2t=Uv?<$@eh!gB2^i>Rx%%MpLqdA=neJ*JzG; zx=o3{_W^hQBku2Jrw^BL?IV&{q|#cFBd}f)x=9u^O>05C0;=&bMK&aUIJz>f>`Ujl z;+yM5(iqK1vcnRpTkTFy56VrH_^3#c6A~t9Lk2^O)~$BupDtIV*cQlOg7!mCX;CC9 zQsjW;_0>&&G$kLjq=&R95)~=ZA>xN`eek;$D3idz*c8|jX;G0P9qh>Xo5Cba&=tuS zEpgJqcYjm<$RUynTaLQKUd=VLc3_+SEyd-_O!c_tlvEfAG-Q2HXm~m2q*%-g84 smx53>H+NpB$@){;l7dXbt-9vl0lCsfR^EuA!2kdN07*qoM6N<$f&-Xw6951J literal 0 HcmV?d00001 diff --git a/packages/nextjs/public/assets/stats-eth-granted.png b/packages/nextjs/public/assets/stats-eth-granted.png new file mode 100644 index 0000000000000000000000000000000000000000..10c7add80106b8d15ba2bc9c47089432658229e9 GIT binary patch literal 6570 zcmV;b8CB+qP)RK^u=H3uo_JpFYMk`lIOPc#0fx2 z0s-K$ERzi5NqWJwRT7YGfhI4$eAT!TT@BA}>8=Ps1pHxA3BY)eu4cSb|FE#wE*D?Y zVaMl*4$S|P8@u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dMf()PiRin^T4k6lSVPU&^WtVfCy|IyCg)Gq=QZgk9o{$Iyc#YPol?)CnY=z z4gKn`5}5VG@R_oWg^~n?Wk$2fm= z+uFpN9ZW_<=iq7A^+gCr!!haJgoCWjy9;g%*K?*xCbTf^V&4?qu4JkKtwy`moGUc4 zh;}8-Dd-q}-~hRn|k9_dn|9h>|o`_)VeysQQia94< zpv#Awnwo;m2sk9q1YZyU(x3HY6A8R9EeoqzsdMul!=uR4yhl-xz`M6Lo-uyO6`hmX z_!u4osBe4IQsE?QV@^E$^pYp|y531h~IJ1E(ZOo_7Z8Z#Hv zvG)vXJ|BQNUn@CcB9N|Vmtedv>K}9`CIsNr28B$~=shOBzhhgU?AYErVmtIK=G+QQ zJ0NnS7V1y__^iX(z`RAMKz(hCiK0t$7!iL9H z2(L#0^NcB{%@3<@>K&)`NNXx^DBZ5Ig0w6_G_6}2;GorusYrSpTtO&EaCm%+#F$te z(`g!6gJ4cZutb|No$D%_^D#E#2_gX{8Dqi0c;Z+gy&6;q)GEXZLKQ%8Sps4Q!pDA@ c1Wwr>0KuEZA4V>B1ONa407*qoM6N<$f)$6=P5=M^ literal 0 HcmV?d00001 diff --git a/packages/nextjs/public/assets/stats-total.png b/packages/nextjs/public/assets/stats-total.png new file mode 100644 index 0000000000000000000000000000000000000000..bac46eb3f334073c4910bf784732c2101928478d GIT binary patch literal 1508 zcmb7E`!^E`9N&nH<#{ug31v3&D9^UM^DK|aqqs?#=QWYtnU%*yZ914Og;ROe60YWv zJQo+UNy`f5F^^6x&oZOCOYU6#2ld0}^Euzo`Tp?zobx%~TWBBm1M-^k007{Cr-#eg zJx%-$IoUmCf7m>;C!j=+U>pFT4*L$E=UIK>o(aUAb$13ZhM-G(!@g)IZzlktu|Q$x zvJ3zqL-cfU3P=HdE_F!YyJ@g>TD4IfjwctgA`ow!6h%O8YL@lO{SBz(+N{;a2Q`lS zPdX7em|~U$konkGIo9xvo^ol;eLpvGoinbF*_&XHJ%=Q+r9sznXvYtM_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ix literal 0 HcmV?d00001 diff --git a/packages/nextjs/services/database/ecosystemGrants.json b/packages/nextjs/services/database/ecosystemGrants.json new file mode 100644 index 0000000..55879ed --- /dev/null +++ b/packages/nextjs/services/database/ecosystemGrants.json @@ -0,0 +1,25 @@ +{ + "grants": [ + { + "name": "Jessy's Hacker House", + "description": "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.Lorem ipsum dolor sit amet, qui minim labore adipisicing.", + "amountGranted": "14", + "twitterLink": "https://twitter.com/wehack247", + "imgLink": "/assets/jessy-hacker-house.png" + }, + { + "name": "Solidity By Example", + "description": "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.Lorem ipsum dolor sit amet, qui minim labore adipisicing.", + "amountGranted": "1", + "twitterLink": "https://twitter.com/ProgrammerSmart", + "imgLink": "/assets/solidity-by-example.png" + }, + { + "name": "W1nt3r", + "description": "Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet.", + "amountGranted": "1", + "twitterLink": "https://x.com/w1nt3r_eth", + "imgLink": "/assets/winter.png" + } + ] +} diff --git a/packages/nextjs/services/database/grants.ts b/packages/nextjs/services/database/grants.ts index 4102253..de17fb4 100644 --- a/packages/nextjs/services/database/grants.ts +++ b/packages/nextjs/services/database/grants.ts @@ -99,25 +99,22 @@ export const reviewGrant = async (grantId: string, action: ProposalStatusType) = }; export const getGrantsStats = async () => { - // Summation of askAmount for completed grants: total_eth_granted - // Total number of completed grants : total_completed_grants - // Total number of submitted grants all grants : total_submitted_grants - // Total number of Active grants (approved): total_active_grants + // total_eth_granted is the summation of askAmount of all completed grants + // total_active_grants is the count of grants with status "approved" + // total_grants is the summation of completed and active grants try { - const copmltedGrants = await getAllCompletedGrants(); - const total_eth_granted = copmltedGrants.reduce((acc, grant) => acc + grant.askAmount, 0); - const total_completed_grants = copmltedGrants.length; - - const allGrantsSnapshot = await grantsCollection.get(); - const total_grants = allGrantsSnapshot.size; + const completedGrants = await getAllCompletedGrants(); + const total_eth_granted = completedGrants.reduce((acc, grant) => acc + grant.askAmount, 0); + const total_completed_grants = completedGrants.length; const approvedGrantsSnapshot = await grantsCollection.where("status", "==", PROPOSAL_STATUS.APPROVED).get(); const total_active_grants = approvedGrantsSnapshot.size; + const total_grants = total_completed_grants + total_active_grants; + return { total_grants, total_eth_granted, - total_completed_grants, total_active_grants, }; } catch (error) {