From 81e07694f4b1256514e071f95550d369330607f5 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 02:29:51 +0900 Subject: [PATCH] =?UTF-8?q?[DEL/#309]=20=EB=A1=9C=EA=B7=B8=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 24 +++++++------------ .../home/component/HomeYearMonthPicker.kt | 19 ++++----------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index 7cc4fa1e..9ba7907d 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -1,6 +1,5 @@ package com.terning.feature.home.component -import android.util.Log import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth @@ -19,7 +18,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -35,10 +33,6 @@ import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.Grade import com.terning.core.designsystem.type.WorkingPeriod -import com.terning.core.designsystem.util.CalendarDefaults.END_MONTH -import com.terning.core.designsystem.util.CalendarDefaults.END_YEAR -import com.terning.core.designsystem.util.CalendarDefaults.START_MONTH -import com.terning.core.designsystem.util.CalendarDefaults.START_YEAR import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @@ -67,14 +61,6 @@ fun HomeFilteringBottomSheet( ) } - // todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기 - var isYearNull by remember { mutableStateOf(false) } - var isMonthNull by remember { mutableStateOf(false) } - // todo: year와 month의 서버통신 값이 null이면 true로 넣기 - var isCheck by remember { mutableStateOf(false) } - - var isFirstNullAndFirstChange by remember { mutableStateOf(false) } - TerningBasicBottomSheet( content = { Column( @@ -147,9 +133,15 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp) ) - val years = (START_YEAR..END_YEAR).map { "${it}년" } - val months = (START_MONTH..END_MONTH).map { "${it}월" } + // todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기 + var isYearNull by remember { mutableStateOf(false) } + var isMonthNull by remember { mutableStateOf(false) } + // todo: year와 month의 서버통신 값이 null이면 true로 넣기 + var isCheck by remember { mutableStateOf(false) } + + var isFirstNullAndFirstChange by remember { mutableStateOf(false) } + // todo: 변수명 바꾸기 val yearsWithNull by remember(isYearNull) { mutableStateOf( if (isYearNull || isFirstNullAndFirstChange) years + "-" diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 6063f1a0..14d0679b 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -1,6 +1,5 @@ package com.terning.feature.home.component -import android.util.Log import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -43,11 +42,9 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import okhttp3.internal.toImmutableList -private val years = - (START_YEAR..END_YEAR).map { "${it}년" }.toImmutableList() +val years = (START_YEAR..END_YEAR).map { "${it}년" }.toImmutableList() -private val months = - (START_MONTH..END_MONTH).map { "${it}월" }.toImmutableList() +val months = (START_MONTH..END_MONTH).map { "${it}월" }.toImmutableList() class PickerState { var selectedItem by mutableStateOf("") @@ -69,19 +66,15 @@ fun HomeYearMonthPicker( months: List, isFirstNullAndFirstChange: Boolean ) { - // todo: 변수명 바꾸기 -// val yearsWithNull = if (isYearNull) years + "-" else years -// val monthsWithNull = if (isMonthNull) months + "-" else months - val yearPickerState = rememberPickerState() val monthPickerState = rememberPickerState() var isFirst = isFirstNullAndFirstChange val startYearIndex = remember(isYearNull) { - if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}년") - .takeIf { it >= 0 } ?: 0 - } + if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}년") + .takeIf { it >= 0 } ?: 0 + } val startMonthIndex = remember(isMonthNull) { if (isMonthNull) months.lastIndex else months.indexOf("${chosenMonth ?: "-"}월") @@ -156,7 +149,6 @@ fun DatePicker( .map { index -> var newItem = items if (isNullSize) newItem = items + "-" - Log.d("PickerDebug", "Index: $index, Item: ${newItem.getOrNull(index)}") newItem.getOrNull(index) } .distinctUntilChanged() @@ -164,7 +156,6 @@ fun DatePicker( item?.let { pickerState.selectedItem = it onItemSelected(it) - Log.d("PickerDebug", "Selected Item: $it") } } }