Skip to content

[CHORE] 캘린더 로그 추가#516

Open
rngrhn4114 wants to merge 2 commits intodevelopfrom
chore/calendar-log
Open

[CHORE] 캘린더 로그 추가#516
rngrhn4114 wants to merge 2 commits intodevelopfrom
chore/calendar-log

Conversation

@rngrhn4114
Copy link
Member

@rngrhn4114 rngrhn4114 commented Feb 4, 2026

✅ 체크리스트

  • 코드에 any가 사용되지 않았습니다
  • 스토리북에 추가했습니다 (해당 시)
  • 이슈와 커밋이 명확히 연결되어 있습니다

🔗 관련 이슈

📌 작업 목적

  • 캘린더 로그 추가

🔨 주요 작업 내용

  • page_view: 캘린더 화면 진입 시 로그
  • calendar_date_click: 캘린더 날짜 클릭 시 로그
  • event_card_click: 캘린더 일정 카드 클릭 시 로그

🧪 테스트 방법

✔️ 설치 라이브러리

📷 실행 영상 또는 스크린샷

💬 논의할 점

🙋🏻 참고 자료

Summary by CodeRabbit

  • New Features
    • 캘린더 페이지에 페이지뷰 기반의 분석(트래킹)이 추가되었습니다.
    • 날짜 선택 시 동작을 기록하는 핸들러가 도입되었습니다.
    • 이벤트 카드 클릭을 기록하는 핸들러가 도입되었습니다.
    • 캘린더 컴포넌트에 선택적 콜백(onDateClick, onEventClick)이 추가되어 상호작용 이벤트 감지가 향상되었습니다.

@vercel
Copy link

vercel bot commented Feb 4, 2026

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

Project Deployment Actions Updated (UTC)
surf-admin Ready Ready Preview, Comment Feb 18, 2026 11:05pm
surf-web Error Error Feb 18, 2026 11:05pm

@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

이 변경사항은 캘린더 페이지에 애널리틱스 추적을 추가합니다. 새 상수(CALENDAR_EVENTS, CalendarEventPropsMap)와 도메인 트래커 유틸(trackCalendarEvent)을 도입하고, Calendar 위젯의 public props로 onDateClickonEventClick 콜백을 추가했습니다. CalendarPage에서 페이지 뷰, 날짜 클릭, 이벤트 카드 클릭을 각각 트래킹하도록 핸들러를 구현해 Calendar 컴포넌트에 전달합니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

상세 코드 리뷰 피드백

1. 아키텍처 및 설계 구조

  • 긍정: 관심사 분리(상수, 트래커, UI 핸들러)가 잘 되어 있음. 이벤트 타입 매핑으로 타입 안전성 확보.
  • 권장: trackCalendarEvent 사용 예시와 JSDoc 추가로 소비자에게 의도를 명확히 하세요.
    예:
    /**
     * trackCalendarEvent(event, props)
     * 예: trackCalendarEvent(CALENDAR_EVENTS.PAGE_VIEW, { page_name: 'calendar' })
     */

2. 타입 안전성 및 유효성 검증

  • 문제: 날짜 형식(선택된 날짜)이 어떤 포맷으로 트래킹되는지 불명확합니다.
  • 권장:
    • 포맷을 명시한 유틸(예: ISO 8601 또는 'YYYY-MM-DD')을 도입하고 백엔드/분석팀 규격과 맞추세요.
    • 예:
      const formatDateForTracking = (d: Date) => d.toISOString().split('T')[0]; // YYYY-MM-DD
    • handleEventClick에서 event_id(scheduleId)가 숫자인지 검증하세요.

3. 이벤트 핸들러 구현 안정성

  • Calendar.tsx에서 optional chaining 사용은 안전하지만, 중요한 값(scheduleId 등)은 검증 후 호출 권장.
  • 권장:
    if (typeof scheduleId !== 'number') {
      console.warn('Invalid scheduleId for onEventClick');
    } else {
      onEventClick?.(scheduleId, postId);
    }

