import { Pencil, Trash2 } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ConfirmDialog } from "@/components/ui/confirm-dialog"; import type { User } from "@/lib/models"; const ROLE_LABELS: Record = { ADMIN: "Amministratore", MANAGER: "Gestore", CLIENT: "Associazione", }; export function UserAccountsCard({ users, actions, onEdit, onDelete, }: { users: User[]; actions?: React.ReactNode; onEdit?: (index: number) => void; onDelete?: (index: number) => Promise | void; }) { const editable = Boolean(onEdit || onDelete); return ( Account di accesso ({users.length}) {actions} {users.length === 0 ? (

Nessun account configurato

) : (
    {users.map((user, index) => (
  • {user.email} {ROLE_LABELS[user.role] ?? user.role}
    {editable && (
    {onEdit && ( )} {onDelete && ( } title="Rimuovere l'account?" description={`${user.email} non potrà più accedere al portale.`} confirmLabel="Rimuovi" onConfirm={() => onDelete(index)} /> )}
    )}
  • ))}
)}
); }