Skip to content

Conversation

@kimnamheeee
Copy link
Contributor

@kimnamheeee kimnamheeee commented Sep 2, 2025

📝 설명

기존에는 중복 코드로 작성되어 있던 네비게이션의 AvatarButton을 컴포넌트화 했습니다. (공통 컴포넌트 X / service/app 내부 일반 컴포넌트)

🛠️ 주요 변경 사항

  • AvatarButton 컴포넌트 생성 4aaedf3
  • 기존 Nav 컴포넌트들에서 AvatarButton을 사용하도록 리팩토링 cffc112

리뷰 시 고려해야 할 사항

Summary by CodeRabbit

  • 신규 기능

    • 프로필 이미지를 표시하는 아바타 버튼 추가
    • 아바타 버튼 드롭다운에서 즉시 로그아웃 제공
  • UI/UX

    • 대시보드, 게임 목록, 홈 내비게이션 상단의 사용자 메뉴를 단일 아바타 버튼으로 통일
    • 닉네임 텍스트를 제거해 헤더를 간결화
    • 복잡한 드롭다운/외부 클릭 처리 제거로 인터랙션 단순화
    • 로그아웃 흐름을 한 번의 클릭으로 간소화

@coderabbitai
Copy link

coderabbitai bot commented Sep 2, 2025

Walkthrough

Avatar/logout UI is unified by introducing a new AvatarButton component and replacing prior dropdown/state logic across dashboard, games, and HomeNavigation. useAuth usage is simplified to { user, logout }. A prior button export is removed. Console logs and unused handlers are cleaned up.

Changes

Cohort / File(s) Summary
New Avatar UI Component
service/app/src/widgets/components/avatarButton.tsx
Adds AvatarButton: avatar trigger with dropdown containing a single “로그아웃” item; props { src?, onClick }. Uses SecondaryPlainIconButton, Image, and DropdownMenu components.
Pages adopt AvatarButton & simplify auth usage
service/app/src/app/dashboard/page.tsx, service/app/src/app/games/page.tsx, service/app/src/widgets/HomeNavigation.tsx
Replaces custom avatar/dropdown and local state with AvatarButton; destructures { user, logout } from useAuth; logout handler simplified; removes nickname display and console logs; preserves navigation behaviors.
Auth hook return shape update
@/entities/auth
useAuth return updated to { user, logout } (removed isLoading, isAuthenticated from call sites).
Design button export cleanup
@shared/design/src/components/button
Removes export of SecondaryOutlineBoxButton; pages now import only PrimaryBoxButton where applicable.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as 사용자
  participant Page as 페이지 (Dashboard/Games/HomeNav)
  participant Avatar as AvatarButton
  participant Auth as useAuth
  participant Router as Router

  User->>Page: 페이지 방문
  Page->>Auth: useAuth() 호출
  Auth-->>Page: { user, logout }
  Page->>Avatar: render with src = user?.profileImageUrl

  User->>Avatar: 아바타 클릭
  Avatar->>Avatar: 드롭다운 표시 ("로그아웃")
  User->>Avatar: "로그아웃" 선택
  Avatar->>Page: onClick 콜백
  Page->>Auth: logout()
  Auth-->>Page: 완료
  Page->>Router: navigate("/")
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Suggested labels

✨feature, 👩🏻‍💻frontend

Suggested reviewers

  • whdgur5717

Poem

토끼가 말하길: 클릭, 톡-툭! 로그아웃 달이 떴네
아바타 둥글게, 구름처럼 떠오르고
메뉴는 간결히, 발자국 하나 남기고
대시보드에서 게임까지, 폴짝 점프!
오늘 밤엔 깔끔한 헤더 아래서 꿈꾸리 🐇🌙

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 175-create-avatarmenu-component

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (8)
service/app/src/widgets/HomeNavigation.tsx (3)

18-21: 미사용 프로퍼티 제거 제안(HomeNavigationProps.isLoggedIn).

컴포넌트에서 사용되지 않습니다. 타입을 간소화해 주세요.

다음 변경을 권장합니다:

 interface HomeNavigationProps {
-  isLoggedIn?: boolean
   className?: string
 }

41-43: 테마 토글, resolvedTheme 기준으로 통일 권장.

