This commit is contained in:
parent
fe6b89d001
commit
8fe8be33be
|
|
@ -3,7 +3,7 @@
|
|||
import Image from 'next/image'
|
||||
import { Session } from 'next-auth'
|
||||
import { signOut } from 'next-auth/react'
|
||||
|
||||
import { LogOut, User } from "lucide-react"; // 导入图标
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -46,23 +46,22 @@ export function UserMenu({ user }: { user: UserData }) {
|
|||
return colors[index];
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between">
|
||||
<DropdownMenu>
|
||||
<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 ? (
|
||||
<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`}
|
||||
alt='User profile image'
|
||||
width={32}
|
||||
height={32}
|
||||
width={40}
|
||||
height={40}
|
||||
/>
|
||||
) : (
|
||||
<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) }}
|
||||
>
|
||||
{user?.user_name ? getUserInitials(user?.user_name.slice(0, 2)) : null}
|
||||
|
|
@ -81,6 +80,7 @@ export function UserMenu({ user }: { user: UserData }) {
|
|||
}}
|
||||
className="text-xs"
|
||||
>
|
||||
<User className="w-4 h-4 mr-2" /> {/* 添加 Profile 图标 */}
|
||||
Profile
|
||||
</DropdownMenuItem>
|
||||
|
||||
|
|
@ -123,6 +123,7 @@ export function UserMenu({ user }: { user: UserData }) {
|
|||
}
|
||||
className="text-xs"
|
||||
>
|
||||
<LogOut className="w-4 h-4 mr-2" /> {/* 添加 Log Out 图标 */}
|
||||
Log Out
|
||||
</DropdownMenuItem>
|
||||
|
||||
|
|
@ -130,4 +131,5 @@ export function UserMenu({ user }: { user: UserData }) {
|
|||
</DropdownMenu>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue