diff --git a/web/components/charity/charity-card.tsx b/web/components/charity/charity-card.tsx index 31995284..fc327b9f 100644 --- a/web/components/charity/charity-card.tsx +++ b/web/components/charity/charity-card.tsx @@ -6,10 +6,9 @@ import { Charity } from 'common/charity' import { useCharityTxns } from 'web/hooks/use-charity-txns' import { manaToUSD } from '../../../common/util/format' import { Row } from '../layout/row' -import { Col } from '../layout/col' export function CharityCard(props: { charity: Charity; match?: number }) { - const { charity, match } = props + const { charity } = props const { slug, photo, preview, id, tags } = charity const txns = useCharityTxns(id) @@ -36,18 +35,18 @@ export function CharityCard(props: { charity: Charity; match?: number }) { {raised > 0 && ( <> - + {formatUsd(raised)} - raised - - {match && ( + raised + + {/* {match && ( +{formatUsd(match)} match - )} + )} */} )} diff --git a/web/pages/charity/index.tsx b/web/pages/charity/index.tsx index 92e6b69f..f5295c59 100644 --- a/web/pages/charity/index.tsx +++ b/web/pages/charity/index.tsx @@ -13,7 +13,6 @@ import { CharityCard } from 'web/components/charity/charity-card' import { Col } from 'web/components/layout/col' import { Spacer } from 'web/components/layout/spacer' import { Page } from 'web/components/page' -import { SiteLink } from 'web/components/site-link' import { Title } from 'web/components/title' import { getAllCharityTxns } from 'web/lib/firebase/txns' import { manaToUSD } from 'common/util/format' @@ -21,6 +20,9 @@ import { quadraticMatches } from 'common/quadratic-funding' import { Txn } from 'common/txn' import { useTracking } from 'web/hooks/use-tracking' import { searchInAny } from 'common/util/parse' +import { getUser } from 'web/lib/firebase/users' +import { User } from 'common/lib/user' +import { SiteLink } from 'web/components/site-link' export async function getStaticProps() { const txns = await getAllCharityTxns() @@ -34,6 +36,7 @@ export async function getStaticProps() { ]) const matches = quadraticMatches(txns, totalRaised) const numDonors = uniqBy(txns, (txn) => txn.fromId).length + const mostRecentDonor = await getUser(txns[txns.length - 1].fromId) return { props: { @@ -42,6 +45,7 @@ export async function getStaticProps() { matches, txns, numDonors, + mostRecentDonor, }, revalidate: 60, } @@ -50,22 +54,28 @@ export async function getStaticProps() { type Stat = { name: string stat: string + url?: string } function DonatedStats(props: { stats: Stat[] }) { const { stats } = props return (
- {stats.map((item) => ( + {stats.map((stat) => (
- {item.name} + {stat.name}
+
- {item.stat} + {stat.url ? ( + {stat.stat} + ) : ( + {stat.stat} + )}
))} @@ -79,8 +89,9 @@ export default function Charity(props: { matches: { [charityId: string]: number } txns: Txn[] numDonors: number + mostRecentDonor: User }) { - const { totalRaised, charities, matches, numDonors } = props + const { totalRaised, charities, matches, numDonors, mostRecentDonor } = props const [query, setQuery] = useState('') const debouncedQuery = debounce(setQuery, 50) @@ -106,7 +117,7 @@ export default function Charity(props: { - <span className="text-gray-600"> + {/* <span className="text-gray-600"> Through July 15, up to $25k of donations will be matched via{' '} <SiteLink href="https://wtfisqf.com/" className="font-bold"> quadratic funding @@ -116,7 +127,7 @@ export default function Charity(props: { the FTX Future Fund </SiteLink> ! - </span> + </span> */} <DonatedStats stats={[ { @@ -128,8 +139,9 @@ export default function Charity(props: { stat: `${numDonors}`, }, { - name: 'Matched via quadratic funding', - stat: manaToUSD(sum(Object.values(matches))), + name: 'Most recent donor', + stat: mostRecentDonor.name ?? 'Nobody', + url: `/${mostRecentDonor.username}`, }, ]} />