Files
spliit/src/app/groups/[groupId]/stats/totals-your-share.tsx
Sebastien Castiel 210c12b7ef Use tRPC in other group pages (#249)
* Use tRPC in group edition + group layout

* Use tRPC in group modals

* Use tRPC in group stats

* Use tRPC in group activity
2024-10-19 21:29:53 -04:00

29 lines
671 B
TypeScript

'use client'
import { cn, formatCurrency } from '@/lib/utils'
import { useLocale, useTranslations } from 'next-intl'
export function TotalsYourShare({
totalParticipantShare = 0,
currency,
}: {
totalParticipantShare?: number
currency: string
}) {
const locale = useLocale()
const t = useTranslations('Stats.Totals')
return (
<div>
<div className="text-muted-foreground">{t('yourShare')}</div>
<div
className={cn(
'text-lg',
totalParticipantShare < 0 ? 'text-green-600' : 'text-red-600',
)}
>
{formatCurrency(currency, Math.abs(totalParticipantShare), locale)}
</div>
</div>
)
}