Skip to content

[chore/feature] PR #14 Cherry-pick 🍒 #17

Closed
cl-o-lc wants to merge 8 commits intomainfrom
feature/reapply-reaction-ranking
Closed

[chore/feature] PR #14 Cherry-pick 🍒 #17
cl-o-lc wants to merge 8 commits intomainfrom
feature/reapply-reaction-ranking

Conversation

@cl-o-lc
Copy link
Collaborator

@cl-o-lc cl-o-lc commented Oct 11, 2025

📌 작업 내용

📝 기타

Summary by CodeRabbit

  • 신기능
    • 반응속도 테스트에 서버 기반 순위 표시 추가: 내 순위와 주변 순위 확인 가능
    • 기록 저장 후 순위 자동 갱신 및 신규 최고기록 알림 지원
  • 버그 수정
    • 로그인/로그아웃 처리 안정성 및 토큰 관리 신뢰성 개선
  • 문서
    • FAQ 내용 업데이트: 반응 시간 변동 설명을 시각적 반응 한계 관점으로 정정
  • 작업
    • 개발 환경 타입 정의 업데이트(React, React DOM). 기능 변화 없음

(cherry picked from commit fdcab03)
- `현재 기록`: 테스트 실시 결과, 평균 기록
- `내 순위`: 내 주변 순위 표시
- `TOP 10`: 상위 10위권 표시

(cherry picked from commit 96c2d1d)
- 인간의 시각적 반응 한계인 0.1ms를 적용함을 안내

(cherry picked from commit 28b0527)
@cl-o-lc cl-o-lc added feat🛠️ 기능 구현 chore💭 환경 세팅 etc. labels Oct 11, 2025
@vercel
Copy link

vercel bot commented Oct 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
checktime Error Error Oct 11, 2025 3:12pm

@coderabbitai
Copy link

coderabbitai bot commented Oct 11, 2025

Walkthrough

리액션 테스트에 서버 기반 랭킹 연동을 추가하고, 토큰 관리 로직을 AuthUtils로 통합했으며, API 베이스 URL 환경변수를 변경했습니다. 랭킹 조회/저장을 위한 API 모듈을 신설하고, UI는 내 순위/주변 순위를 표시하도록 변경되었습니다. FAQ 문구 수정 및 @types 의존성 버전 상승이 포함됩니다.

Changes

Cohort / File(s) Change Summary
Dev deps bump
package.json
devDependencies에서 @types/react를 ^19.2.2, @types/react-dom을 ^19.2.1로 업데이트.
Reaction Test 랭킹 연동
src/app/reaction-test/page.tsx
랭킹 타입( RankEntry, NearbyRankEntry, MyRankInfo ) 추가. 초기 마운트 시 getTop10Rankings+getNearbyRankings 병렬 로드. 로컬 best 저장 로직 제거. 클릭 시 saveReactionTimeRecord로 기록 저장 후 필요 시 알림 및 랭킹 재조회. UI를 내 순위/주변 순위 표시로 갱신.
Auth/Env 정리
src/components/ClientHeader.tsx
토큰 확인/설정/삭제를 AuthUtils.hasToken/setToken/removeToken으로 대체. 로그인/회원가입 API 베이스를 NEXT_PUBLIC_API_URL로 변경. localStorage의 username 유지.
FAQ 문구 수정
src/components/FaqSection.tsx
FAQ 4번 답변을 인간 시각 반응 한계(0.1 ms) 참조로 갱신. 로직 변경 없음.
랭킹 API 모듈 추가
src/libs/api/reactionRanking.ts
공통 fetchApi 도입(AuthUtils.getAuthHeaders 사용, NEXT_PUBLIC_API_URL 기본). saveReactionTimeRecord, getNearbyRankings, getTop10Rankings 공개 함수 추가. 비정상 응답 시 예외 발생 처리.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as 사용자
  participant Page as ReactionTest Page
  participant API as reactionRanking API 모듈
  participant BE as 서버(API)

  note over Page: 초기 로드
  Page->>API: getTop10Rankings()
  par 병렬 조회
    API->>BE: GET /refresh-records/stats
    API->>BE: GET /refresh-records/nearby?range=...
  end
  BE-->>API: 랭킹 데이터
  API-->>Page: Top10, Nearby, MyRankInfo
  Page->>Page: 상태 업데이트 및 렌더

  note over User,Page: 반응 테스트 진행
  User->>Page: 원 클릭(결과 확정)
  Page->>API: saveReactionTimeRecord(rt)
  API->>BE: POST /refresh-records { refreshTime: rt }
  BE-->>API: 저장 결과(JSON)
  API-->>Page: 저장 결과
  alt 성공
    Page->>API: getTop10Rankings() + getNearbyRankings()
    API->>BE: GET /stats & GET /nearby
    BE-->>API: 최신 랭킹
    API-->>Page: 최신 랭킹
    Page->>Page: 상태 갱신/알림
  else 실패
    Page->>Page: 오류 처리(알림 등)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

