Add a real, visible patient-profile button

This commit is contained in:
2026-08-25 14:12:49 +07:00
parent 692a9c99b5
commit a1ba00618c
+27 -16
View File
@@ -3,7 +3,7 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { LogIn, LogOut, UserRound } from "lucide-react"; import { ClipboardList, LogIn, LogOut, UserRound } from "lucide-react";
import type { AuthUser } from "@duoc-thu/shared-types"; import type { AuthUser } from "@duoc-thu/shared-types";
import { logout, me } from "@duoc-thu/api-client"; import { logout, me } from "@duoc-thu/api-client";
@@ -37,22 +37,33 @@ export function AccountMenu() {
} }
return ( return (
<div className="flex items-center gap-1.5 rounded-full border border-border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-txt-secondary"> <div className="flex items-center gap-1.5">
<UserRound className="h-3.5 w-3.5" /> <div className="flex items-center gap-1.5 rounded-full border border-border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-txt-secondary">
<Link href="/profile" className="hover:underline" title="Hồ sơ bệnh nhân"> <UserRound className="h-3.5 w-3.5" />
{user.username} <span>{user.username}</span>
</Link> <button
<button aria-label="Đăng xuất"
aria-label="Đăng xuất" onClick={async () => {
onClick={async () => { await logout();
await logout(); setUser(null);
setUser(null); router.refresh();
router.refresh(); }}
}} className="ml-1 text-txt-muted hover:text-txt-primary"
className="ml-1 text-txt-muted hover:text-txt-primary" >
<LogOut className="h-3.5 w-3.5" />
</button>
</div>
{/* A real, labeled button — not a tooltip hidden on plain text (that
* shipped invisible: an owner testing the feature live couldn't find
* it at all). Same destination as before, `/profile`. */}
<Link
href="/profile"
title="Hồ sơ bệnh nhân"
className="flex items-center gap-1.5 rounded-full border border-border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-txt-secondary hover:bg-surface-hover"
> >
<LogOut className="h-3.5 w-3.5" /> <ClipboardList className="h-3.5 w-3.5" />
</button> <span>Hồ bệnh nhân</span>
</Link>
</div> </div>
); );
} }