Skip to content

refactor: 메인 페이지 리팩토링#170

Merged
xaexunxang merged 7 commits intodevelopfrom
refact/#168/mainPage-refactoring
Jun 8, 2025
Merged

refactor: 메인 페이지 리팩토링#170
xaexunxang merged 7 commits intodevelopfrom
refact/#168/mainPage-refactoring

Conversation

@xaexunxang
Copy link
Copy Markdown
Contributor

@xaexunxang xaexunxang commented Jun 7, 2025

같이가요 로고 클릭 시 새로고침

default.mov

하단바 홈 버튼 클릭시 뒤로가기 로직 삭제

default.mov

카테고리 페이지 이벤트 정보 없을 때 한글로 보이게 수정

카테고리이벤트없을때

메뉴 관련 리팩토링

default.mov
  • 로그아웃 상태일 때 로그아웃 버튼 삭제
  • 카테고리 문구 → 메뉴로 수정
  • 돋보기 이미지와 관련된 로직 삭제 (검색)

Summary by CodeRabbit

  • 신규 기능

    • 메뉴 버튼 목록이 로그인 상태에 따라 동적으로 변경되어, 로그인 시 로그아웃 버튼이 표시됩니다.
    • 헤더의 왼쪽 "같이가요" 버튼 클릭 시 홈으로 이동하며 페이지가 새로고침됩니다.
  • 버그 수정

    • 이벤트 목록이 비어 있을 때 카테고리명 및 안내 메시지가 더 자연스럽고 정확한 한국어로 표시됩니다.
  • UI 개선

    • 메뉴 페이지 헤더의 중앙 텍스트가 "카테고리"에서 "메뉴"로 변경되고, 검색 버튼이 제거되었습니다.
    • 하단 바에서 메뉴 클릭 시 항상 해당 경로로 이동하도록 동작이 단순화되었습니다.

@xaexunxang xaexunxang requested review from Yejiin21 and hyeeuncho June 7, 2025 20:40
@xaexunxang xaexunxang linked an issue Jun 7, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 7, 2025

