Skip to content

Conversation

six-standard
Copy link
Member

@six-standard six-standard commented Mar 10, 2025

스크린샷 2025-03-10 오후 10 53 44

이전에 자체제작한 트래커를 제거하고, 눈을 여러 번 옮겨야 했던 폴더 구조를 변경하였습니다.
(페이지 폴더 내부에 해당 페이지에만 쓰이는 컴포넌트 추가)

Summary by CodeRabbit

  • Refactor

    • 레이아웃 렌더링과 에러 처리 로직을 개선해 보다 빠르고 안정적인 사용자 경험을 제공합니다.
    • 불필요한 이벤트 추적 기능을 제거해 인터페이스 일관성을 유지했습니다.
  • Chore

    • 테스트 및 컴포넌트 임포트 경로 등 내부 구조를 정리해 코드 유지 보수성을 향상시켰습니다.
    • 페이지 메타데이터 형식을 간소화해 구성의 일관성을 높였습니다.

Copy link

Copy link

coderabbitai bot commented Mar 10, 2025

Walkthrough

본 PR은 코드 리팩토링 작업의 일환으로, 테스트 파일과 여러 컴포넌트의 import 경로를 단순화하고, 불필요한 이벤트 트래킹 관련 코드와 관련 import들을 제거하였습니다. 또한, 일부 컴포넌트의 metadata 포맷을 단일 라인으로 변환하고, 레이아웃 컴포넌트와 관련된 import 순서 및 구조를 개선하였습니다. 더불어, 재수출용 인덱스 파일과 사용자 추적 기능이 포함된 파일이 삭제되었습니다.

Changes

파일 경로 변경 요약
src/__test__/login.test.tsx, src/__test__/main.test.tsx (with-tracker) 디렉토리 제거 및 import 경로 단순화
src/app/(auth-required)/compare/page.tsx, src/app/(login)/page.tsx metadata 선언을 멀티라인에서 단일 라인 포맷으로 변경
src/app/(auth-required)/components/header/Section.tsx, src/app/(auth-required)/components/header/index.tsx, src/app/(auth-required)/leaderboards/Content.tsx, src/app/(auth-required)/main/components/Section/index.tsx, src/app/(auth-required)/main/components/Summary/index.tsx, src/app/(login)/Content.tsx 이벤트 트래킹 관련 import 및 함수 호출 제거, onClick 핸들러 간소화
src/app/(auth-required)/layout.tsx, src/app/layout.tsx import 재배치 및 코드 포맷 정리, 레이아웃 컴포넌트 구조 개선
src/app/(auth-required)/leaderboards/components/Rank.tsx IProp 타입 import 경로 변경
src/components/Input.tsx ref 파라미터 타입에서 undefined 허용 제거
src/components/Providers/index.ts ChannelTalkProvider, QueryProvider export 추가
src/components/auth-required/index.ts, src/components/common/index.ts 중앙 재수출 파일 삭제 (직접 import 필요)
src/components/index.ts 기존 재수출 제거, 새로운 개별 컴포넌트 export 추가
src/utils/trackUtil.tsx 사용자 이벤트 및 방문 추적 관련 코드 전체 삭제

Sequence Diagram(s)

sequenceDiagram
    participant Client as 사용자
    participant Layout as RootLayout
    participant EB as ErrorBoundary
    participant Suspense as Suspense Wrapper
    participant Child as 자식 컴포넌트

    Client->>Layout: 앱 요청
    Layout->>EB: ErrorBoundary 적용
    EB->>Suspense: Suspense로 자식 감싸기
    Suspense->>Child: 자식 컴포넌트 렌더링
Loading
sequenceDiagram
    participant User as 사용자
    participant Login as Login 컴포넌트
    participant API as 인증 API

    User->>Login: 로그인 정보 입력
    Login->>API: 인증 요청 (useMutation)
    API-->>Login: 응답 수신
    Login->>Login: onSuccess 처리 후 replace 호출
Loading

Possibly related PRs

Suggested labels

enhancement, bug

Suggested reviewers

  • Nuung
  • HA0N1

Poem

토끼가 속삭여, 코드 숲에 봄이 오네,
간결한 경로에 햇살이 비추고,
이벤트는 사라지고, 변화가 춤추네,
깔끔한 코드 가락, 마음을 울리네,
개발의 숲 속에서 나는 노래하네 🐰

✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

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 (1)
src/app/(auth-required)/main/Content.tsx (1)

6-7: 컴포넌트 임포트 경로가 개선되었습니다.

공용 컴포넌트는 '@/components'에서 가져오고 페이지별 컴포넌트는 './components'에서 가져오도록 변경되었습니다. 이는 폴더 구조 정리 목적에 부합합니다.

다만, ESLint에서 임포트 순서 관련 경고가 있습니다. './components' 임포트가 '@/types' 임포트 이후에 와야 합니다.

-import { Button, Dropdown, Check } from '@/components';
-import { Section, Summary } from './components';
+import { Button, Dropdown, Check } from '@/components';
import { postList, postSummary } from '@/apis';
import { PATHS, SORT_TYPE } from '@/constants';
import { useSearchParam } from '@/hooks/useSearchParam';
import { SortKey, SortValue } from '@/types';
+import { Section, Summary } from './components';
🧰 Tools
🪛 ESLint

[error] 7-7: ./components import should occur after import of @/types

(import/order)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 60486b0 and 94e4e2f.

⛔ Files ignored due to path filters (6)
  • src/components/Icon/icons/Analytics.svg is excluded by !**/*.svg
  • src/components/Icon/icons/Arrow.svg is excluded by !**/*.svg
  • src/components/Icon/icons/Compare.svg is excluded by !**/*.svg
  • src/components/Icon/icons/Leaderboards.svg is excluded by !**/*.svg
  • src/components/Icon/icons/Like.svg is excluded by !**/*.svg
  • src/components/Icon/icons/Shortcut.svg is excluded by !**/*.svg
📒 Files selected for processing (21)
  • src/__test__/login.test.tsx (1 hunks)
  • src/__test__/main.test.tsx (1 hunks)
  • src/app/(auth-required)/compare/page.tsx (1 hunks)
  • src/app/(auth-required)/components/header/Section.tsx (0 hunks)
  • src/app/(auth-required)/components/header/index.tsx (2 hunks)
  • src/app/(auth-required)/layout.tsx (2 hunks)
  • src/app/(auth-required)/leaderboards/Content.tsx (2 hunks)
  • src/app/(auth-required)/leaderboards/components/Rank.tsx (1 hunks)
  • src/app/(auth-required)/main/Content.tsx (3 hunks)
  • src/app/(auth-required)/main/components/Section/index.tsx (1 hunks)
  • src/app/(auth-required)/main/components/Summary/index.tsx (1 hunks)
  • src/app/(login)/Content.tsx (1 hunks)
  • src/app/(login)/page.tsx (1 hunks)
  • src/app/(with-tracker)/layout.tsx (0 hunks)
  • src/app/layout.tsx (3 hunks)
  • src/components/Input.tsx (1 hunks)
  • src/components/Providers/index.ts (1 hunks)
  • src/components/auth-required/index.ts (0 hunks)
  • src/components/common/index.ts (0 hunks)
  • src/components/index.ts (1 hunks)
  • src/utils/trackUtil.tsx (0 hunks)
💤 Files with no reviewable changes (5)
  • src/app/(auth-required)/components/header/Section.tsx
  • src/components/common/index.ts
  • src/components/auth-required/index.ts
  • src/utils/trackUtil.tsx
  • src/app/(with-tracker)/layout.tsx
🧰 Additional context used
🪛 ESLint
src/app/(auth-required)/main/Content.tsx

[error] 7-7: ./components import should occur after import of @/types

(import/order)

🔇 Additional comments (29)
src/app/(auth-required)/leaderboards/components/Rank.tsx (2)

1-1: 수정된 Import 경로 확인

변경된 import 경로(../../../../components/auth-required/leaderboards/Ranker)가 의도한 모듈 위치를 정확히 가리키는지 확인해주세요. 폴더 구조 재조직에 따른 변경으로 보이며, 다른 관련 파일에서도 동일한 패턴의 경로 사용 및 일관성이 유지되는지 점검해볼 필요가 있습니다.


3-18: Rank 컴포넌트 검토

컴포넌트 내부의 JSX와 로직은 문제없이 잘 구성되어 있습니다. 다만, 스타일 클래스 네이밍과 관련된 부분이 조직의 UI 가이드라인과 부합하는지 추가로 확인해보면 좋겠습니다.

src/components/Providers/index.ts (1)

