add icon for user
This commit is contained in:
1 parent
ef08b9f433
commit
78cf43d7ff
7 files changed
+72
-36
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
/** 사이드바 로고 아래에 붙는 로그인 상태. 누구로 들어와 있는지와 나가는 길 */
|
||||
/** 사이드바 맨 아래 계정 카드. 누구로 들어와 있는지, 남은 크레딧, 나가는 길 */
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { signOut, useMe } from "@/lib/auth";
|
||||
@@ -13,22 +13,31 @@ export default function AccountBadge() {
|
||||
|
||||
if (me === false) {
|
||||
return (
|
||||
<button type="button" className="account-badge-link"
|
||||
onClick={() => router.push("/login")}>
|
||||
로그인
|
||||
</button>
|
||||
<div className="account-card">
|
||||
<button type="button" className="account-link" onClick={() => router.push("/login")}>
|
||||
로그인
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="account-badge">
|
||||
<span className="account-badge-name" title={me.email}>{me.name || me.email}</span>
|
||||
<span className="account-badge-quota" title="남은 크레딧">
|
||||
{me.jobs_left}/{me.job_limit}
|
||||
</span>
|
||||
<button type="button" className="account-badge-link"
|
||||
<div className="account-card">
|
||||
{me.picture ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img className="account-photo" src={me.picture} alt="" referrerPolicy="no-referrer" />
|
||||
) : (
|
||||
<span className="account-photo account-photo--blank">
|
||||
{(me.name || me.email).slice(0, 1)}
|
||||
</span>
|
||||
)}
|
||||
<div className="account-body">
|
||||
<p className="account-name" title={me.email}>{me.name || me.email}</p>
|
||||
<p className="account-credit">보유 크레딧: {me.jobs_left}</p>
|
||||
</div>
|
||||
<button type="button" className="account-link"
|
||||
onClick={() => { signOut().then(() => setMe(false)).then(() => router.push("/")); }}>
|
||||
로그아웃
|
||||
나가기
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user