"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { ClipboardList, LogIn, LogOut, UserRound } from "lucide-react"; import type { AuthUser } from "@duoc-thu/shared-types"; import { logout, me } from "@duoc-thu/api-client"; /** Public — visible on every page, not just `/admin`. Chat itself never * requires this: an anonymous visitor keeps working exactly as before * regardless of what this renders. Optional login exists here so `demo` * (the logged-in "bác sĩ" persona) can sign in from the normal chat UI. */ export function AccountMenu() { const router = useRouter(); const [user, setUser] = useState(null); const [loaded, setLoaded] = useState(false); useEffect(() => { me() .then(setUser) .finally(() => setLoaded(true)); }, []); if (!loaded) return null; if (!user) { return ( Đăng nhập ); } return (
{user.username}
{/* 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`. */} Hồ sơ bệnh nhân
); }