From c08203cc769cdab9e2d13c5bdfb9ff7854a4676c Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Sun, 2 Jun 2024 00:54:20 -0400 Subject: [PATCH] fix: prevent user deletion if they have machines owned --- app/routes/_data.users._index/route.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/routes/_data.users._index/route.tsx b/app/routes/_data.users._index/route.tsx index ee1e536..899f93e 100644 --- a/app/routes/_data.users._index/route.tsx +++ b/app/routes/_data.users._index/route.tsx @@ -211,11 +211,10 @@ interface UserProps { function Users({ users, magic }: UserProps) { return (
- {users.map((user, i) => ( + {users.map(user => ( ))} @@ -267,11 +266,10 @@ function InteractiveUsers({ users, setUsers, magic }: UserProps) { }} >
- {users.map((user, i) => ( + {users.map(user => ( ))} @@ -312,11 +310,10 @@ function MachineChip({ machine }: { readonly machine: Machine }) { interface CardProps { user: UserMachine - isFirst: boolean magic?: string } -function UserCard({ user, isFirst, magic }: CardProps) { +function UserCard({ user, magic }: CardProps) { const { isOver, setNodeRef } = useDroppable({ id: user.name, }) @@ -339,11 +336,11 @@ function UserCard({ user, isFirst, magic }: CardProps) {
- {isFirst - ? undefined - : ( + {user.machines.length === 0 + ? ( - )} + ) + : undefined}