다른 파일과 달리 theme를 사용하고 있어 'system' 모드에서 토글 방향이 어긋날 수 있습니다.

-  const handleThemeToggle = () => {
-    setTheme(theme === "dark" ? "light" : "dark")
-  }
+  const handleThemeToggle = () => {
+    setTheme(resolvedTheme === "dark" ? "light" : "dark")
+  }

25-25: 아바타 이미지 전달 누락 — 사용자 프로필 이미지 표시 제안.

다른 화면과 일관되게 프로필 이미지를 사용하면 UX가 좋아집니다.

-  const { isLoading: authLoading, isAuthenticated, logout, login } = useAuth()
+  const { isLoading: authLoading, isAuthenticated, logout, login, user } = useAuth()
-              <AvatarButton onClick={handleLogoutClick} />
+              <AvatarButton onClick={handleLogoutClick} src={user?.profileImageUrl || undefined} />

Also applies to: 110-110

service/app/src/app/games/page.tsx (1)

166-169: 빈 문자열(src="") 대비한 안전한 전달 권장.

프로필 URL이 빈 문자열일 경우 Next/Image가 실패할 수 있어 기본 아바타로 폴백하도록 처리하세요.

-          <AvatarButton
-            onClick={handleLogoutClick}
-            src={user?.profileImageUrl}
-          />
+          <AvatarButton
+            onClick={handleLogoutClick}
+            src={user?.profileImageUrl || undefined}
+          />
service/app/src/widgets/components/avatarButton.tsx (3)

20-33: 트리거 버튼에 접근성 라벨 추가 제안.

이미지 대체텍스트만으로도 이름이 생기지만, 버튼 자체에 의도를 드러내는 라벨을 부여하면 더 명확합니다.

-      <DropdownMenuTrigger asChild>
-        <SecondaryPlainIconButton size="lg" className="size-[42px] shrink-0">
+      <DropdownMenuTrigger asChild>
+        <SecondaryPlainIconButton
+          size="lg"
+          className="size-[42px] shrink-0"
+          aria-label="사용자 메뉴 열기"
+        >

15-18: src 빈 문자열 폴백 처리.

