Skip to content

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

Merged
HamBeomJoon merged 11 commits into
developfrom
refactor/#67-datepicker-modify
Mar 27, 2026
Merged

DatePicker 지난 날짜에 대한 컴포넌트 수정#81
HamBeomJoon merged 11 commits into
developfrom
refactor/#67-datepicker-modify

Conversation

@HamBeomJoon

@HamBeomJoon HamBeomJoon commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

📌 작업 내용

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

🧩 관련 이슈

close #67

📸 스크린샷

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



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

📢 논의하고 싶은 내용

Summary by CodeRabbit

릴리스 노트

  • 신규 기능

    • 날짜 선택기에 새로운 구성 옵션 시스템 추가
  • 리팩토링

    • 날짜 선택기 컴포넌트 API 변경: 초기 선택 날짜 및 기본 설정 옵션으로 통합
    • 날짜 셀 렌더링 및 상호작용 로직 재구현
    • 날짜 타입 분류 시스템 개선으로 더 정확한 날짜 상태 표시

@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

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

이 PR은 DatePicker 컴포넌트의 내부 구조를 리팩토링합니다. 기존의 DayCell 데이터 클래스, DayCellView UI 컴포넌트, MonthGrid, MonthSection을 제거하고, 새로운 sealed interface 기반의 DayCellType, 재설계된 DayCell 컴포넌트, 그리고 DatePickerMonth로 교체합니다. PrezelDatePicker의 선택 상태 관리를 호출자 제공 방식에서 내부 상태 관리로 변경하고, DatePickerDefaults 설정 객체를 도입하여 스타일링 유연성을 높입니다. 또한 지난 날짜만 포함된 주는 렌더링 대상에서 제외하는 로직을 추가합니다.

Possibly related PRs

🚥 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 PR 설명이 템플릿의 주요 섹션(작업 내용, 관련 이슈, 스크린샷)을 포함하고 있으며, 변경사항을 구체적으로 기술하고 있습니다.
Linked Issues check ✅ Passed PR의 코드 변경사항이 이슈 #67의 요구사항과 완벽하게 일치합니다. 지난 날짜만 포함된 주 제외, 주 단위 필터링, WeekRow 기반 렌더링 모두 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 DatePicker 컴포넌트 리팩토링과 관련되어 있으며, .coderabbit.yaml 설정 변경을 제외하고는 이슈 범위 내에 있습니다.

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


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.

}.toPersistentList()
}

