import { Button } from '@/components/ui/button' import { Reimbursement } from '@/lib/balances' import { formatCurrency } from '@/lib/utils' import { Participant } from '@prisma/client' import Link from 'next/link' type Props = { reimbursements: Reimbursement[] participants: Participant[] currency: string groupId: string } export function ReimbursementList({ reimbursements, participants, currency, groupId, }: Props) { if (reimbursements.length === 0) { return (

It looks like your group doesn’t need any reimbursement 😁

) } const getParticipant = (id: string) => participants.find((p) => p.id === id) return (
{reimbursements.map((reimbursement, index) => (
{getParticipant(reimbursement.from)?.name} owes{' '} {getParticipant(reimbursement.to)?.name}
{formatCurrency(currency, reimbursement.amount)}
))}
) }