/** * @file features/layout/components/user-menu.tsx * @description 사용자 프로필 드롭다운 메뉴 컴포넌트 */ "use client"; import { User } from "@supabase/supabase-js"; import { LogOut, Settings, User as UserIcon } from "lucide-react"; import { useRouter } from "next/navigation"; import { signout } from "@/features/auth/actions"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { cn } from "@/lib/utils"; const SESSION_RELATED_STORAGE_KEYS = [ "session-storage", "auth-storage", "autotrade-kis-runtime-store", ] as const; interface UserMenuProps { /** Supabase User 객체 */ user: User | null; /** 홈 랜딩의 shader 배경 위에서 대비를 높이는 모드 */ blendWithBackground?: boolean; } /** * 사용자 메뉴/프로필 컴포넌트 * @param user 로그인한 사용자 정보 * @param blendWithBackground shader 배경 위 가독성 모드 * @returns Avatar 버튼 + 드롭다운 메뉴 * @see features/layout/components/header.tsx 헤더 우측 액션 영역에서 호출 */ export function UserMenu({ user, blendWithBackground = false }: UserMenuProps) { const router = useRouter(); if (!user) return null; /** * @description 로그아웃 제출 직전에 세션 관련 로컬 스토리지를 정리합니다. * @see features/auth/actions.ts signout - 서버 세션 종료를 담당합니다. */ const clearSessionRelatedStorage = () => { if (typeof window === "undefined") return; for (const key of SESSION_RELATED_STORAGE_KEYS) { window.localStorage.removeItem(key); } }; return (

{user.user_metadata?.full_name || user.user_metadata?.name || "사용자"}

{user.email}

router.push("/profile")}> 프로필 router.push("/settings")}> 설정
); }