From 92a21ff4c5df6e9f771cfbd140835dce3b6d7b0d Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Fri, 8 Dec 2023 14:56:51 -0500 Subject: Migration script, improvements in expenses list --- src/app/groups/[groupId]/expenses/expense-list.tsx | 30 +++-- src/app/groups/recent-group-list.tsx | 22 +++- src/lib/api.ts | 3 +- src/scripts/migrate.ts | 130 +++++++++++++++++++++ 4 files changed, 168 insertions(+), 17 deletions(-) create mode 100644 src/scripts/migrate.ts (limited to 'src') diff --git a/src/app/groups/[groupId]/expenses/expense-list.tsx b/src/app/groups/[groupId]/expenses/expense-list.tsx index 13a85bd..798a5f8 100644 --- a/src/app/groups/[groupId]/expenses/expense-list.tsx +++ b/src/app/groups/[groupId]/expenses/expense-list.tsx @@ -1,5 +1,4 @@ 'use client' -import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { getGroupExpenses } from '@/lib/api' import { cn } from '@/lib/utils' @@ -7,6 +6,7 @@ import { Participant } from '@prisma/client' import { ChevronRight } from 'lucide-react' import Link from 'next/link' import { useRouter } from 'next/navigation' +import { Fragment } from 'react' type Props = { expenses: Awaited> @@ -37,22 +37,32 @@ export function ExpenseList({ }} >
-
{expense.title}
+
+ {expense.title} +
- Paid by{' '} - - {getParticipant(expense.paidById)?.name} - {' '} + Paid by {getParticipant(expense.paidById)?.name}{' '} for{' '} {expense.paidFor.map((paidFor, index) => ( - - {participants.find((p) => p.id === paidFor.participantId)?.name} - + + {index !== 0 && <>, } + + { + participants.find((p) => p.id === paidFor.participantId) + ?.name + } + + ))}
-
+
{currency} {(expense.amount / 100).toFixed(2)}