"use client"; import { getAvatarUrl, getAvatarColor, getAvatarInitial } from "@/utils/avatar"; import { Button } from "@/components/ui/button"; import { Separator } from "@/components/ui/separator"; interface DashboardHeaderProps { username: string; role: string; avatarUrl?: string | null; onLogout: () => void; onProfileClick: () => void; } export function DashboardHeader({ username, role, avatarUrl, onLogout, onProfileClick, }: DashboardHeaderProps) { // 根据用户名生成头像颜色(如果没有上传头像) const avatarColor = getAvatarColor(username); const displayInitial = getAvatarInitial(username); const fullAvatarUrl = getAvatarUrl(avatarUrl); return (
当前账号
{username || "客服"} {role ? `(${role})` : ""}
); }