prop으로 빈 문자열이 전달되면 기본 이미지로 안전하게 폴백하도록 방어 코드를 추가하세요.

 export default function AvatarButton({
   src = "/avatar.svg",
   onClick,
 }: AvatarButtonProps) {
-  return (
+  const safeSrc = typeof src === "string" && src.trim() ? src : "/avatar.svg"
+  return (
     <DropdownMenuRoot>
       <DropdownMenuTrigger asChild>
         <SecondaryPlainIconButton size="lg" className="size-[42px] shrink-0">
           <Image
-            src={src}
+            src={safeSrc}
             alt="사용자 프로필 사진"
             width={42}
             height={42}
             className="size-full rounded-full"
             placeholder="blur"
             blurDataURL="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzI3IiBoZWlnaHQ9IjQ1OSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZTVlN2ViIi8+PC9zdmc+"
           />

Also applies to: 24-31


10-13: 핸들러 명시성 개선 제안(onClick → onLogout).

의도를 드러내는 네이밍이 가독성을 높입니다. 외부 사용처 변경이 필요한 점만 참고하세요.

-interface AvatarButtonProps {
-  src?: string
-  onClick: () => void
-}
+interface AvatarButtonProps {
+  src?: string
+  onLogout: () => void
+}
...
-  onClick,
+  onLogout,
...
-          onClick={onClick}
+          onClick={onLogout}

Also applies to: 41-46

service/app/src/app/dashboard/page.tsx (1)

188-188: 빈 문자열(src="") 대비한 안전한 전달 권장.

프로필 URL이 비어 있으면 기본 아바타로 폴백하도록 처리하세요.

-      <AvatarButton onClick={handleLogoutClick} src={user?.profileImageUrl} />
+      <AvatarButton onClick={handleLogoutClick} src={user?.profileImageUrl || undefined} />
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9830e69 and cffc112.

📒 Files selected for processing (4)
  • service/app/src/app/dashboard/page.tsx (3 hunks)
  • service/app/src/app/games/page.tsx (2 hunks)
  • service/app/src/widgets/HomeNavigation.tsx (2 hunks)
  • service/app/src/widgets/components/avatarButton.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Component names in code must use PascalCase

Files:

  • service/app/src/widgets/HomeNavigation.tsx
  • service/app/src/widgets/components/avatarButton.tsx
  • service/app/src/app/dashboard/page.tsx
  • service/app/src/app/games/page.tsx
🧬 Code graph analysis (4)
service/app/src/widgets/HomeNavigation.tsx (1)
service/app/src/widgets/components/avatarButton.tsx (1)
  • AvatarButton (15-50)
service/app/src/widgets/components/avatarButton.tsx (2)
shared/design/src/components/menu/index.tsx (4)
  • DropdownMenuRoot (106-106)
  • DropdownMenuTrigger (107-107)
  • DropdownMenuContent (104-104)
  • DropdownMenuItem (105-105)
shared/design/src/components/button/secondaryPlainIconButton.tsx (1)
  • SecondaryPlainIconButton (42-42)
service/app/src/app/dashboard/page.tsx (2)
service/app/src/entities/auth/hooks/useAuth.ts (1)
  • useAuth (18-110)
service/app/src/widgets/components/avatarButton.tsx (1)
  • AvatarButton (15-50)
service/app/src/app/games/page.tsx (1)
service/app/src/widgets/components/avatarButton.tsx (1)
  • AvatarButton (15-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ci
🔇 Additional comments (8)
service/app/src/widgets/HomeNavigation.tsx (2)

16-16: AvatarButton 도입으로 중복 제거 깔끔합니다.

내비게이션의 아바타/로그아웃 UI가 단일 컴포넌트로 정리되어 유지보수성이 좋아졌습니다.


58-60: 로그아웃 후 이동 정책 확인 요청.

대시보드 페이지는 "/"로 리디렉트하지만 이 컴포넌트는 현재 페이지에 머뭅니다. 의도된 동작인지 확인 부탁드립니다.

service/app/src/app/games/page.tsx (2)

19-19: AvatarButton 도입 LGTM.

헤더의 사용자 메뉴가 일관화되어 좋습니다.


26-27: useAuth API 정렬 LGTM.

logout 포함한 구조분해로 API 변경과 일치합니다.

service/app/src/widgets/components/avatarButton.tsx (1)

15-15: PascalCase 컴포넌트 규칙 준수 확인.

AvatarButton 컴포넌트 네이밍이 가이드에 부합합니다.

service/app/src/app/dashboard/page.tsx (3)

21-21: AvatarButton 도입 LGTM.

헤더 우측 사용자 메뉴가 통일되었습니다.


27-27: useAuth 사용 정돈 LGTM.

{ logout, user }만을 사용해 간결합니다.


149-152: 로그아웃 후 리디렉션 방식 확인.

이 페이지는 "/"로 이동합니다. HomeNavigation 및 GamesPage와의 일관성을 유지할지 결정이 필요합니다.

@github-actions
Copy link

github-actions bot commented Sep 2, 2025

테스트 실패

테스트가 실패했습니다. Actions 로그를 확인해주세요.

@github-actions
Copy link

github-actions bot commented Sep 3, 2025

Deploy preview for re-creation ready!

✅ Preview
https://re-creation-cqrvcoiu8-whdgur5717s-projects.vercel.app

Built with commit 73da722.
This pull request is being automatically deployed with vercel-action

@kimnamheeee kimnamheeee self-assigned this Sep 3, 2025
@kimnamheeee kimnamheeee added ✨feature 구현, 개선 사항 관련 부분 🪄refactor 리팩토링 labels Sep 3, 2025
@kimnamheeee kimnamheeee linked an issue Sep 3, 2025 that may be closed by this pull request
@kimnamheeee kimnamheeee linked an issue Sep 3, 2025 that may be closed by this pull request
@kimnamheeee kimnamheeee added this to the 1차 기능 리팩토링 milestone Sep 3, 2025
@kimnamheeee kimnamheeee merged commit 57fd69b into dev Sep 3, 2025
2 checks passed
@kimnamheeee kimnamheeee deleted the 175-create-avatarmenu-component branch December 24, 2025 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨feature 구현, 개선 사항 관련 부분 🪄refactor 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create avatarMenu component

3 participants