1-2: Provider 컴포넌트 재사출 구현 완료

이 변경사항을 통해 ChannelTalkProviderQueryProvider를 중앙에서 재사출하는 구조가 잘 구현되었습니다. 이는 폴더 구조 정리 목표에 부합하며, 컴포넌트 접근성을 향상시킵니다.

src/app/(auth-required)/main/components/Section/index.tsx (1)

24-24: 트래커 기능 성공적으로 제거

이전에 존재했던 트래킹 기능을 제거하고 상태 변경 로직만 남겨 코드가 간결해졌습니다. PR 목표인 트래커 제거 작업이 성공적으로 이루어졌습니다.

src/app/(auth-required)/main/components/Summary/index.tsx (1)

39-39: 트래커 호출 코드 제거 완료

요약 정보 섹션의 클릭 이벤트에서 트래킹 관련 코드가 제거되어 더 간결하고 명확한 상태 관리 로직만 남았습니다. PR 목표에 맞게 트래커 제거가 잘 적용되었습니다.

src/app/(login)/page.tsx (1)

4-4: 메타데이터 포맷 개선

여러 줄로 선언되어 있던 메타데이터를 한 줄로 변경하여 코드의 일관성을 유지하였습니다. 작은 변화지만 전체 코드베이스의 통일성 측면에서 좋은 개선입니다.

src/app/(auth-required)/compare/page.tsx (1)

4-4: Metadata 선언부 개선됨

코드 포맷팅이 개선되어 가독성이 향상되었습니다. 메타데이터 선언을 단일 라인으로 변경한 것은 코드베이스 전체의 일관성을 유지하는 데 도움이 됩니다.

src/components/Input.tsx (1)

18-18: 타입 정의 간소화 적용됨

불필요한 | undefined 표현이 제거되었습니다. 선택적 매개변수(?)가 이미 undefined 가능성을 내포하고 있으므로, 이 변경은 타입 정의를 더 간결하게 만듭니다.

src/__test__/login.test.tsx (1)

6-6: 트래커 경로 제거 완료

(with-tracker) 세그먼트가 import 경로에서 제거되었습니다. 이는 PR 목표인 트래커 제거 및 폴더 구조 정리와 일치합니다. 테스트가 정상적으로 작동하는지 확인해 주세요.

src/__test__/main.test.tsx (1)

3-3: 트래커 경로 제거 완료

(with-tracker) 세그먼트가 import 경로에서 제거되었습니다. 이는 PR 목표인 트래커 제거 및 폴더 구조 정리와 일치합니다. 경로 변경 후 테스트가 정상적으로 작동하는지 확인하세요.

src/app/(auth-required)/main/Content.tsx (2)

63-65: 이벤트 추적 코드가 제거되었습니다.

새로고침 버튼의 클릭 이벤트 추적 기능이 제거되었습니다. 이는 PR 목적인 '트래커 제거'에 부합합니다.


87-89: 정렬 이벤트 추적 코드가 제거되었습니다.

드롭다운 변경 시 추적 기능이 제거되었습니다. 이는 PR 목적인 '트래커 제거'에 부합합니다.

src/app/(auth-required)/layout.tsx (2)

2-6: 임포트 구조가 개선되었습니다.

임포트 순서가 재배열되고 Header 컴포넌트의 임포트 경로가 명확해졌습니다. 이는 폴더 구조 정리 목적에 부합합니다.


15-15: prefetchQuery 메서드 호출이 한 줄로 간소화되었습니다.

여러 줄로 작성되었던 prefetchQuery 메서드 호출이 한 줄로 간소화되어 가독성이 향상되었습니다.

src/app/(auth-required)/components/header/index.tsx (2)

3-7: 임포트 순서가 재배열되었습니다.

React 관련 임포트와 내부 유틸리티 함수 임포트의 순서가 재배열되었습니다. 이는 폴더 구조 정리 목적에 부합합니다.


122-122: 로그아웃 버튼의 이벤트 추적 코드가 제거되었습니다.

로그아웃 버튼 클릭 시 호출되던 추적 이벤트가 제거되었습니다. 이는 PR 목적인 '트래커 제거'에 부합합니다.

src/app/(login)/Content.tsx (2)

3-9: 임포트 순서가 개선되었습니다.

useMutation과 LoginVo 임포트의 위치가 재조정되었습니다. 이는 일관된 코드 구조를 위한 변경으로 보입니다.