refactor🪄

Poem

꼬박꼬박 탁— 반응을 잴 때
순위표에 점프! 내 점수는 몇 점?
토큰은 깔끔, AuthUtils에 맡기고
서버에 톡— 기록은 안착!
오늘의 토끼는 상위권 꿈꾸며 (•̀ᴗ•́)و
당근 하나 물고 랭킹을 훌쩍! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive 제목이 ‘체리픽’이라는 단어와 PR 번호만을 언급하고 있어 실제 변경된 기능이나 목적을 전달하지 못하므로 PR의 주요 내용을 이해하기 어렵습니다. 제목을 이번 PR에서 추가되거나 수정된 핵심 기능(예: 랭킹 데이터 로딩, 환경변수 설정) 위주로 간결하게 서술해 주세요.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed 설명에 작업 내용과 기타 섹션이 명확히 포함되어 체리픽 적용과 Vercel 환경변수 추가라는 주요 변경사항을 잘 전달하고 있어 템플릿의 핵심 요구사항을 충족합니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/reapply-reaction-ranking

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@cl-o-lc cl-o-lc changed the title [chore/feature] PR#15 Cherry-pick 🍒 [chore/feature] PR #14 Cherry-pick 🍒 Oct 11, 2025
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: 2

🧹 Nitpick comments (3)
src/components/ClientHeader.tsx (1)

34-34: 선택사항: userName 관리도 AuthUtils로 통합하는 것을 고려해 보세요.

현재 userName은 여전히 직접 localStorage를 통해 관리되고 있습니다. 일관성을 위해 AuthUtilsgetUserName(), setUserName() 같은 메서드를 추가하여 통합하는 것을 고려해볼 수 있습니다.

Also applies to: 42-42, 72-72

src/app/reaction-test/page.tsx (2)

53-53: 선택사항: 하드코딩된 range 값을 상수로 추출하는 것을 고려해 보세요.

현재 getNearbyRankings(5)에서 5가 하드코딩되어 있습니다. 이를 파일 상단에 const NEARBY_RANGE = 5; 같은 상수로 추출하면 유지보수가 더 쉬워집니다.

