mirror of
https://github.com/spliit-app/spliit.git
synced 2026-03-10 05:59:06 +01:00
Reimbursements
This commit is contained in:
31
src/app/groups/[groupId]/reimbursement-list.tsx
Normal file
31
src/app/groups/[groupId]/reimbursement-list.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Reimbursement } from '@/lib/balances'
|
||||
import { Participant } from '@prisma/client'
|
||||
|
||||
type Props = {
|
||||
reimbursements: Reimbursement[]
|
||||
participants: Participant[]
|
||||
currency: string
|
||||
}
|
||||
|
||||
export function ReimbursementList({
|
||||
reimbursements,
|
||||
participants,
|
||||
currency,
|
||||
}: Props) {
|
||||
const getParticipant = (id: string) => participants.find((p) => p.id === id)
|
||||
return (
|
||||
<div className="text-sm">
|
||||
{reimbursements.map((reimbursement, index) => (
|
||||
<div className="border-t p-4 flex justify-between" key={index}>
|
||||
<div>
|
||||
<strong>{getParticipant(reimbursement.from)?.name}</strong> owes{' '}
|
||||
<strong>{getParticipant(reimbursement.to)?.name}</strong>
|
||||
</div>
|
||||
<div>
|
||||
{currency} {reimbursement.amount.toFixed(2)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user