Skip to content

DatePicker 지난 날짜에 대한 컴포넌트 수정#81

Open
HamBeomJoon wants to merge 3 commits intodevelopfrom
refactor/#67-datepicker-modify
Open

DatePicker 지난 날짜에 대한 컴포넌트 수정#81
HamBeomJoon wants to merge 3 commits intodevelopfrom
refactor/#67-datepicker-modify

Conversation

@HamBeomJoon
Copy link
Contributor

@HamBeomJoon HamBeomJoon commented Mar 16, 2026

📌 작업 내용

  • DatePicker MonthGrid 렌더링 로직 개선
  • 지난 날짜만 포함된 주는 전체 렌더링 제외하도록 변경
  • 주 단위 필터링 방식으로 구조 단순화
  • WeekRow를 주 데이터 기반 렌더링 방식으로 수정

🧩 관련 이슈

close #67

📸 스크린샷

스크린샷 2026-03-16 21 00 09



스크린샷 2026-03-16 21 03 55

📢 논의하고 싶은 내용

Summary by CodeRabbit

릴리스 노트

  • 개선 사항

    • 월간 달력 렌더링을 최적화하여 현재 날짜 이후의 주만 표시함으로써 불필요한 렌더링을 줄이고 성능을 개선했습니다.
  • 기타

    • 미리보기(Preview) 샘플 날짜 및 레이아웃 일부가 최신 날짜와 축소된 폭으로 업데이트되어 디자인 미리보기가 더욱 현실적으로 반영됩니다.

DatePicker의 `MonthGrid` 컴포넌트에서 불필요한 인덱스 계산 로직을 제거하고, 오늘 날짜를 기준으로 가시적인 주(week)만 필터링하여 렌더링하도록 개선했습니다.

*   `MonthGridBuilder.kt`: 사용되지 않는 `lastWeekIndexToRender` 함수를 삭제했습니다.
*   `MonthGrid.kt`:
    *   `buildMonthGrid`의 결과를 7일 단위로 청크(`chunked`)화하고, `hasVisibleDate` 확장 함수를 통해 오늘 이후의 날짜가 포함된 주만 노출하도록 수정했습니다.
    *   `WeekRow`에서 인덱스 기반의 `for` 루프를 `forEach` 문으로 교체하여 가독성을 높였습니다.
    *   불필요한 `ImmutableList` 의존성을 제거하고 `List`를 사용하도록 변경했습니다.
    *   `MonthGridPreview`의 데이터를 최신 날짜 기준으로 업데이트했습니다.
`DatePickerDayCellView`, `MonthSection`, `PrezelDatePicker` 컴포넌트의 프리뷰에서 사용되는 날짜 데이터 및 레이아웃 설정을 실제 동작 확인이 용이하도록 업데이트했습니다.
@HamBeomJoon HamBeomJoon self-assigned this Mar 16, 2026
@HamBeomJoon HamBeomJoon requested a review from moondev03 as a code owner March 16, 2026 12:10
@HamBeomJoon HamBeomJoon added the 🔨 refactor 기능 변경 없이 내부 구조, 설계, 가독성 개선 label Mar 16, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4202d1e0-2c4c-4d8e-9ade-4b41c17e51e7

📥 Commits

Reviewing files that changed from the base of the PR and between 3e629f2 and 170662f.

📒 Files selected for processing (2)
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/MonthGrid.kt
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/MonthGridBuilder.kt
💤 Files with no reviewable changes (1)
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/MonthGridBuilder.kt

Walkthrough

MonthGrid 렌더링이 42-셀(flat list) 기반에서 주 단위 리스트(week: List<LocalDate?>)로 변경되었습니다. 빌드 로직은 이제 월별 셀 그리드를 생성한 뒤 주 단위로 청킹(chunk)하고, 오늘 날짜 이후(또는 포함하는) 주만 필터링해 visibleWeeks로 렌더링합니다. WeekRow 시그니처가 인덱스 기반에서 주의 LocalDate? 리스트를 받는 형태로 변경되었고, 빌드용 유틸 함수(buildMonthGridList<LocalDate?>.hasVisibleDate)가 MonthGrid 내부로 이동/추가되었습니다. 기존 MonthGridBuilder.kt의 내부 헬퍼들은 제거되었고 여러 Preview 샘플 날짜들이 2026년 3월 기준으로 갱신되었습니다.

Possibly related PRs

  • PrezelDatePicker 구현 #59: MonthGrid의 빌드/렌더링 로직과 WeekRow 시그니처 변경, MonthGridBuilder의 헬퍼 제거 등 동일한 코드 수준 변경을 포함합니다.

개요

DatePicker 컴포넌트의 주간 렌더링 로직을 수정합니다. MonthGrid.kt에서 셀 배열 기반 처리 방식을 오늘 날짜 이후의 주만 필터링하는 visibleWeeks 기반 방식으로 변경하고, WeekRow 함수 시그니처를 주 인덱스 대신 LocalDate 리스트를 받도록 업데이트합니다. MonthGridBuilder.kt에서 lastWeekIndexToRender 내부 함수를 제거합니다. 여러 파일의 미리보기 샘플 데이터를 2026년 3월 날짜로 갱신합니다.

관련 PR

  • PrezelDatePicker 구현 #59: MonthGrid 컴포넌트의 주간 렌더링 로직을 visibleWeeks 반복 방식으로 수정하고 MonthGridBuilder에서 lastWeekIndexToRender 헬퍼 함수를 제거하는 동일한 함수 변경사항을 포함합니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 PR의 주요 변경 사항인 지난 날짜에 대한 DatePicker 컴포넌트 수정을 명확히 요약하고 있습니다.
Description check ✅ Passed 설명은 저장소의 템플릿 구조를 따르며 작업 내용, 관련 이슈, 스크린샷을 포함하고 있습니다.
Linked Issues check ✅ Passed 코드 변경 사항은 연결된 이슈 #67의 요구 사항을 충족하며, MonthGrid 렌더링 로직을 개선하고 지난 날짜만 포함된 주를 제외하도록 구현했습니다.
Out of Scope Changes check ✅ Passed 모든 변경 사항은 이슈 #67의 요구 사항 범위 내에 있으며, DatePicker MonthGrid 렌더링 로직 개선에만 집중되어 있습니다.

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

📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can generate walkthrough in a markdown collapsible section to save space.

Enable the reviews.collapse_walkthrough setting to generate walkthrough in a markdown collapsible section.

}.toPersistentList()
}

internal fun lastWeekIndexToRender(cells: List<LocalDate?>): Int {
Copy link
Contributor Author

@HamBeomJoon HamBeomJoon Mar 16, 2026

Choose a reason for hiding this comment

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

lastWeekIndexToRender함수는 기존에 무조건 6x7로 42칸을 그리던 함수여서 제거했습니다.

  • 제거함에 따라 buildMonthGrid 파일에 함수 하나밖에 남지않아 MonthGrid.kt 안으로 옮겼습니다.

- `MonthGridBuilder.kt` 파일을 삭제하고 `buildMonthGrid` 함수를 `MonthGrid.kt` 내부의 private 함수로 이동하였습니다.
- 별도의 파일로 관리되던 그리드 생성 로직을 컴포넌트 파일로 통합하여 응집도를 높였습니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 refactor 기능 변경 없이 내부 구조, 설계, 가독성 개선

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DatePicker 지난 날짜에 대한 컴포넌트 수정

1 participant