This commit is contained in:
hailin 2025-03-15 22:05:03 +08:00
parent fe6b89d001
commit 8fe8be33be
1 changed files with 9 additions and 7 deletions

View File

@ -3,7 +3,7 @@
import Image from 'next/image' import Image from 'next/image'
import { Session } from 'next-auth' import { Session } from 'next-auth'
import { signOut } from 'next-auth/react' import { signOut } from 'next-auth/react'
import { LogOut, User } from "lucide-react"; // 导入图标
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { import {
DropdownMenu, DropdownMenu,
@ -46,23 +46,22 @@ export function UserMenu({ user }: { user: UserData }) {
return colors[index]; return colors[index];
}; };
return ( return (
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<Button className="p-0 m-0 w-12 h-12 bg-transparent border-none shadow-none outline-none hover:bg-transparent active:bg-transparent focus:ring-0 cursor-pointer"> <Button className="p-0 m-0 w-10 h-10 bg-transparent border-none shadow-none outline-none hover:bg-transparent active:bg-transparent focus:ring-0 cursor-pointer">
{user?.image ? ( {user?.image ? (
<Image <Image
className="h-12 w-12 select-none rounded-full ring-1 ring-zinc-100/10 transition-opacity duration-300 hover:opacity-80" className="h-10 w-10 select-none rounded-full ring-1 ring-zinc-100/10 transition-opacity duration-300 hover:opacity-80"
src={`${user.image}&s=60`} src={`${user.image}&s=60`}
alt='User profile image' alt='User profile image'
width={32} width={40}
height={32} height={40}
/> />
) : ( ) : (
<div <div
className="flex h-12 w-12 shrink-0 select-none items-center justify-center rounded-full bg-muted/50 text-xs font-medium uppercase text-muted-foreground" className="flex h-10 w-10 shrink-0 select-none items-center justify-center rounded-full bg-muted/50 text-base font-medium uppercase text-muted-foreground"
style={{ backgroundColor: getRandomColor(user?.user_name) }} style={{ backgroundColor: getRandomColor(user?.user_name) }}
> >
{user?.user_name ? getUserInitials(user?.user_name.slice(0, 2)) : null} {user?.user_name ? getUserInitials(user?.user_name.slice(0, 2)) : null}
@ -81,6 +80,7 @@ export function UserMenu({ user }: { user: UserData }) {
}} }}
className="text-xs" className="text-xs"
> >
<User className="w-4 h-4 mr-2" /> {/* 添加 Profile 图标 */}
Profile Profile
</DropdownMenuItem> </DropdownMenuItem>
@ -123,6 +123,7 @@ export function UserMenu({ user }: { user: UserData }) {
} }
className="text-xs" className="text-xs"
> >
<LogOut className="w-4 h-4 mr-2" /> {/* 添加 Log Out 图标 */}
Log Out Log Out
</DropdownMenuItem> </DropdownMenuItem>
@ -130,4 +131,5 @@ export function UserMenu({ user }: { user: UserData }) {
</DropdownMenu> </DropdownMenu>
</div> </div>
) )
} }