Skip to content

refactor: 축제 맵 코드 정리#553

Merged
hwangdae merged 2 commits intomainfrom
develop
Jan 3, 2026
Merged

refactor: 축제 맵 코드 정리#553
hwangdae merged 2 commits intomainfrom
develop

Conversation

@hwangdae
Copy link
Collaborator

@hwangdae hwangdae commented Jan 3, 2026

작업 내용

refactor: 축제 맵 코드 정리

문제점 및 어려움

해결 방안

공유 사항

Summary by CodeRabbit

  • Refactor
    • Optimized map interaction and zoom tracking logic for improved code maintainability and reusability

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot requested a review from dgKim1 January 3, 2026 18:15
@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes refactor map interaction logic in the booth map component by extracting zoom state management and map event handling into dedicated custom hooks (useMapZoom and useMapEvents), removing manual event listeners and drag state tracking from the MapPage component.

Changes

Cohort / File(s) Summary
MapPage component refactoring
apps/nowait-user/src/pages/waiting/boothMap/MapPage.tsx
Removed useRef-based drag state (isDraggingRef), dragstart/dragend/click listeners, and explicit zoom state. Replaced with useMapZoom hook for zoom retrieval and useMapEvents hook for interaction handling. Simplified event flow and removed unused imports (useEffect, useRef).
Map zoom tracking hook
apps/nowait-user/src/pages/waiting/boothMap/hooks/useMapZoom.ts
New hook that subscribes to map "zoom_changed" event and maintains zoom level state (initialized to 14). Returns current zoom value via map.getZoom(). Properly cleans up listener on unmount.
Map event handling hook
apps/nowait-user/src/pages/waiting/boothMap/hooks/useMapEvents.ts
New hook that centralizes map interaction logic. Tracks dragging via ref and registers dragstart, dragend, and click listeners. Invokes onMapClick callback only when drag is not in progress. Cleans up all listeners on unmount or dependency change.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • dgKim1

Poem

🐰 Hop, hop, zoom hooks appear!
Map events now crystalline clear,
Extracted with care from tangled code,
Each hook a neat, reusable road!
🗺️✨

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4402af3 and 5c24b41.

📒 Files selected for processing (3)
  • apps/nowait-user/src/pages/waiting/boothMap/MapPage.tsx
  • apps/nowait-user/src/pages/waiting/boothMap/hooks/useMapEvents.ts
  • apps/nowait-user/src/pages/waiting/boothMap/hooks/useMapZoom.ts

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.

@hwangdae hwangdae merged commit fc2a56a into main Jan 3, 2026
2 of 3 checks passed
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