4. 부작용(Side Effect) 관리

  • CalendarPage의 페이지뷰 트래킹은 마운트 시 한 번만 실행하도록 구현되었으나 React StrictMode에서 double-invoke 가능성을 고려해야 함.
  • 권장:
    • useRef로 중복 실행 방지 패턴을 유지하거나 useEffect 의존성/콜백을 명확히 해 테스트하세요.
    • 테스트 환경과 실제 환경에서 의도대로 한 번만 호출되는지 확인 필요.

5. 테스트 가능성

  • 권장:
    • trackCalendarEvent를 모킹 가능한 모듈로 유지(현재 파일 분리는 적절).
    • 유닛 테스트 추가: 페이지 마운트 시 PAGE_VIEW 호출, 날짜 선택 시 CALENDAR_DATE_CLICK 호출, 이벤트 카드 클릭 시 EVENT_CARD_CLICK 호출 검증.
    • 예: React Testing Library + jest.mock 사용.

6. 가독성 및 유지보수성

  • 긍정: 상수와 타입 정의로 문자열 하드코딩 최소화.
  • 권장: constants.ts에 각 이벤트에 대한 주석을 추가해 의도를 문서화하세요.

7. 브라우저 호환성 및 접근성

  • Optional chaining과 Intl API 사용은 대부분 현대 브라우저에서 지원됩니다. 빌드 타겟 확인하세요.
  • 추적 로직은 DOM/포커스 흐름을 변경하지 않으므로 접근성 영향 없음. 다만 이벤트 버튼에 적절한 aria/role이 이미 있는지 확인하세요.

8. Clean Architecture/확장성

  • 구조는 확장하기 좋음(새 이벤트 추가 시 constants와 props 맵 확장).
  • 권장: 이벤트 네이밍과 props 맵을 문서화하여 팀이 일관되게 확장할 수 있도록 하세요.

요약 권장사항:

  • 날짜 포맷 유틸과 검증 추가
  • 트래커에 대한 JSDoc/사용 예시 추가
  • 핵심 값(scheduleId 등)에 대한 런타임 검증
  • 모킹 가능한 유닛 테스트 추가
  • React StrictMode 환경에서 중복 추적 방지 확인

이 PR은 의도한 트래킹을 명확히 구현하고 있어 다음 반복에서 위 권장사항을 적용하면 안정성과 가독성이 더욱 좋아질 것입니다.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 주요 변경 사항인 캘린더 로그 추가를 명확하게 요약하고 있으며, 연관된 이슈 #515와 완벽하게 일치합니다.
Linked Issues check ✅ Passed PR에서 구현한 page_view, calendar_date_click, event_card_click 세 가지 로그 이벤트 모두 이슈 #515의 TODO 항목과 일치합니다.
Out of Scope Changes check ✅ Passed 모든 변경 사항이 캘린더 분석 로그 추가라는 범위 내에 있으며, 기존 스케줄링 데이터 페칭과 페이지 네비게이션 통합은 유지되었습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 chore/calendar-log

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.

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

🤖 Fix all issues with AI agents
In `@apps/web/src/features/calendar/model/constants.ts`:
- Around line 4-8: The CALENDAR_EVENTS constant uses PAGE_VIEW: 'page_view'
which breaks the domain-specific naming convention; update the key and value to
VIEW_CALENDAR_PAGE: 'view_calendar_page' in the CALENDAR_EVENTS export and then
update all usages (event dispatches, telemetry callers, tests, and any
types/interfaces) that reference CALENDAR_EVENTS.PAGE_VIEW to use
CALENDAR_EVENTS.VIEW_CALENDAR_PAGE so the telemetry name and code references
remain consistent.
🧹 Nitpick comments (1)
apps/web/src/app-pages/calendar/ui/CalendarPage.tsx (1)

34-41: 페이지 뷰 트래킹 로직 검토 필요

trackRef를 사용해 중복 호출을 방지하는 패턴은 적절합니다. 다만 몇 가지 개선점이 있습니다:

  1. pageName 의존성 문제: useEffect의 의존성 배열에 pageName이 포함되어 있어, pageName이 변경되면 다시 실행될 수 있습니다. 그러나 trackRef.current가 이미 true이므로 실제 재실행은 방지됩니다. 의도된 동작이라면 괜찮지만, 명확성을 위해 의존성 배열을 []로 변경하거나 주석으로 의도를 명시하는 것이 좋습니다.

  2. pageName 유효성: pageName이 빈 문자열이나 undefined일 경우에 대한 방어 로직이 없습니다.