internal fun lastWeekIndexToRender(cells: List<LocalDate?>): Int {

@HamBeomJoon HamBeomJoon Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

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 안으로 옮겼습니다.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (3)
Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerMonth.kt (1)

76-83: datesremember 의존성에서 제거하는 것이 좋습니다.

dates는 이미 yearMonth로부터 파생되므로, weeksremember 키에 포함할 필요가 없습니다. yearMonth, selectedDate, today만 의존성으로 두면 충분합니다.

♻️ 제안된 수정
-    val weeks = remember(dates, selectedDate, today) {
-        dates
+    val weeks = remember(yearMonth, selectedDate, today) {
+        buildMonthGrid(yearMonth)
             .map { date ->
                 if (date == null) return@map null
                 DayCellType.from(date = date, selectedDate = selectedDate, today = today)
             }.chunked(7)
             .filter { week -> week.any { cell -> cell != null && cell !is DayCellType.Past } }
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerMonth.kt`
around lines 76 - 83, The remember key for weeks currently includes dates but
dates is derived from yearMonth; update the remember call to depend on
yearMonth, selectedDate, and today instead of dates (i.e., change
remember(dates, selectedDate, today) to remember(yearMonth, selectedDate,
today)) so weeks recomputes when the source yearMonth changes; keep the mapping
that uses dates and DayCellType.from(date, selectedDate, today) unchanged.
Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DayCell.kt (1)

27-34: null 셀에 대한 enabled 조건을 명확히 하는 것이 좋습니다.

현재 dayCell !is DayCellType.Past 조건은 dayCellnull일 때 true를 반환하여 빈 셀도 터치 가능한 상태가 됩니다. 호출부에서 null 체크를 하고 있어 실제 문제는 없지만, 의도를 명확히 하면 좋겠습니다.

♻️ 제안된 수정
     PrezelTouchArea(
-        enabled = dayCell !is DayCellType.Past,
+        enabled = dayCell != null && dayCell !is DayCellType.Past,
         modifier = modifier
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DayCell.kt`
around lines 27 - 34, The enabled expression currently treats a null dayCell as
enabled; update the PrezelTouchArea(enabled = ...) check so null cells are
disabled by making the condition explicit (e.g., ensure enabled is true only
when dayCell is non-null and not a DayCellType.Past). Locate the PrezelTouchArea
usage and change the enabled parameter to check dayCell != null && dayCell !is
DayCellType.Past (or equivalent) so empty cells are not touchable while
preserving existing onClick and modifier behavior.
Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerDefaults.kt (1)

49-49: 선택된 날짜 텍스트 색상이 다크 테마 색상으로 고정되어 있습니다.

PrezelColorScheme.Dark.textLarge를 직접 사용하여 선택된 날짜의 텍스트 색상을 고정하고 있습니다. 이는 interactiveRegular 배경색과의 대비를 위한 의도적인 선택으로 보이지만, 테마 시스템을 따르지 않으므로 향후 유지보수 시 주의가 필요합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerDefaults.kt`
at line 49, DatePickerDefaults currently hardcodes selectedDayTextColor to
PrezelColorScheme.Dark.textLarge; change this to use the theme-aware semantic
color (e.g., the current theme’s text-on-interactive or equivalent) so the
selectedDayTextColor follows the app theme rather than always using
PrezelColorScheme.Dark.textLarge; update the assignment in DatePickerDefaults
(symbol: selectedDayTextColor) to reference the theme color provider (e.g.,
PrezelTheme/PrezelColorScheme current accessor or the semantic
onInteractiveRegular token) and ensure contrast with interactiveRegular is
preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DayCellType.kt`:
- Around line 31-33: The isHoliday() implementation in DayCellType currently
only treats Sundays as holidays; update the DayCellType companion object's fun
isHoliday(date: LocalDate) to also return true for Saturdays (i.e., consider
date.dayOfWeek == DayOfWeek.SATURDAY || date.dayOfWeek == DayOfWeek.SUNDAY) so
weekend days are both marked as holidays in the calendar UI.

In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/PrezelDatePicker.kt`:
- Around line 59-63: The construction of the months list uses
YearMonth(...).plus(value = offset, unit = DateTimeUnit.MONTH), which is invalid
for YearMonth; update the remember(today) block that builds months to call
YearMonth(today.year, today.month).plusMonth(offset) for each offset (i.e.,
replace the .plus(...) call with .plusMonth(offset)) so the months List is
produced correctly.
- Line 58: selectedDate is declared with remember(initialSelectedDate) but not
as a MutableState, so assignments like selectedDate = date won't trigger
recomposition; update the declaration in PrezelDatePicker (selectedDate) to use
remember { mutableStateOf(initialSelectedDate) } (or rememberSaveable {
mutableStateOf(...) } if state should survive process death) and, if preferred,
use the by delegation pattern (var selectedDate by remember {
mutableStateOf(initialSelectedDate) }) so UI updates when you assign
selectedDate = date.

---

Nitpick comments:
In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerDefaults.kt`:
- Line 49: DatePickerDefaults currently hardcodes selectedDayTextColor to
PrezelColorScheme.Dark.textLarge; change this to use the theme-aware semantic
color (e.g., the current theme’s text-on-interactive or equivalent) so the
selectedDayTextColor follows the app theme rather than always using
PrezelColorScheme.Dark.textLarge; update the assignment in DatePickerDefaults
(symbol: selectedDayTextColor) to reference the theme color provider (e.g.,
PrezelTheme/PrezelColorScheme current accessor or the semantic
onInteractiveRegular token) and ensure contrast with interactiveRegular is
preserved.

In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerMonth.kt`:
- Around line 76-83: The remember key for weeks currently includes dates but
dates is derived from yearMonth; update the remember call to depend on
yearMonth, selectedDate, and today instead of dates (i.e., change
remember(dates, selectedDate, today) to remember(yearMonth, selectedDate,
today)) so weeks recomputes when the source yearMonth changes; keep the mapping
that uses dates and DayCellType.from(date, selectedDate, today) unchanged.

In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DayCell.kt`:
- Around line 27-34: The enabled expression currently treats a null dayCell as
enabled; update the PrezelTouchArea(enabled = ...) check so null cells are
disabled by making the condition explicit (e.g., ensure enabled is true only
when dayCell is non-null and not a DayCellType.Past). Locate the PrezelTouchArea
usage and change the enabled parameter to check dayCell != null && dayCell !is
DayCellType.Past (or equivalent) so empty cells are not touchable while
preserving existing onClick and modifier behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 48205158-7cd1-4c3b-9120-341394222d96

📥 Commits

Reviewing files that changed from the base of the PR and between b706b39 and 628f770.

📒 Files selected for processing (9)
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/DatePickerDayCellView.kt
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/DayCell.kt
  • 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/MonthSection.kt
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/PrezelDatePicker.kt
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerDefaults.kt
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerMonth.kt
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DayCell.kt
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DayCellType.kt
💤 Files with no reviewable changes (4)
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/DayCell.kt
  • 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/MonthSection.kt
  • Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/DatePickerDayCellView.kt

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

*   `MonthGridBuilder.kt`: 사용되지 않는 `lastWeekIndexToRender` 함수를 삭제했습니다.
*   `MonthGrid.kt`:
    *   `buildMonthGrid`의 결과를 7일 단위로 청크(`chunked`)화하고, `hasVisibleDate` 확장 함수를 통해 오늘 이후의 날짜가 포함된 주만 노출하도록 수정했습니다.
    *   `WeekRow`에서 인덱스 기반의 `for` 루프를 `forEach` 문으로 교체하여 가독성을 높였습니다.
    *   불필요한 `ImmutableList` 의존성을 제거하고 `List`를 사용하도록 변경했습니다.
    *   `MonthGridPreview`의 데이터를 최신 날짜 기준으로 업데이트했습니다.

# Conflicts:
#	Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/MonthGrid.kt
`DatePickerDayCellView`, `MonthSection`, `PrezelDatePicker` 컴포넌트의 프리뷰에서 사용되는 날짜 데이터 및 레이아웃 설정을 실제 동작 확인이 용이하도록 업데이트했습니다.
- `MonthGridBuilder.kt` 파일을 삭제하고 `buildMonthGrid` 함수를 `MonthGrid.kt` 내부의 private 함수로 이동하였습니다.
- 별도의 파일로 관리되던 그리드 생성 로직을 컴포넌트 파일로 통합하여 응집도를 높였습니다.
CodeRabbit 설정 파일의 옵션을 조정하여 코드 리뷰 시 제공되는 요약 기능을 강화하고 리뷰 프로필을 변경했습니다.

* `reviews.profile`을 `chill`로 설정했습니다.
* `high_level_summary` 및 `changed_files_summary` 옵션을 `true`로 변경하여 요약 기능을 활성화했습니다.
* `collapse_walkthrough` 옵션을 `true`로 수정했습니다.
DatePicker 관련 스타일 결정 로직을 `DatePickerDefaults` 객체로 통합하여 가독성과 유지보수성을 개선했습니다.

*   `DatePickerDefaults.kt` 파일을 생성하여 `dayTextColor`, `dayContainerColor`, `dayTextStyle` 로직을 한 곳에서 관리하도록 수정했습니다.
*   `DatePickerDayCellView`에서 하드코딩된 스타일 로직을 `DatePickerDefaults` 호출 방식으로 변경했습니다.
*   `DatePickerStyle.kt` 파일을 삭제하고 기존 확장 함수 로직을 `DatePickerDefaults`로 이관했습니다.
*   `MonthGrid.kt` 내 불필요한 `ThemePreview` 어노테이션을 제거했습니다.
* `androidx.compose.material3.DatePickerDefaults` 등 사용하지 않는 import 문을 제거했습니다.
* `DatePickerDefault`를 `DatePickerDefaults`로 수정하여 명칭의 일관성을 맞추었습니다.
`DayCellView` 컴포넌트에서 `dayCell`이 `null`인 경우에도 클릭 영역이 활성화되던 문제를 수정하기 위해 `enabled` 조건을 강화했습니다.

* `dayCell`이 `null`이 아니고, 과거 날짜(`DayCellType.Past`)가 아닐 때만 `PrezelTouchArea`가 활성화되도록 수정했습니다.
@moondev03 moondev03 force-pushed the refactor/#67-datepicker-modify branch from 628f770 to 7d3b797 Compare March 26, 2026 17:58
`PrezelDatePicker`에서 날짜가 선택되지 않은 상태를 지원하도록 관련 로직을 수정하였습니다.

*   `PrezelDatePicker`의 `initialSelectedDate` 파라미터 타입을 `LocalDate?`로 변경하고 기본값을 `null`로 설정하였습니다.
*   날짜가 선택되지 않았을 때를 대응하기 위해 `DayCellType.from`, `DatePickerMonth`, `MonthGrid` 등 내부 컴포넌트의 `selectedDate` 타입을 `LocalDate?`로 변경하였습니다.
*   `DatePickerFooter`의 확인 버튼 클릭 시, 선택된 날짜가 존재할 때만(`selectedDate?`) `onConfirm` 콜백이 실행되도록 방어 로직을 추가하였습니다.
@HamBeomJoon HamBeomJoon merged commit 30a070a into develop Mar 27, 2026
2 checks passed
@HamBeomJoon HamBeomJoon deleted the refactor/#67-datepicker-modify branch March 27, 2026 03:34
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 지난 날짜에 대한 컴포넌트 수정

2 participants