- remove(index)}
- type="button"
- size="icon"
- >
-
-
+ {item.id &&
+ protectedParticipantIds.includes(item.id) ? (
+
+
+
+
+
+
+
+ This participant is part of expenses, and can
+ not be removed.
+
+
+ ) : (
+ remove(index)}
+ type="button"
+ size="icon"
+ >
+
+
+ )}
diff --git a/src/components/ui/hover-card.tsx b/src/components/ui/hover-card.tsx
new file mode 100644
index 0000000..e54d91c
--- /dev/null
+++ b/src/components/ui/hover-card.tsx
@@ -0,0 +1,29 @@
+"use client"
+
+import * as React from "react"
+import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
+
+import { cn } from "@/lib/utils"
+
+const HoverCard = HoverCardPrimitive.Root
+
+const HoverCardTrigger = HoverCardPrimitive.Trigger
+
+const HoverCardContent = React.forwardRef<
+ React.ElementRef,
+ React.ComponentPropsWithoutRef
+>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
+
+))
+HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
+
+export { HoverCard, HoverCardTrigger, HoverCardContent }
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 4ae88ef..2968cae 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -66,6 +66,18 @@ export async function deleteExpense(expenseId: string) {
})
}
+export async function getGroupExpensesParticipants(groupId: string) {
+ const expenses = await getGroupExpenses(groupId)
+ return Array.from(
+ new Set(
+ expenses.flatMap((e) => [
+ e.paidById,
+ ...e.paidFor.map((pf) => pf.participantId),
+ ]),
+ ),
+ )
+}
+
export async function updateExpense(
groupId: string,
expenseId: string,