From b24035f0a813380d82c69c8680322650083cc92f Mon Sep 17 00:00:00 2001 From: James Grugett Date: Wed, 27 Jul 2022 10:22:52 -0700 Subject: [PATCH] Try to fix charity error --- web/pages/charity/index.tsx | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/web/pages/charity/index.tsx b/web/pages/charity/index.tsx index 80003c81..e16c6047 100644 --- a/web/pages/charity/index.tsx +++ b/web/pages/charity/index.tsx @@ -1,23 +1,14 @@ -import { - mapValues, - groupBy, - sumBy, - sum, - sortBy, - debounce, - uniqBy, -} from 'lodash' +import { mapValues, groupBy, sumBy, sum, debounce, uniqBy } from 'lodash' import { useState, useMemo } from 'react' -import { charities, Charity as CharityType } from 'common/charity' +import { Charity as CharityType } from 'common/charity' 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 { Title } from 'web/components/title' -import { getAllCharityTxns } from 'web/lib/firebase/txns' import { manaToUSD } from 'common/util/format' import { quadraticMatches } from 'common/quadratic-funding' -import { Txn } from 'common/txn' +import { DonationTxn, Txn } from 'common/txn' import { useTracking } from 'web/hooks/use-tracking' import { searchInAny } from 'common/util/parse' import { getUser } from 'web/lib/firebase/users' @@ -26,15 +17,11 @@ import { User } from 'common/user' import { SEO } from 'web/components/SEO' export async function getStaticProps() { - const txns = await getAllCharityTxns() + const txns: DonationTxn[] = [] const totals = mapValues(groupBy(txns, 'toId'), (txns) => sumBy(txns, (txn) => txn.amount) ) const totalRaised = sum(Object.values(totals)) - const sortedCharities = sortBy(charities, [ - (charity) => (charity.tags?.includes('Featured') ? 0 : 1), - (charity) => -totals[charity.id], - ]) const matches = quadraticMatches(txns, totalRaised) const numDonors = uniqBy(txns, (txn) => txn.fromId).length const mostRecentDonor = await getUser(txns[txns.length - 1].fromId) @@ -42,7 +29,7 @@ export async function getStaticProps() { return { props: { totalRaised, - charities: sortedCharities, + charities: [], matches, txns, numDonors,