-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[25.01.07 / TASK-82] Feature - 리더보드 페이지 제작 #9
Conversation
Walkthrough이 풀 리퀘스트는 여러 컴포넌트와 파일의 구조를 개선하고 새로운 기능을 추가하는 변경 사항을 포함하고 있습니다. 주요 변경 사항은 레이아웃 컴포넌트 재구성, 리더보드 페이지의 새로운 Changes
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
바로 머지된다는 점을 깜빡하고 퍼블리싱 하자 마자 PR을 올렸습니다.. |
There was a problem hiding this 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 (7)
src/components/auth-required/leaderboards/Rank.tsx (1)
1-18
: 단순하고 명확한 순위 UI 구현
Rank
컴포넌트는 필요한 정보만 효율적으로 표시하고 있어 구조가 간결합니다.suffix
프로퍼티를 통해 단위 표시를 유연하게 처리하는 아이디어도 좋습니다. 다만, 특정 언어나 상황에 따라 ‘회’ 이외의 단위가 다양해질 수 있으니, 국제화 또는 다른 표기 방식을 고려할 여지도 있습니다.src/components/auth-required/leaderboards/Ranker.tsx (2)
1-6
: [제안] 더 명확한 인터페이스 이름 사용 권장
현재 인터페이스 이름이IProp
으로 설정되어 있는데, 컴포넌트나 인터페이스의 역할을 명시적으로 나타내도록RankerProps
처럼 변경하면 가독성과 유지보수에 도움이 됩니다.
8-25
: [검토]rank
타입이 문자열도 가능하도록 설정된 이유 확인 필요
rank
가 일반적으로 숫자로만 사용될 가능성이 높습니다. 문자열 표현도 필요한 경우가 아니라면 숫자 타입으로만 제한하는 편이 안정적입니다.src/app/(with-tracker)/(auth-required)/leaderboards/Content.tsx (1)
20-39
: [제안] 조건문 분기 간소화
width < SCREENS.MBI
/width > SCREENS.MBI
조건이 혼재되어 있는데, 한 곳에서 비교 로직을 추상화하면 더 깔끔하게 유지보수 가능합니다.src/components/auth-required/header/index.tsx (3)
50-62
: 헤더 로고 섹션 추가
여기에 파비콘 이미지를 로드하고 로고 문구를 표시하는 로직은 명확해 보입니다. 접근성 향상을 위해alt
값을 실제 의미 있는 텍스트로 제공하는 것을 고려해 보세요.- alt="" + alt="Velog Dashboard 로고"
63-80
: 탭 이동 인디케이터 구현 검토
동적으로transform
값을 계산해 탭 위치를 표시하는 방식은 유연하고 깔끔합니다. 다만findIndex
결과가 -1일 수 있는 예외 상황(해당 경로가 layouts에 없을 때)을 처리해 주면 안정성이 올라갈 것 같습니다.- transform: `translateX(${layouts.findIndex((i) => i.path.split('?')[0] === path) * barWidth}px)` + const currentIndex = layouts.findIndex( + (i) => i.path.split('?')[0] === path + ); + const safeIndex = currentIndex === -1 ? 0 : currentIndex; + transform: `translateX(${safeIndex * barWidth}px)`
82-94
: 사용자 프로필 메뉴 구현 확인
메뉴 열림/닫힘 상태를 잘 처리하고 있으며,ref
를 활용한 외부 클릭 감지를 통해 UX를 개선하셨습니다.profiles?.username || 'NULL'
대신 빈 문자열이나 다른 표현을 써서 사용자에게 혼란을 주지 않도록 검토해 보세요.- {profiles?.username || 'NULL'} + {profiles?.username || 'Guest'}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
src/app/(with-tracker)/(auth-required)/layout.tsx
(1 hunks)src/app/(with-tracker)/(auth-required)/leaderboards/Content.tsx
(1 hunks)src/app/(with-tracker)/(auth-required)/leaderboards/page.tsx
(1 hunks)src/components/auth-required/header/Section.tsx
(1 hunks)src/components/auth-required/header/index.tsx
(2 hunks)src/components/auth-required/index.ts
(1 hunks)src/components/auth-required/leaderboards/Rank.tsx
(1 hunks)src/components/auth-required/leaderboards/Ranker.tsx
(1 hunks)src/components/auth-required/leaderboards/index.ts
(1 hunks)src/components/auth-required/main/Section/Graph.tsx
(1 hunks)src/components/common/Dropdown.tsx
(1 hunks)src/hooks/useResponsive.ts
(1 hunks)src/types/apis/index.ts
(0 hunks)src/types/index.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- src/types/apis/index.ts
✅ Files skipped from review due to trivial changes (2)
- src/app/(with-tracker)/(auth-required)/leaderboards/page.tsx
- src/components/auth-required/leaderboards/index.ts
🔇 Additional comments (12)
src/types/index.ts (1)
1-2
: 'apis'에서 내보내던 타입들이 제거되었습니다. 다른 모듈에서 해당 타입을 여전히 사용 중인지 확인해주세요.이전에
./apis
에서 export하던 타입과 달리 이번 변경으로./dashboard.type
,./user.type
만 공개 API로 제공됩니다../apis
에서 불러오던 기존 코드가 있다면 문제가 발생할 수 있으므로, 레거시 참조 여부를 점검해 주세요.✅ Verification successful
타입 변경이 안전하게 이루어졌습니다
기존
./apis
의 타입들이./dashboard.type
과./user.type
으로 적절히 이동되었으며, 레거시 참조는 발견되지 않았습니다. 이는 타입 정의를 더 체계적으로 구성하는 긍정적인 리팩토링으로 보입니다.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 'apis' 타입을 참조하던 부분이 남아있는지 검색합니다. rg -A 5 "from\s'.*/apis'"Length of output: 3154
Script:
#!/bin/bash # Type imports from apis 검색 ast-grep --pattern 'import type { $$$ } from $path' | grep -i 'apis' ast-grep --pattern 'import { type $$$ } from $path' | grep -i 'apis' # PostDetailValue 등 apis 관련 타입 참조 검색 rg ":\s*(Post|User|Auth|Api)[A-Za-z]*(\[\]|Value|Type|Interface|Dto)"Length of output: 531
src/components/auth-required/index.ts (1)
1-3
: 모듈 내 파일명 케이스 변경 및 새 모듈 추가 확인
파일명(header
)과 실제 파일 경로가 일치하는지, 또leaderboards
모듈이 정상적으로 내보내지고 있는지 확인해주세요. 현재 구조상 특별한 문제는 없어 보입니다.src/hooks/useResponsive.ts (1)
16-16
: 디바운스 대기 시간 단축 주의
디바운스 시간을 80ms에서 10ms로 줄이면, 창 크기 조절 시 이벤트 콜백이 더 자주 실행되어 CPU 부하가 증가할 수 있습니다. 특히 빈번한 윈도우 리사이즈가 발생하는 환경에서 성능 문제를 야기할 가능성이 있으니, 의도에 맞는지 다시 한번 검토해주세요.src/app/(with-tracker)/(auth-required)/layout.tsx (1)
23-29
: 레이아웃 구조 변경 점검
새로 추가된<div>
래퍼를 통해 내부 콘텐츠에 여유로운 간격(gap)을 적용하는 방식은 가독성을 높여 줍니다. 다만,overflow-hidden
처리가 의도치 않은 스크롤 제거나 콘텐츠 잘림을 유발하지 않는지 확인이 필요합니다.src/components/common/Dropdown.tsx (1)
Line range hint
22-43
: [확인]h-fit
클래스 사용으로 인한 레이아웃 영향
h-fit
을 적용하면 예상치 못한 상위 레이아웃 변화를 유발할 수 있습니다. 실제 화면에서 의도대로 표시되는지 재확인이 필요합니다.src/app/(with-tracker)/(auth-required)/leaderboards/Content.tsx (2)
7-14
: [칭찬] 간단한 더미 데이터 예시가 명확함
data
배열 구조가 직관적이며, 추후 실제 API 연동 시 속성 형식을 맞추기 쉽도록 되어 있습니다.
16-19
: [조언] 컴포넌트 내에서useResponsive
,useSearchParam
훅 사용 시 주의
의존성 배열 등을 잘 처리하고 있는지 확인이 필요합니다. 훅 사용이 적절하지만, 불필요한 렌더링이 없는지 신중히 확인해주세요.src/components/auth-required/header/Section.tsx (2)
13-35
: [칭찬] 유연한 타입 설계
clickType
에 따라 필요한 프로퍼티를 정교하게 나눈 설계가 인상적입니다. 다양한 요구사항을 수용하기에 적합해 보입니다.
36-69
: [검토]icon
속성 없을 때의 디폴트 처리
clickType
이none
일 때icon
을 넘기지 않아도 에러 없이 동작하도록 주의가 필요합니다. 혹은 오류 처리를 추가해 명시적으로 제어하는 방법도 고려하세요.src/components/auth-required/main/Section/Graph.tsx (1)
129-129
: 확장된 인터랙션 옵션 사용에 대한 승인
interaction.intersect = false
설정을 통해 데이터 포인트와 정확히 교차하지 않아도 툴팁이나 이벤트가 트리거될 수 있으므로 사용자 경험이 한층 유연해집니다. 특별한 문제 없이 잘 적용된 수정으로 보입니다.src/components/auth-required/header/index.tsx (2)
7-8
: 임포트 구조 변경 확인
import { PATHS, SCREENS }
와import { defaultStyle, Section, textStyle }
가 명시적으로 분리되어 가독성이 좋아졌습니다. 현재 구조는 문제없이 보이니 그대로 진행하셔도 되겠습니다.Also applies to: 11-11
22-22
: Responsiveness 반영 로직 검토
usePathname
과barWidth
계산이 적절해 보입니다. 다만, 화면 폭이 극단적으로 더 작은 경우(가령 초소형 디바이스)에도barWidth
가 올바르게 계산되는지 테스트가 필요할 수 있습니다.Also applies to: 25-25
{ icon: 'Analytics', title: '내 통계', path: '/main?asc=false&sort=' }, | ||
{ icon: 'LeaderBoards', title: '리더보드', path: '/leaderboards?type=views' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
리더보드 페이지 구현 확인 필요
메인 페이지의 파라미터(/main?asc=false&sort=
)는 정상적으로 구현되어 있으나, 리더보드 페이지(/leaderboards?type=views
)와 관련된 구현이 확인되지 않습니다.
- 리더보드 페이지 구현이 필요하거나
- 올바른 경로로 수정이 필요합니다
🔗 Analysis chain
메뉴 링크 수정 확인
'/main?asc=false&sort='
와 '/leaderboards?type=views'
로 링크 파라미터를 추가하셨는데, 기존에 이 경로를 사용 중인 부분과 충돌이 없는지 재확인이 필요할 수 있습니다.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 경로 변경 사항 확인
# PR에서 'main?asc=false&sort=' 또는 'leaderboards?type=views'를 참조하는 다른 파일이나 코드가 있는지 검색
rg "main\?asc=false|leaderboards\?type=views" -A 5
Length of output: 1078
Script:
#!/bin/bash
# Check for leaderboards page component and parameter handling
ast-grep --pattern 'type = searchParams.get("type")'
rg "searchParams.*type" -A 3
# Check for main page parameter handling
ast-grep --pattern 'asc = searchParams.get("asc")'
rg "searchParams.*(asc|sort)" -A 3
Length of output: 2762
Script:
#!/bin/bash
# Check for leaderboards page implementation
fd leaderboards "src/app" --type f
rg "leaderboards.*type.*views" -A 3
Length of output: 394
작업 내용
리더보드 페이지를 퍼블리싱하였습니다.
또한, 헤더에 로고를 삽입하였습니다.
Summary by CodeRabbit
새로운 기능
버그 수정
스타일
리팩토링