import { Payments } from '@mui/icons-material' import clsx from 'clsx' import { useTranslation } from 'react-i18next' import { DaoRewardsDistributorClaimCardProps } from '@dao-dao/types' import { getFallbackImage } from '@dao-dao/utils' import { Button } from '../buttons' import { Collapsible } from '../Collapsible' import { ErrorPage } from '../error' import { TokenAmountDisplay } from '../token' import { TooltipInfoIcon } from '../tooltip' export const DaoRewardsDistributorClaimCard = ({ className, onClaim, claiming, rewards, }: DaoRewardsDistributorClaimCardProps) => { const { t } = useTranslation() const hasRewards = !rewards.loading && !rewards.errored && rewards.data.length > 0 && rewards.data.some(({ balance }) => balance > 0) const totalUsdValue = hasRewards ? rewards.data.reduce((acc, { usdValue }) => acc + usdValue, 0) : 0 // Just use the first timestamp. const totalTimestamp = hasRewards ? rewards.data[0].timestamp : undefined return (
{!rewards.loading && !rewards.errored && (

{t('info.availableForWithdrawal')}

)}
{!rewards.loading && (rewards.errored ? ( ) : ( rewards.data.length > 0 && ( {rewards.data.map( ({ token, balance, usdValue, timestamp }, index) => (
0 && 'pt-2', // padding above first and below last items within // container index === 0 && 'pt-1', index === rewards.data.length - 1 && 'pb-1' )} >
0 ? '!text-text-interactive-valid' : '!text-text-tertiary' )} dateFetched={timestamp} decimals={2} hideSymbol minAmount={0.01} prefix="$" showAllDecimals wrapperClassName="shrink-0" />
) )}
) ))}
) }