'use client'; import { MoreHorizontal, Crown, User, Edit, Calendar, Activity, Eye, Mail } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; import type { User as UserType } from '@/types/user'; interface UserCardProps { user: UserType; index: number; onViewDetails: (user: UserType) => void; } export function UserCard({ user, index, onViewDetails }: UserCardProps) { const getInitials = (name: string) => { return name .split(' ') .map(part => part[0]) .join('') .toUpperCase() .substring(0, 2); }; const getRoleColor = (role: string) => { switch (role?.toLowerCase()) { case 'admin': return 'bg-blue-600'; case 'editor': return 'bg-emerald-600'; case 'user': return 'bg-gray-600'; default: return 'bg-gray-600'; } }; const getRoleIcon = (role: string) => { switch (role?.toLowerCase()) { case 'admin': return Crown; case 'editor': return Edit; default: return User; } }; const RoleIcon = getRoleIcon(user.role); return (
{/* Header with avatar and info */}
{getInitials(user.name || 'Usuario')}

{user.name || 'Usuario sin nombre'}

{user.email || 'Email no disponible'}

{/* User info */}
Rol
{user.role?.toUpperCase() || 'USER'}
Registro
{user.createdAt ? new Date(user.createdAt).toLocaleDateString('es-ES', { year: 'numeric', month: 'short', day: 'numeric' }) : 'N/A'}
Estado
{/* Action buttons */}
); }