Skip to content

Commit

Permalink
[MERGE] #323 -> develop
Browse files Browse the repository at this point in the history
[FIX/#323] ν™ˆ, 필터링 μž¬μ„€μ • λ·° / 1μ°¨ QA 반영
  • Loading branch information
Hyobeen-Park authored Jan 9, 2025
2 parents f93f578 + 6fb2d8a commit 1ca3117
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
4 changes: 2 additions & 2 deletions core/designsystem/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

<!--SortByBottom-->
<string name="sort_by_earliest">μ±„μš© 마감 이λ₯Έ 순</string>
<string name="sort_by_shortest">짧은 근무 κΈ°κ°„ 순</string>
<string name="sort_by_longest">κΈ΄ 근무 κΈ°κ°„ 순</string>
<string name="sort_by_shortest">근무 κΈ°κ°„ 짧은 순</string>
<string name="sort_by_longest">근무 κΈ°κ°„ κΈ΄ 순</string>
<string name="sort_by_scrap">슀크랩 λ§Žμ€ 순</string>
<string name="sort_by_view_count">쑰회수 λ§Žμ€ 순</string>
<string name="sort_button_description">μ •λ ¬ κΈ°μ€€</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -69,8 +68,12 @@ internal fun HomeFilteringBottomSheet(
val density = LocalDensity.current
var pageHeight by remember { mutableIntStateOf(0) }

LaunchedEffect(pagerState.currentPage) {
currentFilteringInfo = defaultFilteringInfo
var isCheckBoxChecked by remember {
mutableStateOf(
with(currentFilteringInfo) {
listOf(grade, workingPeriod, startYear, startMonth).all { it == null || it == 0 }
}
)
}

GetPagerHeight(
Expand Down Expand Up @@ -142,6 +145,7 @@ internal fun HomeFilteringBottomSheet(
1 -> {
PlanFilteringScreen(
currentFilteringInfo = currentFilteringInfo,
isCheckBoxChecked = isCheckBoxChecked,
updateGrade = {
currentFilteringInfo = currentFilteringInfo.copy(
grade = if (it != null) {
Expand All @@ -166,6 +170,9 @@ internal fun HomeFilteringBottomSheet(
startMonth = it
)
},
updateIsCheckBoxChecked = {
isCheckBoxChecked = it
}
)
}
}
Expand All @@ -189,7 +196,10 @@ internal fun HomeFilteringBottomSheet(
)
}
},
isEnabled = checkButtonEnable(currentFilteringInfo = currentFilteringInfo)
isEnabled = checkButtonEnable(
currentFilteringInfo = currentFilteringInfo,
isCheckBoxChecked = isCheckBoxChecked
)
)
}

Expand Down Expand Up @@ -243,10 +253,12 @@ fun TerningTab(
}
}

private fun checkButtonEnable(currentFilteringInfo: HomeFilteringInfo): Boolean =
private fun checkButtonEnable(
currentFilteringInfo: HomeFilteringInfo,
isCheckBoxChecked: Boolean
): Boolean =
with(currentFilteringInfo) {
listOf(grade, workingPeriod, startYear, startMonth).all { it == null || it == 0 } ||
listOf(grade, workingPeriod, startYear, startMonth).none { it == null || it == 0 }
isCheckBoxChecked || listOf(grade, workingPeriod, startYear, startMonth).none { it == null }
}

@Composable
Expand All @@ -255,6 +267,7 @@ private fun GetPagerHeight(
) {
PlanFilteringScreen(
currentFilteringInfo = HomeFilteringInfo(null, null, null, null, "total"),
isCheckBoxChecked = false,
modifier = Modifier
.onGloballyPositioned {
onHeightMeasured(it.size.height)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ import kotlinx.collections.immutable.toImmutableList
@Composable
internal fun PlanFilteringScreen(
currentFilteringInfo: HomeFilteringInfo,
isCheckBoxChecked: Boolean,
modifier: Modifier = Modifier,
updateGrade: (Int?) -> Unit = {},
updateWorkingPeriod: (Int?) -> Unit = {},
updateStartYear: (Int?) -> Unit = {},
updateStartMonth: (Int?) -> Unit = {},
updateIsCheckBoxChecked: (Boolean) -> Unit = {},
) {
var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == 0 || currentFilteringInfo.startYear == null) }
var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == 0 || currentFilteringInfo.startMonth == null) }

var isCheckBoxChecked by remember { mutableStateOf(false) }

var isInitialNullState by remember { mutableStateOf(false) }

val yearsList by remember(isYearNull) {
Expand Down Expand Up @@ -93,7 +93,7 @@ internal fun PlanFilteringScreen(
).toImmutableList(),
onButtonClick = {
updateGrade(it)
isCheckBoxChecked = false
updateIsCheckBoxChecked(false)
},
columns = 4,
modifier = Modifier
Expand All @@ -118,7 +118,7 @@ internal fun PlanFilteringScreen(
).toImmutableList(),
onButtonClick = {
updateWorkingPeriod(it)
isCheckBoxChecked = false
updateIsCheckBoxChecked(false)
},
modifier = Modifier
.padding(horizontal = 23.dp),
Expand All @@ -136,15 +136,15 @@ internal fun PlanFilteringScreen(
onYearChosen = { year, isInitialSelection ->
updateStartYear(year)
if (year != null) {
isCheckBoxChecked = false
updateIsCheckBoxChecked(false)
isYearNull = false
isInitialNullState = isInitialSelection
}
},
onMonthChosen = { month, isInitialSelection ->
updateStartMonth(month)
if (month != null) {
isCheckBoxChecked = false
updateIsCheckBoxChecked(false)
isMonthNull = false
isInitialNullState = isInitialSelection
}
Expand Down Expand Up @@ -179,7 +179,7 @@ internal fun PlanFilteringScreen(
updateStartYear(null)
updateStartMonth(null)
}
isCheckBoxChecked = isChecked
updateIsCheckBoxChecked(isChecked)
},
colors = CheckboxDefaults.colors(
checkedColor = TerningMain,
Expand Down

0 comments on commit 1ca3117

Please sign in to comment.