From 57899b0160385c53df4e43ef2fd12492e0dffb77 Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Wed, 6 Dec 2023 20:21:26 -0500 Subject: Reimbursements --- src/app/groups/[groupId]/balances/page.tsx | 2 +- src/app/groups/[groupId]/expenses/page.tsx | 6 +++++- src/app/groups/[groupId]/reimbursement-list.tsx | 11 +++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/app/groups') diff --git a/src/app/groups/[groupId]/balances/page.tsx b/src/app/groups/[groupId]/balances/page.tsx index 33ba653..ab2c582 100644 --- a/src/app/groups/[groupId]/balances/page.tsx +++ b/src/app/groups/[groupId]/balances/page.tsx @@ -22,7 +22,6 @@ export default async function GroupPage({ const expenses = await getGroupExpenses(groupId) const balances = getBalances(expenses) const reimbursements = getSuggestedReimbursements(balances) - console.log(reimbursements) return ( <> @@ -54,6 +53,7 @@ export default async function GroupPage({ reimbursements={reimbursements} participants={group.participants} currency={group.currency} + groupId={groupId} /> diff --git a/src/app/groups/[groupId]/expenses/page.tsx b/src/app/groups/[groupId]/expenses/page.tsx index 2eb98ab..c99d081 100644 --- a/src/app/groups/[groupId]/expenses/page.tsx +++ b/src/app/groups/[groupId]/expenses/page.tsx @@ -16,6 +16,7 @@ import { TableRow, } from '@/components/ui/table' import { getGroup, getGroupExpenses } from '@/lib/api' +import { cn } from '@/lib/utils' import { ChevronRight, Plus } from 'lucide-react' import Link from 'next/link' import { notFound } from 'next/navigation' @@ -62,7 +63,10 @@ export default async function GroupExpensesPage({ {expenses.map((expense) => ( - + {expense.title} diff --git a/src/app/groups/[groupId]/reimbursement-list.tsx b/src/app/groups/[groupId]/reimbursement-list.tsx index 9d3ec49..3fc94bc 100644 --- a/src/app/groups/[groupId]/reimbursement-list.tsx +++ b/src/app/groups/[groupId]/reimbursement-list.tsx @@ -1,16 +1,20 @@ +import { Button } from '@/components/ui/button' import { Reimbursement } from '@/lib/balances' 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) { const getParticipant = (id: string) => participants.find((p) => p.id === id) return ( @@ -20,6 +24,13 @@ export function ReimbursementList({
{getParticipant(reimbursement.from)?.name} owes{' '} {getParticipant(reimbursement.to)?.name} +
{currency} {reimbursement.amount.toFixed(2)} -- cgit v1.3