import { StarIcon } from '@heroicons/react/solid' import { sumBy } from 'lodash' import Link from 'next/link' import Image from 'next/image' 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' import { Card } from '../card' export function CharityCard(props: { charity: Charity; match?: number }) { const { charity } = props const { slug, photo, preview, id, tags } = charity const txns = useCharityTxns(id) const raised = sumBy(txns, (txn) => txn.amount) return ( {tags?.includes('Featured') && }
{photo ? ( ) : (
)}
{preview}
{raised > 0 && ( <> {formatUsd(raised)} raised {/* {match && ( +{formatUsd(match)} match )} */} )}
) } function formatUsd(mana: number) { return mana < 100 ? manaToUSD(mana) : '$' + Math.floor(mana / 100) } function FeaturedBadge() { return ( ) }