diff --git a/src/app/groups/[groupId]/page.tsx b/src/app/groups/[groupId]/page.tsx index 9547fcc..b7dc93f 100644 --- a/src/app/groups/[groupId]/page.tsx +++ b/src/app/groups/[groupId]/page.tsx @@ -49,62 +49,67 @@ export default async function GroupPage({ + - - - - Title - Paid by - Paid for - Amount - - - - - {expenses.map((expense) => ( - - {expense.title} - - - { - group.participants.find( - (p) => p.id === expense.paidById, - )?.name - } - - - - {expense.paidFor.map((paidFor, index) => ( - + {expenses.length > 0 ? ( +
+ + + Title + Paid by + Paid for + Amount + + + + + {expenses.map((expense) => ( + + {expense.title} + + { group.participants.find( - (p) => p.id === paidFor.participantId, + (p) => p.id === expense.paidById, )?.name } - ))} - - - $ {expense.amount.toFixed(2)} - - - - - - ))} - -
+ + + + + + + ))} + + + ) : ( +
Your group doesn’t have any expense yet.
+ )}
diff --git a/src/components/expense-form.tsx b/src/components/expense-form.tsx index f7826c6..12bdb2e 100644 --- a/src/components/expense-form.tsx +++ b/src/components/expense-form.tsx @@ -56,12 +56,12 @@ export function ExpenseForm({ group, expense, onSubmit }: Props) { Expense information - + ( - + Expense title @@ -78,7 +78,7 @@ export function ExpenseForm({ group, expense, onSubmit }: Props) { control={form.control} name="paidBy" render={({ field }) => ( - + Paid by ( - +
Paid for