16 lines
874 B
TypeScript
16 lines
874 B
TypeScript
|
|
// แถบแสดงผู้ใช้ที่เข้าสู่ระบบบนหน้ารายการ (แทน UserPicker เดิม) — server component
|
||
|
|
// รับค่าจาก cookie ผ่าน props จากหน้า (middleware การันตีว่ามี session ก่อนถึงหน้านี้)
|
||
|
|
import LogoutButton from "./LogoutButton";
|
||
|
|
|
||
|
|
export default function SessionBar({ userName }: { userName: string }) {
|
||
|
|
return (
|
||
|
|
<div className="mt-6 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-xl border border-slate-200 bg-white px-4 py-3 shadow-sm">
|
||
|
|
<p className="min-w-0 text-sm text-slate-600">
|
||
|
|
เข้าสู่ระบบเป็น{" "}
|
||
|
|
<span className="font-semibold text-slate-900">{userName}</span>
|
||
|
|
</p>
|
||
|
|
<LogoutButton />
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|