// Copyright 2017-2026 @pezkuwi/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { BountyApi } from './hooks/useBounties.js'; import React, { useMemo } from 'react'; import { CardSummary, SummaryBox } from '@pezkuwi/react-components'; import { useTreasury } from '@pezkuwi/react-hooks'; import { FormatBalance } from '@pezkuwi/react-query'; import { BN, formatNumber } from '@pezkuwi/util'; import { useTranslation } from './translate.js'; interface Props { className?: string; info: BountyApi; } function Summary ({ className = '', info: { bestNumber, bounties, bountyCount, childCount } }: Props): React.ReactElement { const { t } = useTranslation(); const { spendPeriod } = useTreasury(); const totalValue = useMemo( () => (bounties || []).reduce((total, { bounty: { value } }) => total.iadd(value), new BN(0)), [bounties] ); return (
{bounties && ( {formatNumber(bounties.length)} )} {bountyCount && bounties && ( {formatNumber(bountyCount.subn(bounties.length))} )} {childCount && ( {formatNumber(childCount)} )}
{bestNumber && !spendPeriod.isZero() && ( )}
); } export default React.memo(Summary);