"""

Walkthrough

이 변경사항은 이벤트 리스트의 빈 목록 메시지의 한국어 표현 개선, 메뉴 버튼 데이터의 동적 생성 및 로그인 상태에 따른 로그아웃 버튼 표시, 메인 페이지 헤더의 새로고침 기능 추가, 메뉴 페이지 헤더의 UI 단순화, 그리고 바텀바의 네비게이션 로직 단순화가 포함되어 있습니다.

Changes

파일/그룹 변경 요약
src/features/event/ui/EventList.tsx 카테고리별 한국어 매핑 상수 추가 및 빈 이벤트 메시지 문구 개선
src/pages/home/ui/MainPage.tsx handleRefresh 함수 추가 및 헤더 좌측 버튼에 새로고침 기능 적용
src/pages/menu/ui/MenuPage.tsx 정적 buttonData → 동적 getButtonData 함수로 변경, 헤더 UI 단순화
src/shared/types/menuType.ts buttonData 상수 → 로그인 상태 반영하는 getButtonData 함수로 변경
src/widgets/main/ui/BottomBar.tsx onClick 시 항상 해당 경로로 이동하도록 네비게이션 로직 단순화

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Header
    participant MainPage

    User->>Header: 좌측 "같이가요" 버튼 클릭
    Header->>MainPage: leftButtonClick 호출 (handleRefresh)
    alt 현재 경로가 '/'
        MainPage->>Browser: window.location.reload()
    else
        MainPage->>MainPage: navigate('/')
    end
Loading
sequenceDiagram
    participant MenuPage
    participant AuthStore

    MenuPage->>AuthStore: isLoggedIn 상태 조회
    MenuPage->>MenuPage: getButtonData() 호출
    MenuPage->>MenuPage: 버튼 목록 생성 (로그인 여부에 따라 로그아웃 버튼 포함)
    MenuPage->>UI: 버튼 렌더링
Loading

Suggested labels

🪄 Refactoring

Poem

🐰
오늘도 메뉴가 달라졌네,
로그인하면 로그아웃 버튼도 생기네!
이벤트 메시지도 한글로 똑똑,
헤더 버튼 누르면 새로고침 뾱!
바텀바도 길 잃지 않고,
변화 속에 토끼는 신나게 뛰놀아요!
🥕
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c04f80a and dfa4faf.

📒 Files selected for processing (5)
  • src/features/event/ui/EventList.tsx (2 hunks)
  • src/pages/home/ui/MainPage.tsx (2 hunks)
  • src/pages/menu/ui/MenuPage.tsx (2 hunks)
  • src/shared/types/menuType.ts (2 hunks)
  • src/widgets/main/ui/BottomBar.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/pages/menu/ui/MenuPage.tsx
  • src/widgets/main/ui/BottomBar.tsx
  • src/shared/types/menuType.ts
  • src/features/event/ui/EventList.tsx
  • src/pages/home/ui/MainPage.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: storybook
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai 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

Documentation and Community

  • 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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 7, 2025

Copy link
Copy Markdown

@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: 1

🧹 Nitpick comments (1)
src/shared/types/menuType.ts (1)

20-38: 동적 메뉴 데이터 생성 로직이 잘 구현되었습니다

로그인 상태에 따라 메뉴 버튼을 조건부로 표시하는 로직이 올바르게 구현되었습니다. 기본 버튼들은 항상 표시되고, 로그인된 사용자에게만 로그아웃 버튼이 추가되는 구조가 적절합니다.

다만 성능 최적화를 고려해볼 수 있습니다.

선택적 개선사항: 메모이제이션 고려

이 함수가 자주 호출되는 경우 성능 최적화를 위해 메모이제이션을 고려해볼 수 있습니다:

+import { useMemo } from 'react';

export const getButtonData = (): buttonData[] => {
-  const isLoggedIn = useAuthStore.getState().isLoggedIn;
+  return useMemo(() => {
+    const isLoggedIn = useAuthStore.getState().isLoggedIn;
    
    const baseButtons: buttonData[] = [
      { iconPath: Ticket, hoverIconPath: SelectedTicket, label: '구입한 티켓', path: '/menu/myTicket' },
      { iconPath: Host, hoverIconPath: SelectedHost, label: '내 호스트', path: '/menu/myHost' },
      { iconPath: Event, hoverIconPath: SelectedEvent, label: '이벤트 주최하기', path: '/event-creation' },
      { iconPath: Setting, hoverIconPath: SelectedSetting, label: '마이페이지', path: '/menu/myPage' },
    ];

    if (isLoggedIn) {
      return [
        ...baseButtons,
        { iconPath: Logout, hoverIconPath: SelectedLogout, label: '로그아웃', path: '/menu/logout' },
      ];
    }

    return baseButtons;
+  }, [useAuthStore.getState().isLoggedIn]);
};
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 399a5ff and a22e9df.

📒 Files selected for processing (5)
  • src/features/event/ui/EventList.tsx (2 hunks)
  • src/pages/home/ui/MainPage.tsx (2 hunks)
  • src/pages/menu/ui/MenuPage.tsx (2 hunks)
  • src/shared/types/menuType.ts (2 hunks)
  • src/widgets/main/ui/BottomBar.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/pages/menu/ui/MenuPage.tsx (1)
src/shared/types/menuType.ts (2)
  • buttonData (13-18)
  • getButtonData (20-38)
src/features/event/ui/EventList.tsx (1)
src/shared/types/baseEventType.ts (1)
  • CategoryType (2-2)
src/shared/types/menuType.ts (1)
src/app/provider/authStore.ts (1)
  • useAuthStore (17-36)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: storybook
🔇 Additional comments (8)
src/features/event/ui/EventList.tsx (3)

19-24: 타입 안전성이 보장된 카테고리 매핑이 잘 구현되었습니다.

CategoryType의 모든 값에 대한 매핑이 완전히 정의되어 있어 타입 안전성이 보장됩니다. 한국어 번역도 적절합니다.


68-68: 메시지 텍스트 개선이 적절합니다.

"생성된 이벤트가 없습니다"에서 "열린 이벤트가 없습니다"로 변경하여 사용자에게 더 직관적인 메시지를 제공합니다.


70-70: 동적 카테고리 메시지가 잘 구현되었습니다.

카테고리별로 한국어 이름을 포함한 메시지를 표시하도록 개선되었습니다. categoryToKorean[category] 접근 시 타입 안전성도 보장됩니다.

src/pages/home/ui/MainPage.tsx (1)

46-46: 로고 클릭 기능이 올바르게 연결되었습니다.

handleRefresh 함수가 leftButtonClick 프로퍼티에 올바르게 할당되어 로고 클릭 시 새로고침 기능이 구현되었습니다.

src/widgets/main/ui/BottomBar.tsx (1)

13-13: 네비게이션 로직 단순화가 적절합니다.

복잡한 조건부 뒤로가기 로직을 제거하고 항상 직접 네비게이션하도록 변경한 것은 코드를 더 예측 가능하고 이해하기 쉽게 만듭니다. 이는 일반적인 하단 네비게이션 바의 표준 동작과도 일치합니다.

src/pages/menu/ui/MenuPage.tsx (2)

5-5: 동적 메뉴 버튼 생성이 잘 구현되었습니다.

getButtonData() 함수를 사용하여 로그인 상태에 따라 로그아웃 버튼을 동적으로 표시하는 기능이 적절히 구현되었습니다. 이는 사용자 상태에 따른 적응형 UI를 제공합니다.

Also applies to: 14-14


18-18: 헤더 텍스트 변경이 적절합니다.

"카테고리"에서 "메뉴"로 변경하여 페이지의 실제 기능과 더 일치하는 명칭을 사용하게 되었습니다. 메뉴 페이지에는 카테고리뿐만 아니라 다양한 기능들이 포함되어 있으므로 "메뉴"가 더 적절한 표현입니다.

src/shared/types/menuType.ts (1)

11-11: import 추가 확인됨

인증 스토어 import가 올바르게 추가되었습니다.

Copy link
Copy Markdown
Contributor

@Yejiin21 Yejiin21 left a comment

Choose a reason for hiding this comment

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

리팩토링 하느라 고생하셨습니다

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 8, 2025

@xaexunxang xaexunxang force-pushed the refact/#168/mainPage-refactoring branch from c04f80a to dfa4faf Compare June 8, 2025 08:44
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 8, 2025

@xaexunxang xaexunxang merged commit 6a47e5c into develop Jun 8, 2025
2 checks passed
@xaexunxang xaexunxang deleted the refact/#168/mainPage-refactoring branch June 8, 2025 08:46
@xaexunxang xaexunxang self-assigned this Jun 8, 2025
@xaexunxang xaexunxang added the 🪄 Refactoring 코드 리팩토링 label Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪄 Refactoring 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] 메인 페이지 리팩토링

2 participants