Skip to content
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

Closed
wants to merge 7 commits into from

Conversation

six-standard
Copy link
Member

@six-standard six-standard commented Jan 6, 2025

스크린샷 2025-01-07 오전 2 03 42

작업 내용

리더보드 페이지를 퍼블리싱하였습니다.
또한, 헤더에 로고를 삽입하였습니다.

Summary by CodeRabbit

  • 새로운 기능

    • 리더보드 페이지에 새로운 컴포넌트 추가
    • 헤더 섹션의 탐색 기능 개선
    • 반응형 레이아웃 및 상호작용 개선
  • 버그 수정

    • 드롭다운 컴포넌트의 기본값 처리 로직 강화
  • 스타일

    • 레이아웃 및 UI 요소의 스타일 조정
    • 화면 크기에 따른 반응형 디자인 최적화
  • 리팩토링

    • 컴포넌트 구조 및 타입 정의 최적화

Copy link

coderabbitai bot commented Jan 6, 2025

Walkthrough

이 풀 리퀘스트는 여러 컴포넌트와 파일의 구조를 개선하고 새로운 기능을 추가하는 변경 사항을 포함하고 있습니다. 주요 변경 사항은 레이아웃 컴포넌트 재구성, 리더보드 페이지의 새로운 Content 컴포넌트 도입, 헤더 섹션의 새로운 탐색 컴포넌트 추가, 그리고 일부 타입 및 후크의 세부 조정을 포함합니다.

Changes

파일 변경 요약
src/app/(with-tracker)/(auth-required)/layout.tsx 레이아웃 구조 재조정, 새로운 <div> 추가 및 클래스 조정
src/app/(with-tracker)/(auth-required)/leaderboards/Content.tsx 새로운 리더보드 컨텐츠 컴포넌트 추가
src/app/(with-tracker)/(auth-required)/leaderboards/page.tsx ArriveSoon 컴포넌트를 Content 컴포넌트로 대체
src/components/auth-required/header/Section.tsx 새로운 탐색 섹션 컴포넌트 추가
src/components/auth-required/header/index.tsx 헤더 컴포넌트 구조 및 스타일 수정
src/components/auth-required/leaderboards/* 새로운 랭크 및 랭커 컴포넌트 추가
src/hooks/useResponsive.ts 디바운스 지연 시간 조정
src/types/* 타입 익스포트 구조 변경

Suggested labels

enhancement

Suggested reviewers

  • BDlhj
  • HA0N1

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?

❤️ 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. (Beta)
  • @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

@six-standard
Copy link
Member Author

바로 머지된다는 점을 깜빡하고 퍼블리싱 하자 마자 PR을 올렸습니다..
새벽에 알림 받으신 분들께 정말 죄송합니다...

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8e29eb5 and e991085.

📒 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 속성 없을 때의 디폴트 처리
clickTypenone일 때 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 반영 로직 검토
usePathnamebarWidth 계산이 적절해 보입니다. 다만, 화면 폭이 극단적으로 더 작은 경우(가령 초소형 디바이스)에도 barWidth가 올바르게 계산되는지 테스트가 필요할 수 있습니다.

Also applies to: 25-25

Comment on lines +14 to +15
{ icon: 'Analytics', title: '내 통계', path: '/main?asc=false&sort=' },
{ icon: 'LeaderBoards', title: '리더보드', path: '/leaderboards?type=views' },
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant