mirror of
https://github.com/spliit-app/spliit.git
synced 2026-03-09 13:49:04 +01:00
23 lines
665 B
TypeScript
23 lines
665 B
TypeScript
import { Currency } from '@/lib/currency'
|
|
import { formatCurrency } from '@/lib/utils'
|
|
import { useLocale, useTranslations } from 'next-intl'
|
|
|
|
type Props = {
|
|
totalGroupSpendings: number
|
|
currency: Currency
|
|
}
|
|
|
|
export function TotalsGroupSpending({ totalGroupSpendings, currency }: Props) {
|
|
const locale = useLocale()
|
|
const t = useTranslations('Stats.Totals')
|
|
const balance = totalGroupSpendings < 0 ? 'groupEarnings' : 'groupSpendings'
|
|
return (
|
|
<div>
|
|
<div className="text-muted-foreground">{t(balance)}</div>
|
|
<div className="text-lg">
|
|
{formatCurrency(currency, Math.abs(totalGroupSpendings), locale)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|