({ users, isLoading, searchTerm }: UserTableBodyProps)
| 18 | }; |
| 19 | |
| 20 | export function UserTableBody({ users, isLoading, searchTerm }: UserTableBodyProps) { |
| 21 | if (isLoading) { |
| 22 | return ( |
| 23 | <TableBody> |
| 24 | {Array.from({ length: 10 }).map((_, index) => ( |
| 25 | <TableRow key={index}> |
| 26 | <TableCell> |
| 27 | <Skeleton className="h-4 w-[250px]" /> |
| 28 | </TableCell> |
| 29 | <TableCell> |
| 30 | <Skeleton className="h-4 w-[100px]" /> |
| 31 | </TableCell> |
| 32 | <TableCell> |
| 33 | <Skeleton className="h-4 w-[100px]" /> |
| 34 | </TableCell> |
| 35 | <TableCell> |
| 36 | <Skeleton className="h-4 w-[80px]" /> |
| 37 | </TableCell> |
| 38 | <TableCell> |
| 39 | <Skeleton className="h-4 w-[80px]" /> |
| 40 | </TableCell> |
| 41 | <TableCell> |
| 42 | <Skeleton className="h-4 w-[80px]" /> |
| 43 | </TableCell> |
| 44 | <TableCell> |
| 45 | <Skeleton className="h-6 w-[60px] rounded-full" /> |
| 46 | </TableCell> |
| 47 | <TableCell> |
| 48 | <Skeleton className="h-6 w-[80px] rounded-full" /> |
| 49 | </TableCell> |
| 50 | <TableCell> |
| 51 | <Skeleton className="h-4 w-[20px]" /> |
| 52 | </TableCell> |
| 53 | <TableCell> |
| 54 | <Skeleton className="h-4 w-[20px]" /> |
| 55 | </TableCell> |
| 56 | <TableCell> |
| 57 | <Skeleton className="h-6 w-[100px]" /> |
| 58 | </TableCell> |
| 59 | </TableRow> |
| 60 | ))} |
| 61 | </TableBody> |
| 62 | ); |
| 63 | } |
| 64 | |
| 65 | if (users.length === 0) { |
| 66 | const message = searchTerm ? `No users found matching "${searchTerm}".` : 'No users found.'; |
| 67 | |
| 68 | return ( |
| 69 | <TableBody> |
| 70 | <TableRow> |
| 71 | <TableCell colSpan={11} className="h-24 text-center"> |
| 72 | <div className="flex flex-col items-center gap-2"> |
| 73 | <p className="text-muted-foreground">{message}</p> |
| 74 | {searchTerm && ( |
| 75 | <p className="text-muted-foreground text-sm"> |
| 76 | Try adjusting your search terms or clear the search to see all users. |
| 77 | </p> |
nothing calls this directly
no test coverage detected