From 28d5ed2fdbd4e7c07edfc133ca25124f96541eed Mon Sep 17 00:00:00 2001 From: LewisB Date: Fri, 25 Oct 2024 11:22:03 +0700 Subject: [PATCH] fix: handle copy in ui --- packages/app/src/hooks/useTotalStats.ts | 1 - packages/app/src/pages/HomePage.tsx | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/app/src/hooks/useTotalStats.ts b/packages/app/src/hooks/useTotalStats.ts index 9527c06a..e6f18416 100644 --- a/packages/app/src/hooks/useTotalStats.ts +++ b/packages/app/src/hooks/useTotalStats.ts @@ -5,7 +5,6 @@ import { formatGoodDollarAmount } from '../lib/calculateGoodDollarAmounts'; type StatsFormatted = { amount: string; - copy: string; }; type TotalStats = { totalDonations: StatsFormatted; diff --git a/packages/app/src/pages/HomePage.tsx b/packages/app/src/pages/HomePage.tsx index f08c70c0..f8f96b87 100644 --- a/packages/app/src/pages/HomePage.tsx +++ b/packages/app/src/pages/HomePage.tsx @@ -53,6 +53,18 @@ const CollectivesContainer: FC = ({ children }) => { ); }; +const statsCopy = { + totalPools: { + copy: 'GoodCollective pools', + }, + totalDonations: { + copy: 'Total Donations', + }, + totalMembers: { + copy: 'GoodCollective Members Paid', + }, +}; + const HomePage = () => { const collectives = useCollectivesMetadata(); const totalStats = useTotalStats(); @@ -67,6 +79,16 @@ const HomePage = () => { } }; + const stats = totalStats + ? Object.keys(statsCopy).map((keys) => { + const key = keys as keyof typeof totalStats; + return { + amount: totalStats[key].amount, + copy: statsCopy[key].copy, + }; + }) + : []; + return ( {!totalStats ? ( @@ -88,7 +110,7 @@ individuals and communities by providing direct digital payments to those who ne Impact to Date - {Object.values(totalStats).map(({ amount, copy }) => ( + {Object.values(stats).map(({ amount, copy }) => ( {amount}