+const NEARBY_RANGE = 5; // 내 주변 순위 조회 범위
+
 export default function Page() {
   ...
   const fetchAllRankings = async () => {
     try {
       const [top10Res, nearbyRes] = await Promise.all([
         getTop10Rankings(),
-        getNearbyRankings(5), // 내 주변 5명 조회
+        getNearbyRankings(NEARBY_RANGE),
       ]);

294-325: 주석처리된 TOP 10 코드를 정리해 주세요.

TOP 10 랭킹 섹션이 주석처리되어 있습니다. 이 기능이 필요하다면 주석을 해제하고, 필요하지 않다면 코드를 삭제하는 것이 좋습니다. 큰 주석 블록은 코드 가독성을 해칩니다.

다음 중 하나를 선택하세요:

  1. 기능이 필요하다면 주석을 해제하고 활성화
  2. 필요하지 않다면 완전히 제거
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f32896a and 9b1385b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • package.json (1 hunks)
  • src/app/reaction-test/page.tsx (5 hunks)
  • src/components/ClientHeader.tsx (5 hunks)
  • src/components/FaqSection.tsx (1 hunks)
  • src/libs/api/reactionRanking.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
src/components/ClientHeader.tsx (1)
src/libs/auth.ts (1)
  • AuthUtils (3-37)
src/libs/api/reactionRanking.ts (1)
src/libs/auth.ts (1)
  • AuthUtils (3-37)
src/app/reaction-test/page.tsx (1)
src/libs/api/reactionRanking.ts (3)
  • getTop10Rankings (51-55)
  • getNearbyRankings (39-46)
  • saveReactionTimeRecord (28-33)
🔇 Additional comments (7)
src/components/ClientHeader.tsx (2)

9-9: 좋은 리팩토링입니다!

AuthUtils를 사용하여 토큰 관리를 중앙화한 것은 좋은 개선입니다. 코드의 일관성과 유지보수성이 향상되었습니다.

Also applies to: 32-32, 67-67, 116-116


58-62: API URL 환경 변수 변경을 확인해 주세요.

NEXT_PUBLIC_API_BASE에서 NEXT_PUBLIC_API_URL로 변경되었습니다. Vercel 환경 변수 설정에서 이 값이 올바르게 구성되었는지 확인해 주세요.

Also applies to: 94-94

src/libs/api/reactionRanking.ts (1)

7-22: 좋은 API 추상화입니다!

중앙화된 fetchApi 헬퍼 함수로 인증 헤더 처리와 에러 핸들링을 일관되게 관리하는 것은 좋은 패턴입니다.

src/app/reaction-test/page.tsx (3)

15-34: 인터페이스 정의가 잘 되어 있습니다!

랭킹 데이터를 위한 타입 정의가 명확하게 되어 있어 타입 안정성이 확보됩니다.


49-66: 비동기 데이터 로딩이 잘 구현되었습니다!

Promise.all을 사용하여 두 API를 병렬로 호출하는 것은 성능 최적화 관점에서 좋은 접근입니다. 에러 처리도 적절히 되어 있습니다.


99-128: 서버 기반 기록 저장이 잘 구현되었습니다!

비동기 기록 저장과 랭킹 갱신 로직이 적절히 구현되어 있으며, 새로운 최고 기록 알림도 사용자 경험을 향상시킵니다. 에러 처리도 잘 되어 있습니다.

package.json (1)

22-23: 버전 유효성 확인 완료 및 보안 이슈 없음

@types/react@19.2.2@types/react-dom@19.2.1은 npm에 정상 배포된 유효한 버전이며, 현재 보고된 보안 이슈가 없습니다. 프로젝트의 react/react-dom peerDependencies와 호환 여부만 함께 점검해 주세요.

question: '알림 기능은 어떠한 원리로 작동하나요?',
answer:
'체크타임의 알림 기능은 url 서버 시간에 rtt(왕복 시간)과 사용자 반응속도 기록을 반영하여 최적의 타이밍에 알림을 제공합니다.',
'체크타임의 알림 기능은 url 서버 시간에 rtt(왕복 시간)과 인간의 시각적 반응 한계(0.1 ms)를 반영하여, 최적의 타이밍에 알림을 제공합니다.',
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

인간의 시각적 반응 한계 수치를 확인해 주세요.

FAQ 답변에서 "인간의 시각적 반응 한계(0.1 ms)"로 표기되어 있는데, 일반적으로 인간의 시각적 반응 시간은 200-250ms 정도입니다. 0.1ms는 너무 빠른 수치로 보입니다. 실제로 의도한 값이 0.1초(100ms) 또는 다른 값인지 확인이 필요합니다.

🤖 Prompt for AI Agents
In src/components/FaqSection.tsx around line 29, the FAQ text claims "인간의 시각적 반응
한계(0.1 ms)" which is incorrect—human visual reaction time is ~200–250 ms and 0.1
ms is implausible; confirm whether the intended value was 0.1초 (100 ms) or
another value and update the string to the correct unit and magnitude (e.g.,
"인간의 시각적 반응 한계(100 ms)" or the agreed-upon value), and if this value is used
elsewhere ensure associated calculations/labels are adjusted consistently.

* @param range 조회할 순위 범위
*/
export const getNearbyRankings = (range: number) => {
alert(`getNearbyRankings 함수 실행! Range: ${range}`); // 👈 이 줄을 추가!
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

프로덕션 코드에서 디버그 alert를 제거해야 합니다.

getNearbyRankings 함수 내부에 디버그용 alert가 남아있습니다. 이는 사용자 경험을 해치므로 프로덕션 배포 전에 반드시 제거해야 합니다.

다음과 같이 디버그 코드를 제거하세요:

 export const getNearbyRankings = (range: number) => {
-  alert(`getNearbyRankings 함수 실행! Range: ${range}`); // 👈 이 줄을 추가!
-
   // 템플릿 리터럴을 사용해 range 쿼리 파라미터를 추가합니다.
   return fetchApi(`/refresh-records/nearby?range=${range}`, {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
alert(`getNearbyRankings 함수 실행! Range: ${range}`); // 👈 이 줄을 추가!
export const getNearbyRankings = (range: number) => {
// 템플릿 리터럴을 사용해 range 쿼리 파라미터를 추가합니다.
return fetchApi(`/refresh-records/nearby?range=${range}`, {
// …
})
}
🤖 Prompt for AI Agents
In src/libs/api/reactionRanking.ts around line 40, there is a leftover debug
alert call (alert(`getNearbyRankings 함수 실행! Range: ${range}`)); remove this
alert from the production code; if you need to keep a non-intrusive trace for
debugging, replace it with a non-blocking mechanism such as console.debug or a
proper logger at debug level, and ensure no other debug popups remain in this
file before committing.

@cl-o-lc cl-o-lc closed this Oct 12, 2025
@cl-o-lc cl-o-lc deleted the feature/reapply-reaction-ranking branch October 12, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore💭 환경 세팅 etc. feat🛠️ 기능 구현

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant