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

[UI/#9] 월간 캘린더 화면 #18

Merged
merged 20 commits into from
Jul 9, 2024
Merged

Conversation

boiledEgg-s
Copy link
Member

⛳️ Work Description

  • 월 단위 캘린더뷰 구현
  • 페이징 처리를 통한 월간 트랜지션
  • 오늘 날짜 및 선택 날짜 표시
  • 날짜별 등록된 아이템 표시

📸 Screenshot

terning_calendar01.mp4

📢 To Reviewers

  • 월 단위 캘린더 먼저 구현해봤습니다!
  • 아직 데이터 연동은 구현하지 않았고, 뷰모델 안에 임시 데이터 넣어서 스크랩 관련 코드를 구현했습니다!!
  • 폴더링이 아직 제대로 안되어 있을텐데 차차 정리해나갈게요,, 코멘트 남겨주시면 반영하겠습니닷!!!
  • 사실 처음 스크롤할 때 약간 부자연스러운게 남아있는데,,,,,,,,,,,,,, 있는데

@boiledEgg-s boiledEgg-s added FEAT ✨ 새로운 기능 구현 UI 💐 UI 작업 석준💜 석준 labels Jul 7, 2024
@boiledEgg-s boiledEgg-s self-assigned this Jul 7, 2024
Copy link
Member

@leeeyubin leeeyubin left a comment

Choose a reason for hiding this comment

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

오늘부터 외칠게요 갓석준.
코드가 너무 맛있어서 보는 내내 행복했습니다,,,,
최고!!!!!!

Comment on lines +16 to +22

@Composable
fun CalendarMonths(
modifier: Modifier = Modifier,
listState: LazyListState,
onDateSelected: (LocalDate) -> Unit,
pages: Int,
Copy link
Member

Choose a reason for hiding this comment

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

CalendarMonths하고 CalendarMonth의 네이밍이 좀 더 구분이 됐으면 좋겠는데 마땅한 네이밍이 떠오르지 않네욤,,,,흠,,

Copy link
Member Author

Choose a reason for hiding this comment

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

혹시라도 나중에 좋은 아이디어 있으면 추천 부탁드려여~!!

Comment on lines 43 to 45
fun getPageCount(): Int {
return (END_YEAR - START_YEAR) * 12
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fun getPageCount(): Int {
return (END_YEAR - START_YEAR) * 12
}
fun getPageCount(): Int = (END_YEAR - START_YEAR) * 12

이렇게도 할 수 있을 것 같네용

Comment on lines +48 to +53
var currentDate by remember { mutableStateOf(selectedDate) }
var currentPage by remember { mutableIntStateOf(listState.firstVisibleItemIndex)}

var isListExpanded by remember { mutableStateOf(false) }
var isWeekEnabled by remember { mutableStateOf(false) }

Copy link
Member

Choose a reason for hiding this comment

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

줄바꿈도 너무 깔끔해요,,,,,,,

Comment on lines +54 to +58
LaunchedEffect(key1 = listState) {
snapshotFlow { listState.firstVisibleItemIndex }
.distinctUntilChanged()
.collect{
val swipeDirection = (listState.firstVisibleItemIndex - currentPage).coerceIn(-1, 1).toLong()
Copy link
Member

Choose a reason for hiding this comment

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

distinctUntilChanged()까지 폼미ㄷㄷ,,,,,,,,,

Comment on lines 1 to 5
package com.terning.feature.calendar

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
Copy link
Member

Choose a reason for hiding this comment

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

CalendarTopBarWeekDaysHeader는 component 패키지로 따로 빼도 괜찮을 것 같아요..!

캘린더 화면을 그리는 CalendarRoute, CalendarMonth, CalendarDay는 이대로 남겨도 괜찮을 것 같네용

Comment on lines +5 to +10

@Immutable
data class Scrap(
val text: String,
val backgroundColor: Color
)
Copy link
Member

Choose a reason for hiding this comment

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

@Immutable을 넣어준 이유는 불변함을 강조하기 위함인가용??

Copy link
Member Author

Choose a reason for hiding this comment

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

넵!! 사실 이게 레퍼런스에서 본 Month와 Day 데이터에서 착안한 아이디어인데, 스크랩 자체가 서버에서 받아오면 클라이언트 측에선 바꿀 일이 없을 것 같아서 조금이나마 성능에 도움이 될까봐 이렇게 구현해봤어요!!

Copy link
Contributor

@arinming arinming left a comment

Choose a reason for hiding this comment

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

복잡한 캘린더 합숙 전에 뚝딱 해내신거 존경,,,,,, 넘 잘하신다.

Comment on lines +80 to +85
onMonthNavigationButtonClicked = { direction ->
coroutineScope.launch {
listState.animateScrollToItem(
index = listState.firstVisibleItemIndex + direction,
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

animateScrollToItem으로 매끄럽게 전환할 수 있근여 🥹..!

Copy link
Member Author

Choose a reason for hiding this comment

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

LazyListState에서 사용하는 전환 방법이라고 하네요 :D

Copy link
Member

Choose a reason for hiding this comment

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

오호!! 이건 처음보는건데!! 좋네요😊

Comment on lines +101 to +102
CalendarMonths(
modifier = Modifier.fillMaxSize(),
Copy link
Contributor

Choose a reason for hiding this comment

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

CalendarMonths안에서 Column에 fillMaxSize이 적용되고 있는 것 같은데 여기서도 fillMaxSize를 넘겨주는 이유가 뭔가용?!

Copy link
Member Author

Choose a reason for hiding this comment

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

클래스 이름이랑 제 코딩 방식 때문에 혼동이 생긴 것 같네요,,,
CalendarMonths 내부에선 LazyRow가 해당 Modifier를 인자로 받아 사용하도록 구현돼있는데, 여기서 인자로 넘기지 않고 그냥 LazyRow 내부에서 사용해야 혼동이 없겠네요...

Comment on lines 45 to 48
style = TerningTheme.typography.body7,
color = if(day == R.string.calendar_text_sunday) SundayRed else Black,
fontSize = 13.sp,
textAlign = TextAlign.Center
Copy link
Contributor

Choose a reason for hiding this comment

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

style에서 body7 스타일을 적용해두었는데 따로 fontSize를 지정하신 이유가 있나요?! 피그마상에서도 12 사이즈인 것 같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

역시 예리하시네요!! 팀원들을 위한 이스터에그~ 가 아니라 제 부주의입니다ㅎㅎ 바로 수정할게요!!

Copy link
Member

@Hyobeen-Park Hyobeen-Park left a comment

Choose a reason for hiding this comment

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

갓석준 진짜 캘린더를 이렇게 빨리 구현한다구?!??? 진짜 최고다 짱이다!!!!!

scrapList: List<Scrap>
) {
LazyColumn(
modifier = modifier.fillMaxWidth().padding(top = 3.dp)
Copy link
Member

Choose a reason for hiding this comment

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

요거 줄바꿈 하면 더 보기 좋을 것 같아요!

Comment on lines +80 to +85
onMonthNavigationButtonClicked = { direction ->
coroutineScope.launch {
listState.animateScrollToItem(
index = listState.firstVisibleItemIndex + direction,
)
}
Copy link
Member

Choose a reason for hiding this comment

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

오호!! 이건 처음보는건데!! 좋네요😊

@boiledEgg-s boiledEgg-s merged commit 95ce7d0 into develop Jul 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FEAT ✨ 새로운 기능 구현 UI 💐 UI 작업 석준💜 석준
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UI] 캘린더뷰 / 월간 캘린더 구현
4 participants