import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { LogOut, Settings, User } from "lucide-react"; interface AvatarDropdownProps { username: string; role: { roleName: string; priority: number; }; onLogOut: () => void; onSettings?: () => void; onProfile?: () => void; } export default function AvatarDropdown({ username, role, onLogOut, onSettings, onProfile, }: AvatarDropdownProps) { // Get initials from username const getInitials = (name: string): string => { if (!name) return "U"; const parts = name.split(" "); if (parts.length >= 2) { return `${parts[0][0]}${parts[1][0]}`.toUpperCase(); } return name.substring(0, 2).toUpperCase(); }; return (

{username}

{role.roleName || "Người dùng"}

{onProfile && ( Tài khoản của tôi )} {onSettings && ( Cài đặt )} {(onProfile || onSettings) && } Đăng xuất
); }