fix: header personal page link and login flow

This commit is contained in:
zetaloop
2026-02-20 17:43:13 +08:00
parent 66c6cfd4fc
commit 7e2396fc60
+8 -4
View File
@@ -51,7 +51,7 @@ export function Header() {
const [mobileOpen, setMobileOpen] = useState(false)
const pathname = usePathname()
const router = useRouter()
const { isAuthenticated, currentRole, switchRole, login, logout } = useAuthStore()
const { isAuthenticated, currentRole, switchRole, logout } = useAuthStore()
const unreadCount = mockNotifications.filter((n) => !n.read).length
@@ -142,12 +142,14 @@ export function Header() {
<DropdownMenuLabel>{currentUser.nickname}</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
{currentRole === "player" && (
<DropdownMenuItem asChild>
<Link href={`/player/${currentUser.id}`}>
<User className="mr-2 h-4 w-4" />
</Link>
</DropdownMenuItem>
)}
<DropdownMenuItem asChild>
<Link href="/orders">
<ShoppingBag className="mr-2 h-4 w-4" />
@@ -191,8 +193,8 @@ export function Header() {
</>
) : (
<div className="hidden md:flex items-center gap-2">
<Button variant="ghost" size="sm" onClick={login}>
<Button variant="ghost" size="sm" asChild>
<Link href="/login"></Link>
</Button>
<Button size="sm" asChild>
<Link href="/register"></Link>
@@ -301,8 +303,10 @@ export function Header() {
{!isAuthenticated && (
<div className="border-t pt-4 flex gap-2 px-3">
<Button variant="outline" className="flex-1" onClick={login}>
<Button variant="outline" className="flex-1" asChild>
<Link href="/login" onClick={() => setMobileOpen(false)}>
</Link>
</Button>
<Button className="flex-1" asChild>
<Link href="/register" onClick={() => setMobileOpen(false)}>