♻️ 개선 제안
  useEffect(() => {
    if (trackRef.current) return;
+   if (!pageName) return;
    trackRef.current = true;
    trackCalendarEvent(CALENDAR_EVENTS.PAGE_VIEW, { page_name: pageName });
-  }, [pageName]);
+  }, [pageName]); // pageName은 일반적으로 변경되지 않지만, 안전을 위해 의존성에 포함

Comment on lines +4 to +8
export const CALENDAR_EVENTS = {
PAGE_VIEW: 'page_view',
CALENDAR_DATE_CLICK: 'calendar_date_click',
EVENT_CARD_CLICK: 'event_card_click',
} as const;
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

🧩 Analysis chain

🏁 Script executed:

# Search for PAGE_VIEW and page_view patterns
rg -n "PAGE_VIEW|page_view" --type ts --type tsx apps/web/src | head -30

Repository: Tave-Makers/SURF-FE

Length of output: 90


🏁 Script executed:

# Look for other event constants similar to CALENDAR_EVENTS
rg -n "EVENTS\s*=\s*\{" --type ts --type tsx apps/web/src | head -20

Repository: Tave-Makers/SURF-FE

Length of output: 90


🏁 Script executed:

# Check for event tracking/analytics patterns
rg -n "event.*page|page.*event" --type ts --type tsx apps/web/src -i | head -20

Repository: Tave-Makers/SURF-FE

Length of output: 90


🏁 Script executed:

# Look for naming convention documentation
fd -t f -e md -e txt . apps/web/src | xargs rg -l "event|naming|convention" 2>/dev/null | head -10

Repository: Tave-Makers/SURF-FE

Length of output: 515


🏁 Script executed:

# Search for PAGE_VIEW and page_view patterns
rg -n "PAGE_VIEW|page_view" apps/web/src | head -40

Repository: Tave-Makers/SURF-FE

Length of output: 474


🏁 Script executed:

# Look for other event constants similar to CALENDAR_EVENTS
rg -n "EVENTS\s*=\s*\{" apps/web/src | head -20

Repository: Tave-Makers/SURF-FE

Length of output: 954


🏁 Script executed:

# Check for any existing event tracking/analytics documentation
find apps/web -name "*.md" -o -name "*event*" -o -name "*analytics*" | grep -v node_modules | head -20

Repository: Tave-Makers/SURF-FE

Length of output: 191


🏁 Script executed:

# Examine the calendar model directory structure
ls -la apps/web/src/features/calendar/model/ 2>/dev/null || echo "Directory not found"

Repository: Tave-Makers/SURF-FE

Length of output: 370


🏁 Script executed:

# Look for how CALENDAR_EVENTS is being used
rg -n "CALENDAR_EVENTS" apps/web/src

Repository: Tave-Makers/SURF-FE

Length of output: 994


🏁 Script executed:

# Check COMMON_EVENTS definition
cat -n apps/web/src/shared/analytics/model/types.ts

Repository: Tave-Makers/SURF-FE

Length of output: 1403


🏁 Script executed:

# Check ONBOARDING_EVENTS to see the naming pattern
rg -A 10 "export const ONBOARDING_EVENTS" apps/web/src

Repository: Tave-Makers/SURF-FE

Length of output: 889


🏁 Script executed:

# Check other domain event definitions to confirm the pattern
rg -A 5 "export const.*_EVENTS\s*=" apps/web/src | head -50

Repository: Tave-Makers/SURF-FE

Length of output: 3112


🏁 Script executed:

# Check how calendar page view event is actually being tracked
cat -n apps/web/src/app-pages/calendar/ui/CalendarPage.tsx | sed -n '35,55p'

Repository: Tave-Makers/SURF-FE

Length of output: 804


🏁 Script executed:

# Verify the analytics tracking setup to see if page_view causes conflicts
rg -B 3 -A 3 "trackCalendarEvent|page_view" apps/web/src/app-pages/calendar/ui/CalendarPage.tsx

Repository: Tave-Makers/SURF-FE

Length of output: 1111


🏁 Script executed:

# Double-check if there are any other page_view events in the project
rg -n "page_view|PAGE_VIEW" apps/web/src --type ts | grep -v "page_name"

Repository: Tave-Makers/SURF-FE

Length of output: 236


🏁 Script executed:

# Look at the analytics library to understand how tracking works
ls -la apps/web/src/shared/analytics/

Repository: Tave-Makers/SURF-FE

Length of output: 340


🏁 Script executed:

# Check trackCalendarEvent implementation
find apps/web/src/features/calendar -name "*.ts" | xargs cat -n 2>/dev/null

Repository: Tave-Makers/SURF-FE

Length of output: 6372


🏁 Script executed:

# Check the onboarding comment mentioned in the results
cat -n apps/web/src/widgets/onboarding/ui/OnBoardingForm.tsx | sed -n '90,100p'

Repository: Tave-Makers/SURF-FE

Length of output: 486


🏁 Script executed:

# Look at createDomainTracker to understand how event tracking works
find apps/web/src/shared/lib -name "*tracker*" -o -name "*analytics*" | xargs cat -n 2>/dev/null | head -50

Repository: Tave-Makers/SURF-FE

Length of output: 45


🏁 Script executed:

# Let's check if there's any documentation on event naming conventions
find apps/web -name "*.md" -type f | xargs grep -l "event\|analytics\|tracking" 2>/dev/null

Repository: Tave-Makers/SURF-FE

Length of output: 47


🏁 Script executed:

# Check the createDomainTracker more carefully
ls -la apps/web/src/shared/lib/

Repository: Tave-Makers/SURF-FE

Length of output: 882


🏁 Script executed:

# Check createDomainTracker implementation
cat -n apps/web/src/shared/lib/createDomainTracker.ts

Repository: Tave-Makers/SURF-FE

Length of output: 635


🏁 Script executed:

# Check trackEvent implementation
cat -n apps/web/src/shared/lib/trackEvent.ts

Repository: Tave-Makers/SURF-FE

Length of output: 512


🏁 Script executed:

# Check the types
cat -n apps/web/src/shared/lib/types.ts

Repository: Tave-Makers/SURF-FE

Length of output: 442


도메인별 이벤트 네이밍 컨벤션 일관성 유지 필요

PAGE_VIEW: 'page_view'는 다른 모든 도메인 이벤트와 달리 도메인 구분이 없어 컨벤션 위반입니다.

프로젝트 내 다른 도메인들은 일관된 패턴을 따르고 있습니다:

  • Onboarding: VIEW_SIGNUP_PAGE: 'view_signup_page'
  • Profile: VIEW_PROFILE: 'view_profile'
  • Post: VIEW_MY_POSTS_PAGE: 'view_post_list'
  • Activity Score: VIEW_ACTIVITY: 'view_activity'

Calendar도 이 패턴을 따라 VIEW_CALENDAR_PAGE: 'view_calendar_page'로 변경하세요. page_name 속성으로 페이지를 구분할 수 있지만, 이벤트 이름 자체도 도메인별로 구분하면:

  1. Amplitude 대시보드에서 필터링/세분화가 명확함
  2. 향후 다른 도메인과의 충돌 위험 제거
  3. 전체 코드베이스에서 일관된 네이밍 규칙 유지
🤖 Prompt for AI Agents
In `@apps/web/src/features/calendar/model/constants.ts` around lines 4 - 8, The
CALENDAR_EVENTS constant uses PAGE_VIEW: 'page_view' which breaks the
domain-specific naming convention; update the key and value to
VIEW_CALENDAR_PAGE: 'view_calendar_page' in the CALENDAR_EVENTS export and then
update all usages (event dispatches, telemetry callers, tests, and any
types/interfaces) that reference CALENDAR_EVENTS.PAGE_VIEW to use
CALENDAR_EVENTS.VIEW_CALENDAR_PAGE so the telemetry name and code references
remain consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CHORE] 캘린더 로그 추가

2 participants