Skip to content

Commit

Permalink
fix: handle copy in ui
Browse files Browse the repository at this point in the history
  • Loading branch information
L03TJ3 committed Oct 25, 2024
1 parent d37a76b commit 28d5ed2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
1 change: 0 additions & 1 deletion packages/app/src/hooks/useTotalStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { formatGoodDollarAmount } from '../lib/calculateGoodDollarAmounts';

type StatsFormatted = {
amount: string;
copy: string;
};
type TotalStats = {
totalDonations: StatsFormatted;
Expand Down
24 changes: 23 additions & 1 deletion packages/app/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ const CollectivesContainer: FC<PropsWithChildren> = ({ children }) => {
);
};

const statsCopy = {
totalPools: {
copy: 'GoodCollective pools',
},
totalDonations: {
copy: 'Total Donations',
},
totalMembers: {
copy: 'GoodCollective Members Paid',
},
};

const HomePage = () => {
const collectives = useCollectivesMetadata();
const totalStats = useTotalStats();
Expand All @@ -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 (
<Layout>
{!totalStats ? (
Expand All @@ -88,7 +110,7 @@ individuals and communities by providing direct digital payments to those who ne
Impact to Date
</Text>
<HStack space={0} justifyContent="space-evenly" flexDir={isDesktopView ? 'row' : 'column'}>
{Object.values(totalStats).map(({ amount, copy }) => (
{Object.values(stats).map(({ amount, copy }) => (
<VStack key={copy} space={0} paddingTop={2} textAlign="center" minWidth="220">
<Text variant="3xl-grey" color="goodPurple.400" fontWeight="700" fontFamily="heading">
{amount}
Expand Down

0 comments on commit 28d5ed2

Please sign in to comment.