From 4d6802b4f2d241a40874cb2a3de66ab424721d94 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Wed, 2 Sep 2026 17:29:02 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20solution/frontend:=20=EC=97=90?= =?UTF-8?q?=EB=94=94=ED=84=B0=EC=97=90=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=ED=91=9C=EC=8B=9C=20=E2=80=94=20?= =?UTF-8?q?6=EB=8B=A8=EA=B3=84=EC=97=94=20=EC=8B=A0=EC=9B=90=EB=8F=84=20?= =?UTF-8?q?=EB=82=98=EA=B0=80=EB=8A=94=20=EA=B8=B8=EB=8F=84=20=EC=97=86?= =?UTF-8?q?=EC=97=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 위저드(1~5단계)는 AppShell 사이드바가 사용자와 [로그아웃]을 들고 있는데, 에디터(6단계)는 전체 화면이라 AppShell 을 안 쓴다. 그래서 편집 화면에 들어가는 순간 **누구로 로그인했는지도, 나가는 방법도 화면에서 사라졌다.** - BuilderPage: 에디터 상단 바 오른쪽에 사용자 · 상호와 [로그아웃] 추가 - stores/auth.userLabel: 이름 → 이메일 → 아이디 순. 구글 계정의 로그인 아이디는 google_ 라 그대로 보이면 안 된다. AppShell 도 같은 규칙을 쓰게 바꿨다 (기존 `name ?? id` 는 이름이 빈 문자열이면 그대로 통과시켰다) 브라우저 확인: 가입 → 로그인 → 사이드바 '김사장 · 달빛스테이', 에디터 상단 바 동일 표시, [로그아웃] 클릭 시 RequireAuth 가 /login 으로 되돌림. tsc·eslint·vite build 통과. --- .../src/components/layout/AppShell.tsx | 4 +- solution/frontend/src/pages/BuilderPage.tsx | 69 +++++++++++++------ solution/frontend/src/stores/auth.ts | 8 +++ 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/solution/frontend/src/components/layout/AppShell.tsx b/solution/frontend/src/components/layout/AppShell.tsx index b78b597..d1d943c 100644 --- a/solution/frontend/src/components/layout/AppShell.tsx +++ b/solution/frontend/src/components/layout/AppShell.tsx @@ -2,7 +2,7 @@ import type {ComponentType, ReactNode} from 'react'; import {Link, NavLink, useLocation} from 'react-router'; import {LayoutGrid, LogOut, Search, Wand2} from 'lucide-react'; import {cn} from '@/lib/utils'; -import {useAuthStore} from '@/stores/auth'; +import {userLabel, useAuthStore} from '@/stores/auth'; export type NavItem = { to: string; @@ -60,7 +60,7 @@ export function AppShell({children, nav = OWNER_NAV}: {children: ReactNode; nav?
- {user?.name ?? user?.id} + {user ? userLabel(user) : ''} {user?.companyName ? ` · ${user.companyName}` : ''}
+ + )} +
diff --git a/solution/frontend/src/stores/auth.ts b/solution/frontend/src/stores/auth.ts index 50f291c..82fad43 100644 --- a/solution/frontend/src/stores/auth.ts +++ b/solution/frontend/src/stores/auth.ts @@ -31,6 +31,14 @@ export function toAuthUser(res: ResMe): AuthUser { }; } +/** + * 화면에 띄울 이름. 구글 계정의 로그인 아이디는 `google_` 라 그대로 보이면 안 된다 — + * 이름 → 이메일 순으로 떨어뜨리고 아이디는 마지막이다. + */ +export function userLabel(user: AuthUser): string { + return user.name || user.email || user.id; +} + interface AuthState { user: AuthUser | null; /** 부팅 시 저장된 토큰을 확인하기 전까지 true. 가드가 이 동안 리다이렉트를 미룬다. */