diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index 7af0c3c..78bc2b9 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -14,9 +14,10 @@ * [Main] — 페이지 컨텐츠 영역 */ import { Link, useLocation } from 'react-router-dom' -import { LayoutDashboard, History, Cpu, Activity, SlidersHorizontal, BarChart3, TrendingUp, KeyRound } from 'lucide-react' +import { LayoutDashboard, History, Cpu, Activity, SlidersHorizontal, BarChart3, TrendingUp, KeyRound, LogOut, User as UserIcon } from 'lucide-react' import { useQuery } from '@tanstack/react-query' import api from '../lib/api' +import { useTenantMode } from '../lib/tenant' /** Layout Props 정의 */ interface LayoutProps { @@ -59,6 +60,15 @@ const Layout = ({ children }: LayoutProps) => { }) /** 네비게이션 메뉴 항목 (경로, 아이콘, 레이블) */ + // 현재 로그인 주체(세션 사용자 or API 키) — 헤더 표시·로그아웃용 + const { me } = useTenantMode() + + /** 로그아웃: 저장된 세션 토큰/API 키 제거 후 로그인 화면으로 (App 이 localStorage 로 인증 판단) */ + const handleLogout = () => { + localStorage.removeItem('api_key') + window.location.href = '/' + } + const navItems = [ { path: '/', icon: LayoutDashboard, label: '대시보드' }, { path: '/analysis', icon: TrendingUp, label: '성과 분석' }, @@ -114,6 +124,33 @@ const Layout = ({ children }: LayoutProps) => {
MCP: {mcpStatus?.status || 'Unknown'} + + {/* 사용자 · 로그아웃 */} +