diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-30 08:28:13 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-30 08:28:13 +0000 |
| commit | 5b6313f16f508882a0ea67716b7dbaa1c6967f04 (patch) | |
| tree | 3d1d8dafea2f31274ace3fbda08333e889e06d1c /components/layout/user-profile-badge.tsx | |
| parent | 3f0fad18483a5c800c79c5e33946d9bb384c10e2 (diff) | |
(대표님) 20250630 16시 - 유저 도메인별 라우터 분리와 보안성검토 대응
Diffstat (limited to 'components/layout/user-profile-badge.tsx')
| -rw-r--r-- | components/layout/user-profile-badge.tsx | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/components/layout/user-profile-badge.tsx b/components/layout/user-profile-badge.tsx new file mode 100644 index 00000000..815ef05d --- /dev/null +++ b/components/layout/user-profile-badge.tsx @@ -0,0 +1,62 @@ +// app/pending/components/user-profile-badge.tsx +"use client" + +import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar" +import { Button } from "@/components/ui/button" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { Clock, LogOut } from "lucide-react" +import { signOut } from "next-auth/react" + +interface UserProfileBadgeProps { + user?: { + name?: string | null + email?: string | null + image?: string | null + } | null +} + +export function UserProfileBadge({ user }: UserProfileBadgeProps) { + if (!user) return null + + const initials = user.name + ?.split(" ") + .map((word) => word[0]?.toUpperCase()) + .join("") + + return ( + <DropdownMenu> + <DropdownMenuTrigger asChild> + <Button variant="ghost" className="flex items-center gap-2"> + <Avatar className="w-8 h-8"> + <AvatarImage src={user.image || ""} alt={user.name || ""} /> + <AvatarFallback> + {initials || "?"} + </AvatarFallback> + </Avatar> + <span className="text-sm font-medium">{user.name}</span> + </Button> + </DropdownMenuTrigger> + + <DropdownMenuContent align="end"> + <DropdownMenuLabel>계정 정보</DropdownMenuLabel> + <DropdownMenuSeparator /> + <DropdownMenuItem disabled> + <Clock className="w-4 h-4 mr-2" /> + 승인 대기 중 + </DropdownMenuItem> + <DropdownMenuSeparator /> + <DropdownMenuItem onClick={() => signOut()}> + <LogOut className="w-4 h-4 mr-2" /> + 로그아웃 + </DropdownMenuItem> + </DropdownMenuContent> + </DropdownMenu> + ) +}
\ No newline at end of file |