23-25: 로그인 성공 시 이벤트 추적 코드가 제거되었습니다.

onSuccess 함수에서 이벤트 추적 코드가 제거되었습니다. 이는 PR 목적인 '트래커 제거'에 부합합니다.

src/components/index.ts (1)

1-7: 컴포넌트 export 구조 개선

폴더 구조 정리 작업에 맞게 컴포넌트 export 구조가 단순화되었습니다. 이전의 집합적 export (auth-required, common)에서 각 컴포넌트를 직접 export하는 방식으로 변경되어 컴포넌트의 임포트 경로가 더 명확해졌습니다.

src/app/(auth-required)/leaderboards/Content.tsx (3)

3-4: 불필요한 import 정리

import 문이 깔끔하게 정리되었습니다.


7-7: 컴포넌트 import 경로 변경

폴더 구조 정리 작업의 일환으로 RankerRank 컴포넌트를 로컬 ./components 디렉토리에서 임포트하도록 변경되었습니다. 이는 컴포넌트 접근성을 향상시키고 관련 컴포넌트를 더 논리적으로 그룹화하는 데 도움이 됩니다.


29-29: 트래커 제거

이벤트 추적 코드(trackUserEvent(MessageEnum.SORT_INTERACT_BOARD))가 제거되어 onChange 함수가 간결해졌습니다. PR의 목표인 트래커 제거 작업이 잘 수행되었습니다.

src/app/layout.tsx (7)

1-1: import 순서 정리

GoogleAnalytics import가 최상단으로 이동되었습니다.


5-6: import 최적화 및 Suspense 추가

Sentry import를 네임스페이스 import에서 명시적 import로 변경하고, React의 Suspense 컴포넌트를 추가했습니다. 이는 코드의 가독성을 높이고 비동기 렌더링을 더 효과적으로 처리할 수 있게 해줍니다.


10-10: 글로벌 CSS import 위치 변경

글로벌 CSS import 위치가 적절하게 조정되었습니다.


19-19: 메타데이터 포맷 개선

alternates 속성이 단일 라인으로 단순화되어 코드의 일관성과 가독성이 향상되었습니다.


38-38: ErrorBoundary 사용 간소화

네임스페이스를 통한 접근 대신 직접 ErrorBoundary 컴포넌트를 사용하여 코드가 더 간결해졌습니다.


42-42: Suspense로 children 래핑

children을 Suspense로 래핑하여 비동기 컴포넌트 로딩을 지원합니다. 이는 성능 최적화와 로딩 상태 관리에 도움이 됩니다.


45-45: 닫는 태그 정리

ErrorBoundary 닫는 태그가 올바르게 정렬되었습니다.

@six-standard six-standard self-assigned this Mar 11, 2025
@six-standard six-standard added the enhancement New feature or request label Mar 11, 2025
Copy link

@Jihyun3478 Jihyun3478 left a comment

Choose a reason for hiding this comment

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

좋았던 점

  • 폴더 정리가 이번 PR의 이벤트인 것 같아 다른 의견은 없습니다!

PS. 확실히 폴더 정리가 눈이 조금이나마 편해지는 지름길인 것 같아요!🤔

Copy link
Member

@Nuung Nuung left a comment

Choose a reason for hiding this comment

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

ㅋㅋㅋ이야... 이건 리펙토링이라 어떻게 피드백이 어렵네요. 대부분이 삭제라 :0
API 쪽도 똑같이 대응 개발 한 뒤에 배포해야 할 것 같은데!

@six-standard
Copy link
Member Author

ㅋㅋㅋ이야... 이건 리펙토링이라 어떻게 피드백이 어렵네요. 대부분이 삭제라 :0 API 쪽도 똑같이 대응 개발 한 뒤에 배포해야 할 것 같은데!

대응 개발이라기엔 어차피 지금까지 트래커를 활성화한 적이 없어서, 천천히 제거하셔도 괜찮을 듯 합니다~

Copy link

@cheonHwi cheonHwi left a comment

Choose a reason for hiding this comment

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

저도 이번 PR은 미사용하던 기능 정리에 대한거라 이견 없습니다~

@six-standard six-standard merged commit e4eb523 into main Mar 12, 2025
1 check passed
@Nuung Nuung deleted the refactor/tracker_removal branch March 15, 2025 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants