Skip to content

♻️ [Refactor] Calendar view/hook 구조 정리 - #129

Open
yeonjin719 wants to merge 2 commits into
developfrom
refactor/#127
Open

♻️ [Refactor] Calendar view/hook 구조 정리#129
yeonjin719 wants to merge 2 commits into
developfrom
refactor/#127

Conversation

@yeonjin719

Copy link
Copy Markdown
Member

🔗 관련 이슈


🧩 작업 요약 (TL;DR)

  • 캘린더 파일 구조와 훅 흐름을 정리해 view/hook 역할을 더 쉽게 파악할 수 있도록 개선했습니다.

🔄 변경 유형

해당되는 항목에 체크해주세요.

  • ✨ Feature
  • 🐞 Bug Fix
  • 🔨 Refactor (기능 변화 없음)
  • 🎨 UI / UX
  • ⚙️ Setting / Infra
  • 🧪 Test
  • 📄 Docs

📌 주요 변경 사항

리뷰어가 집중해서 봐야 할 포인트

  • Calendar 관련 컴포넌트를 components/Calendar, components/CalendarView/{day,week,month} 기준으로 재배치
  • 사용하지 않는 CustomWeekEvent, 기존 barrel export, 중간 생성/선택 훅 제거
  • useCustomCalendarController/useCustomCalendarMutations 등 이름을 현재 역할에 맞게 정리
  • 생성 핸들러 흐름을 useCalendarCreationHandlers로 통합

🖼️ 스크린샷 / 영상 (선택)

UI 변경이 있다면 꼭 첨부해주세요.

Before After

🧠 리뷰 요청 포인트

리뷰어에게 특히 봐줬으면 하는 부분

  • 로직 설계
  • 상태 관리 방식
  • 네이밍
  • 성능 / 렌더링
  • 기타: 폴더/파일 구조가 기존 feature 패턴과 맞는지

⚠️ 체크리스트 (PR 올리기 전)

  • 로컬에서 정상 동작 확인
  • 기존 기능에 영향 없음
  • 불필요한 console.log 제거
  • 린트 / 타입 에러 없음
  • 관련 이슈 연결 완료

🚧 미완 / 후속 작업

이 PR에서 다루지 않은 내용이나 추후 작업

  • useCalendarController 책임 분리
  • useCalendarRbcProps view별 props 생성 흐름 정리
  • day/week view 내부 렌더링 중복 정리

💬 기타 참고 사항

리뷰어가 알면 좋은 맥락, 트레이드오프, 고민 지점

@copilot 이 PR을 아래 기준으로 검토해주세요:

.github/instructions/capstone.instructions.md 파일을 지침으로 삼으세요.
폴더/파일 위치가 프로젝트 구조 규칙과 일치하는지
컴포넌트가 단일 책임 원칙(SRP)을 지키는지
import 방향이 올바른지 (shared → features 역방향 없음)
명명/케이스가 일관적인지 (PascalCase vs camelCase)
배럴(index.ts) 사용이 현 패턴을 따르는지
응답은 한국어로, 발견된 위반 항목과 추천 구조를 포함해주세요.
리뷰를 달아주세요

Copilot AI review requested due to automatic review settings July 1, 2026 09:53
@yeonjin719 yeonjin719 linked an issue Jul 1, 2026 that may be closed by this pull request
6 tasks
@yeonjin719 yeonjin719 moved this from Backlog to In review in Calio - Frontend Jul 1, 2026
@yeonjin719 yeonjin719 self-assigned this Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

캘린더(Calendar feature) 전반의 view/hook 파일 구조와 훅 흐름을 재정리해 추적 비용을 낮추는 리팩토링입니다(#127).

Changes:

  • Calendar 컴포넌트/뷰를 components/Calendar, components/CalendarView/{day,week,month} 기준으로 재배치하고 불필요 구성요소/배럴을 제거
  • 생성/선택 관련 훅 흐름을 useCalendarCreationHandlers 중심으로 재구성하고 컨트롤러 훅 네이밍을 정리
  • week/month/day 뷰 스타일/레이아웃을 분리(*Styles, *Layout, eventStyles)하여 관심사 분리 강화

한 줄 요약

구조 정리는 잘 되었지만, 새로 옮긴 CalendarView 쪽에서 @/ alias와 ../../../ 상대 경로 import가 혼재되어 코드베이스 규칙 일관성이 깨져 있습니다.

발견된 위반 항목

  • src/features/Calendar/components/CalendarView/day/*, month/*, week/weekLayout.ts에서 @/ alias + deep relative(../../../) import 혼재
    • 유지보수/폴더 이동 시 경로 깨짐 위험이 증가하고, 동일 feature 내 import 규칙이 파일마다 달라집니다.
  • src/features/Calendar/components/CalendarView/day/dragMath.ts에서 12 * 60 매직 넘버 직접 사용
    • “컬럼 이동은 12시간”이라는 전제가 코드에 드러나지 않아 추후 컬럼 정책 변경 시 추적이 어려워집니다.

추천 구조

src/features/Calendar/
  components/
    Calendar/
      Calendar.tsx
      Calendar.style.ts
      Calendar.types.ts
      CalendarDialogs.tsx
      CalendarMobileActions.tsx
      CalendarModals.tsx
    CalendarView/
      eventStyles.ts
      day/
        DayView.tsx
        constants.ts
        dayStyles.ts
        dragHandlers.ts
        dragMath.ts
        renderers.tsx
        renderGeometry.ts
        timeHelpers.ts
      week/
        WeekView.tsx
        weekLayout.ts
        weekStyles.ts
      month/
        MonthEvent.tsx
        MonthShowMore.tsx
        monthStyles.ts
        index.ts
  utils/
    ...
  hooks/
    ...
  • 위 구조는 유지하되, Calendar feature 내부 공통 유틸/도메인 import는 @/features/Calendar/... alias로 통일하는 것을 권장합니다.

최소 리팩토링 단계

  1. CalendarView/*에서 ../../../domain/*, ../../../utils/* import를 @/features/Calendar/... alias로 통일
  2. weekLayout.ts/DayView.tsx/renderers.tsx처럼 혼재된 파일부터 우선 정리
  3. dragMath.ts의 컬럼 쉬프트 분(12시간)을 의미 있는 변수/상수로 치환
  4. ESLint(simple-import-sort 포함) 및 타입체크를 다시 돌려 import 정렬/경로를 확정
  5. day/week/month view에서 드래그/생성 플로우가 기존과 동일하게 동작하는지 수동 스모크 테스트

Reviewed changes

Copilot reviewed 29 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/pages/main/CalendarPage/CalendarPage.tsx Calendar 컴포넌트 이동에 따른 import 경로 갱신
src/features/Calendar/utils/viewConfig.ts CalendarEvent 타입 참조를 shared 타입으로 정리
src/features/Calendar/hooks/useDayViewHandlers.tsx DayView 컴포넌트 경로 재배치 반영
src/features/Calendar/hooks/useCalendarTodoTimingPatch.ts 동일 폴더 상대 import로 경로 단순화
src/features/Calendar/hooks/useCalendarSelectionBridge.ts 중간 브리지 훅 제거
src/features/Calendar/hooks/useCalendarRecurringDropConfirm.ts Calendar 타입 경로 변경 반영
src/features/Calendar/hooks/useCalendarRbcProps.tsx month/week view 컴포넌트 경로 재배치 반영
src/features/Calendar/hooks/useCalendarMutations.ts 훅 export 네이밍 정리(useCalendarMutations)
src/features/Calendar/hooks/useCalendarDeleteConfirm.ts Calendar 타입 경로 변경 반영
src/features/Calendar/hooks/useCalendarCreationHandlers.ts 생성/선택 핸들러 흐름 통합 및 책임 재배치
src/features/Calendar/hooks/useCalendarCreateHandlers.ts 생성 핸들러 훅 제거(통합으로 대체)
src/features/Calendar/hooks/useCalendarCreateEvent.ts 생성 이벤트 훅 제거(통합으로 대체)
src/features/Calendar/hooks/useCalendarController.tsx 컨트롤러 훅 네이밍/흐름 재정리 및 브리지 제거
src/features/Calendar/hooks/index.ts hooks 배럴 export 제거(직접 import로 전환)
src/features/Calendar/components/CustomEvent/index.tsx CustomEvent 배럴 제거
src/features/Calendar/components/CustomEvent/CustomWeekEvent.tsx 사용되지 않는 주간 이벤트 컴포넌트 제거
src/features/Calendar/components/CalendarView/week/WeekView.tsx week view 구성요소/레이아웃 경로 재정리
src/features/Calendar/components/CalendarView/week/weekStyles.ts week view 스타일 분리(신규)
src/features/Calendar/components/CalendarView/week/weekLayout.ts week view 레이아웃 로직 위치 조정
src/features/Calendar/components/CalendarView/month/monthStyles.ts month view 스타일 분리(신규)
src/features/Calendar/components/CalendarView/month/MonthShowMore.tsx show-more UI 스타일 경로 재배치 반영
src/features/Calendar/components/CalendarView/month/MonthEvent.tsx month event 렌더러를 CalendarView로 이동/정리
src/features/Calendar/components/CalendarView/month/index.ts month view 배럴 추가(신규)
src/features/Calendar/components/CalendarView/eventStyles.ts month/week 공용 이벤트 스타일 분리(신규)
src/features/Calendar/components/CalendarView/day/timeHelpers.ts day view 시간 유틸 분리(신규)
src/features/Calendar/components/CalendarView/day/renderGeometry.ts day view 렌더 지오메트리 분리(신규)
src/features/Calendar/components/CalendarView/day/renderers.tsx day view 렌더러 경로/스타일 분리 반영
src/features/Calendar/components/CalendarView/day/dragMath.ts day view 드래그 수학 로직 분리(신규)
src/features/Calendar/components/CalendarView/day/dragHandlers.ts shared 타입 import 경로 정리
src/features/Calendar/components/CalendarView/day/DayView.tsx day view 파일 재배치 및 내부 모듈 분리 반영
src/features/Calendar/components/CalendarView/day/dayStyles.ts day view 스타일 분리(신규)
src/features/Calendar/components/CalendarView/day/constants.ts day view 상수 분리(신규)
src/features/Calendar/components/Calendar/CalendarModals.tsx Calendar.types로 타입 이동 반영
src/features/Calendar/components/Calendar/CalendarMobileActions.tsx Calendar.style 경로 변경 반영
src/features/Calendar/components/Calendar/CalendarDialogs.tsx Calendar.types로 타입 이동 반영
src/features/Calendar/components/Calendar/Calendar.types.ts Calendar 공용 타입 분리(신규)
src/features/Calendar/components/Calendar/Calendar.tsx Calendar 컴포넌트가 새 controller 훅/하위 컴포넌트 사용
src/features/Calendar/components/Calendar/Calendar.style.ts day/week/month 스타일 import 경로 재배치 반영
Comments suppressed due to low confidence (5)

src/features/Calendar/components/CalendarView/month/MonthEvent.tsx:9

  • 이 파일은 이미 @/ alias(assets/shared)를 사용하고 있는데 getColorPalette../../../ 상대 경로로 가져와서 경로 규칙이 혼재됩니다. Calendar feature 내 공통 유틸은 동일하게 @/features/Calendar/... alias로 통일하는 편이 리팩토링/이동에 안전합니다.
    src/features/Calendar/components/CalendarView/day/renderers.tsx:9
  • renderers.tsx에서 같은 파일 내에 @/ alias import와 ../../../ 상대 import가 섞여 있습니다. Calendar 도메인/유틸 import는 @/features/Calendar/... alias로 통일하면 이동/리네이밍 시 깨질 위험이 줄어듭니다.
    src/features/Calendar/components/CalendarView/day/DayView.tsx:8
  • DayView.tsx에서 TIMED_SLOT_CONFIG../../../ 상대 경로로 import 하고 있어 동일 feature 내 import 규칙이 혼재됩니다. Calendar 도메인 상수는 @/features/Calendar/domain/... alias로 통일하는 편이 유지보수에 유리합니다.
    src/features/Calendar/components/CalendarView/day/DayView.tsx:13
  • DayView.tsx에서 Calendar 유틸을 ../../../ 상대 경로로 가져오고 있어 같은 코드베이스 내 alias 규칙과 섞입니다. @/features/Calendar/... alias로 통일하면 폴더 이동/재구성 시 import 깨짐을 줄일 수 있습니다.
    src/features/Calendar/components/CalendarView/week/weekLayout.ts:10
  • weekLayout.ts에서 dayViewHelpers를 ../../../ 상대 경로로 import 하고 있어 Calendar feature 내 다른 파일(예: WeekView.tsx)과 import 규칙이 달라집니다. 동일 유틸은 @/features/Calendar/utils/helpers/dayViewHelpers alias로 맞추는 편이 안정적입니다.

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

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

♻️ [Refactor] Calendar view/hook 구조 정리

2 participants