Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] 캘린더 컴포넌트를 구현합니다. #19

Merged
merged 11 commits into from
Jul 26, 2024

Conversation

no1msh
Copy link
Contributor

@no1msh no1msh commented Jul 24, 2024

resolved #15

AS-IS

  • 캘린더 컴포저블 함수를

TO-BE

  • 구현합니다.
  • 캘린더 도메인 로직중 누락된 현재 날짜가 포함된 달의 모든 날들을 가져오는 도메인로직을 구현합니다.

KEY-POINT

  • 막상 캘린더 컴포넌트를 만들 때 도메인 로직에 대한 취약성을 느껴 같이 수정하였습니다.
    • 물론 변경 사항에 따른 테스트 코드도 함께 추가하였습니다.
    • 추후 이런 일이 발생시 PR을 나누는 등 조치를 취하는 것이 좀더 리뷰할때 집중하기 편할 것 같습니다.

SCREENSHOT (Optional)

캘린더 시연

@no1msh no1msh requested a review from librarywon July 24, 2024 13:01
@no1msh no1msh self-assigned this Jul 24, 2024
Copy link
Contributor

@librarywon librarywon left a comment

Choose a reason for hiding this comment

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

캘린더 기능 개발하시느라 고생 많이 하셨습니다 쭉 코드를 정독해보았고 몇가지 코멘트를 작성 하였는데 확인해주시면 좋을 것 같습니다.


class Calendar(
initDate: LocalDate = LocalDate.now(),
private val dateTimeFormatter: DateTimeFormatter =
DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT_PATTERN),
DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT_PATTERN).withLocale(Locale.ENGLISH),
Copy link
Contributor

Choose a reason for hiding this comment

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

Locale.ENGLISH 를 적용하신 이유가 무엇인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

명시해주지 않으면 의도와는 다르게 디폴트로 들어가는 인자가 1월 2024 이런식으로 디바이스의 언어설정 기준으로 들어가게 됩니다.
디자인상으로 의도된건 Jan 2024와 같은 영어약어의 표현이기 때문에 해당 Locale 설정을 추가하였습니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

오 디바이스 언어를 인식하는줄은 몰랐습니다! 새로운 사실을 배워가네요

Comment on lines 58 to 78
Row(modifier = Modifier.padding(bottom = 8.dp)) {
DayOfWeek.entries.forEach { dayOfWeek ->
DayOfWeek(
name = dayOfWeek.abbreviation,
modifier = Modifier.weight(1f),
)
}
}
LazyVerticalGrid(
columns = GridCells.Fixed(7),
verticalArrangement = Arrangement.spacedBy(DAY_DEFAULT_MARGIN.dp),
horizontalArrangement = Arrangement.spacedBy(DAY_DEFAULT_MARGIN.dp),
) {
items((days.first().date.dayOfWeek.ordinal + 1) % 7) {
Box(modifier = Modifier.weight(1f))
}

items(days) {
Day(studyDay = it, modifier = Modifier.weight(1f))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

월을 표시하는 로직과 일을 표시하는 로직을 분리하면 가독성이더 좋아지지 않을까 제안드려봅니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영완료 하였습니다. 가독성을 위한 분리를 해보고 추후 장단점을 피부로 같이 느껴보는 시간을 가졌음 좋겠습니다!

변경 커밋

Comment on lines +40 to +44
Then("윤년이기 때문에 1부터 29일까지 반환된다.") {
actual = calendar.getMonth()
actual.first().date shouldBe LocalDate.of(2024, 2, 1)
actual.last().date shouldBe LocalDate.of(2024, 2, 29)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

윤년처리까지 치밀하게 테스트 해보셨군요..!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

워낙에 애초에 잘 짜여진 Java의 라이브러리다 보니 엣지케이스 위주로 테스트를 진행하였습니다!

@librarywon
Copy link
Contributor

추가적으로 월을 표기하는 곳에 디자인 변경사항이 발생했으니 그것도 반영해주시면 좋을 것 같습니다.

Copy link
Contributor

@librarywon librarywon left a comment

Choose a reason for hiding this comment

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

의견 토론해주셔서 감사합니다 수고하셨습니다!

@no1msh no1msh merged commit 7b08059 into develop Jul 26, 2024
1 check passed
@no1msh no1msh deleted the Feature/#15-calendar-component branch July 26, 2024 15:36
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.

[Feature] 캘린더 컴포넌트를 구현합니다.
2 participants