프로필 이미지 삭제 직후 렌더링이 안되는 문제 해결

This commit is contained in:
dohyeons
2025-09-30 15:45:21 +09:00
parent 318436475a
commit 6da8d14845
6 changed files with 90 additions and 58 deletions

View File

@@ -26,20 +26,38 @@ export function UserDropdown({ user, onProfileClick, onLogout }: UserDropdownPro
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="relative h-8 w-8 rounded-full">
<Avatar className="h-8 w-8">
{user.photo ? <AvatarImage src={user.photo} alt={user.userName || "User"} /> : null}
<AvatarFallback>{user.userName?.substring(0, 1) || "U"}</AvatarFallback>
</Avatar>
<div className="relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full">
{user.photo && user.photo.trim() !== "" && user.photo !== "null" ? (
<img
src={user.photo}
alt={user.userName || "User"}
className="aspect-square h-full w-full object-cover"
/>
) : (
<div className="flex h-full w-full items-center justify-center rounded-full bg-slate-200 font-semibold text-slate-700">
{user.userName?.substring(0, 1)?.toUpperCase() || "U"}
</div>
)}
</div>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56" align="end">
<DropdownMenuLabel className="font-normal">
<div className="flex items-center space-x-3">
{/* 프로필 사진 표시 */}
<Avatar className="h-12 w-12">
{user.photo ? <AvatarImage src={user.photo} alt={user.userName || "User"} /> : null}
<AvatarFallback>{user.userName?.substring(0, 1) || "U"}</AvatarFallback>
</Avatar>
<div className="relative flex h-12 w-12 shrink-0 overflow-hidden rounded-full">
{user.photo && user.photo.trim() !== "" && user.photo !== "null" ? (
<img
src={user.photo}
alt={user.userName || "User"}
className="aspect-square h-full w-full object-cover"
/>
) : (
<div className="flex h-full w-full items-center justify-center rounded-full bg-slate-200 text-base font-semibold text-slate-700">
{user.userName?.substring(0, 1)?.toUpperCase() || "U"}
</div>
)}
</div>
{/* 사용자 정보 */}
<div className="flex flex-col space-y-1">