diff --git a/core/src/main/java/com/gdg/core/designsystem/component/calendar/Calendar.kt b/core/src/main/java/com/gdg/core/designsystem/component/calendar/Calendar.kt index 2e0fe57..41a2679 100644 --- a/core/src/main/java/com/gdg/core/designsystem/component/calendar/Calendar.kt +++ b/core/src/main/java/com/gdg/core/designsystem/component/calendar/Calendar.kt @@ -34,8 +34,11 @@ import com.gdg.core.designsystem.theme.CrowdZeroTheme import com.gdg.core.extension.noRippleClickable import com.gdg.core.util.getDaysForMonth import okhttp3.internal.immutableListOf +import java.time.DayOfWeek import java.time.LocalDate import java.time.YearMonth +import java.time.format.TextStyle +import java.util.Locale @Composable fun CalendarComponent( @@ -45,6 +48,7 @@ fun CalendarComponent( onDateSelected: (LocalDate) -> Unit, ) { val days = remember(currentMonth) { getDaysForMonth(currentMonth) } + val firstDayOfWeek = DayOfWeek.SUNDAY // 일요일을 주의 시작으로 변경 Column( modifier = Modifier @@ -93,7 +97,17 @@ fun CalendarComponent( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceAround ) { - immutableListOf("일", "월", "화", "수", "목", "금", "토").forEach { day -> + val weekDays = immutableListOf( + DayOfWeek.SUNDAY, + DayOfWeek.MONDAY, + DayOfWeek.TUESDAY, + DayOfWeek.WEDNESDAY, + DayOfWeek.THURSDAY, + DayOfWeek.FRIDAY, + DayOfWeek.SATURDAY + ) + weekDays.forEach { dayOfWeek -> + val day = dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN) Text( text = day, style = CrowdZeroTheme.typography.c2Medium2, @@ -106,11 +120,14 @@ fun CalendarComponent( columns = GridCells.Fixed(7), modifier = Modifier.fillMaxWidth() ) { + val emptyDays = (days.first().dayOfWeek.value % 7 - firstDayOfWeek.value + 7) % 7 + items(emptyDays) { + Box(modifier = Modifier.aspectRatio(1f)) + } items(days) { date -> val isSelected = date == selectedDate Box( modifier = Modifier - .weight(1f) .aspectRatio(1f) .padding(5.dp) .background( diff --git a/feature/src/main/java/com/gdg/feature/calendar/CalendarRoute.kt b/feature/src/main/java/com/gdg/feature/calendar/CalendarRoute.kt index 9724626..16c687c 100644 --- a/feature/src/main/java/com/gdg/feature/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/gdg/feature/calendar/CalendarRoute.kt @@ -222,29 +222,33 @@ fun CalendarInfoBox(data: ScheduleEntity) { .background(CrowdZeroTheme.colors.white) .padding(dimensionResource(R.dimen.default_padding)) ) { - Text( - text = data.duration, - style = CrowdZeroTheme.typography.c4SemiBold, - color = CrowdZeroTheme.colors.green600 - ) Row( - modifier = Modifier - .fillMaxWidth() - .padding(vertical = 2.dp), + modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically ) { Text( modifier = Modifier.padding(end = 8.dp), - text = data.location, - style = CrowdZeroTheme.typography.h5Bold, - color = CrowdZeroTheme.colors.gray900 + text = data.duration, + style = CrowdZeroTheme.typography.c4SemiBold, + color = CrowdZeroTheme.colors.green600 ) Text( text = data.region, style = CrowdZeroTheme.typography.c4SemiBold, - color = CrowdZeroTheme.colors.gray600 + color = CrowdZeroTheme.colors.white, + modifier = Modifier + .background( + color = CrowdZeroTheme.colors.green600, + shape = RoundedCornerShape(30.dp) + ) + .padding(horizontal = 8.dp, vertical = 3.dp) ) } + Text( + text = data.location.replace("\n", " "), + style = CrowdZeroTheme.typography.h5Bold, + color = CrowdZeroTheme.colors.gray900 + ) Row( modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically @@ -274,7 +278,7 @@ fun CalendarInfoBox(data: ScheduleEntity) { color = CrowdZeroTheme.colors.gray600 ) Text( - text = data.jurisdiction, + text = data.jurisdiction.replace("\n", " "), style = CrowdZeroTheme.typography.c3Regular, color = CrowdZeroTheme.colors.gray800 ) @@ -296,6 +300,14 @@ fun CalendarScreenPreview() { region = "한남동", people = "3000", jurisdiction = "용산" + ), + ScheduleEntity( + date = LocalDate.now().toString(), + duration = "07:30 ~ 24:00", + location = "두터교회 앞 인도 및 2개 차로두터교회 앞 인도 및 2개 차로두터교회 앞 인도 및 2개 차로", + region = "한남동", + people = "3000", + jurisdiction = "용산" ) ) ), @@ -303,4 +315,4 @@ fun CalendarScreenPreview() { onDateSelected = {} ) } -} \ No newline at end of file +} diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index bd87730..e494eea 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -53,6 +53,7 @@ %1$s명 / 관할시 + ", " 해당 날짜의 집회 정보가 없습니다 해당 날짜의 집회 정보를 가져오지 못했어요 혼잡도 api 오류 : %1$s diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 75419ae..77c7302 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -82,7 +82,6 @@ naver-map-compose = "1.7.2" naver-map-location = "21.0.2" play-services-location = "21.0.1" - [plugins] ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } # Kotlin Symbol Processing (KSP) 플러그인 kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } # Kotlin Android 플러그인