mirror of
https://github.com/woodchen-ink/Q58Connect.git
synced 2025-07-18 05:51:55 +08:00
feat: Improve user avatar and dropdown menu in NavBar
This commit is contained in:
parent
00538187c6
commit
2bf60a8a22
@ -8,6 +8,10 @@ const nextConfig = {
|
|||||||
protocol: "https",
|
protocol: "https",
|
||||||
hostname: "q58.pro",
|
hostname: "q58.pro",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
protocol: "https",
|
||||||
|
hostname: "i-aws.czl.net",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { User } from "lucide-react";
|
||||||
import { signOut, useSession } from "next-auth/react";
|
import { signOut, useSession } from "next-auth/react";
|
||||||
|
|
||||||
import DynamicLogo from "../dynamic-logo";
|
import DynamicLogo from "../dynamic-logo";
|
||||||
@ -41,24 +42,43 @@ export function NavBar() {
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="icon"
|
size="icon"
|
||||||
className="overflow-hidden rounded-full"
|
className="relative h-9 w-9 overflow-hidden rounded-full"
|
||||||
>
|
>
|
||||||
<Image
|
{user.avatarUrl ? (
|
||||||
src={user.avatarUrl as string}
|
<Image
|
||||||
width={36}
|
src={user.avatarUrl}
|
||||||
height={36}
|
width={36}
|
||||||
alt="Avatar"
|
height={36}
|
||||||
className="overflow-hidden rounded-full"
|
alt={user.name || "用户头像"}
|
||||||
/>
|
className="h-full w-full object-cover"
|
||||||
|
onError={(e) => {
|
||||||
|
const target = e.target as HTMLImageElement;
|
||||||
|
target.style.display = "none";
|
||||||
|
target.nextElementSibling?.classList.remove("hidden");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
<User className="h-5 w-5" />
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end">
|
<DropdownMenuContent align="end">
|
||||||
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
<DropdownMenuLabel>
|
||||||
|
{user.name || user.username || "用户"}
|
||||||
|
</DropdownMenuLabel>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem>Settings</DropdownMenuItem>
|
<DropdownMenuItem asChild>
|
||||||
<DropdownMenuItem>Support</DropdownMenuItem>
|
<Link href="/dashboard">控制台</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem asChild>
|
||||||
|
<Link href="/dashboard/clients">应用管理</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem>Logout</DropdownMenuItem>
|
<DropdownMenuItem
|
||||||
|
className="text-red-600 dark:text-red-400"
|
||||||
|
onClick={() => signOut()}
|
||||||
|
>
|
||||||
|
退出登录
|
||||||
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user