Skip to content

Commit 1ca3117

Browse files
authored
[MERGE] #323 -> develop
[FIX/#323] ํ™ˆ, ํ•„ํ„ฐ๋ง ์žฌ์„ค์ • ๋ทฐ / 1์ฐจ QA ๋ฐ˜์˜
2 parents f93f578 + 6fb2d8a commit 1ca3117

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

โ€Žcore/designsystem/src/main/res/values/strings.xmlโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
<!--SortByBottom-->
3030
<string name="sort_by_earliest">์ฑ„์šฉ ๋งˆ๊ฐ ์ด๋ฅธ ์ˆœ</string>
31-
<string name="sort_by_shortest">์งง์€ ๊ทผ๋ฌด ๊ธฐ๊ฐ„ ์ˆœ</string>
32-
<string name="sort_by_longest">๊ธด ๊ทผ๋ฌด ๊ธฐ๊ฐ„ ์ˆœ</string>
31+
<string name="sort_by_shortest">๊ทผ๋ฌด ๊ธฐ๊ฐ„ ์งง์€ ์ˆœ</string>
32+
<string name="sort_by_longest">๊ทผ๋ฌด ๊ธฐ๊ฐ„ ๊ธด ์ˆœ</string>
3333
<string name="sort_by_scrap">์Šคํฌ๋žฉ ๋งŽ์€ ์ˆœ</string>
3434
<string name="sort_by_view_count">์กฐํšŒ์ˆ˜ ๋งŽ์€ ์ˆœ</string>
3535
<string name="sort_button_description">์ •๋ ฌ ๊ธฐ์ค€</string>

โ€Žfeature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.ktโ€Ž

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import androidx.compose.material3.HorizontalDivider
1717
import androidx.compose.material3.Text
1818
import androidx.compose.material3.rememberModalBottomSheetState
1919
import androidx.compose.runtime.Composable
20-
import androidx.compose.runtime.LaunchedEffect
2120
import androidx.compose.runtime.getValue
2221
import androidx.compose.runtime.mutableIntStateOf
2322
import androidx.compose.runtime.mutableStateOf
@@ -69,8 +68,12 @@ internal fun HomeFilteringBottomSheet(
6968
val density = LocalDensity.current
7069
var pageHeight by remember { mutableIntStateOf(0) }
7170

72-
LaunchedEffect(pagerState.currentPage) {
73-
currentFilteringInfo = defaultFilteringInfo
71+
var isCheckBoxChecked by remember {
72+
mutableStateOf(
73+
with(currentFilteringInfo) {
74+
listOf(grade, workingPeriod, startYear, startMonth).all { it == null || it == 0 }
75+
}
76+
)
7477
}
7578

7679
GetPagerHeight(
@@ -142,6 +145,7 @@ internal fun HomeFilteringBottomSheet(
142145
1 -> {
143146
PlanFilteringScreen(
144147
currentFilteringInfo = currentFilteringInfo,
148+
isCheckBoxChecked = isCheckBoxChecked,
145149
updateGrade = {
146150
currentFilteringInfo = currentFilteringInfo.copy(
147151
grade = if (it != null) {
@@ -166,6 +170,9 @@ internal fun HomeFilteringBottomSheet(
166170
startMonth = it
167171
)
168172
},
173+
updateIsCheckBoxChecked = {
174+
isCheckBoxChecked = it
175+
}
169176
)
170177
}
171178
}
@@ -189,7 +196,10 @@ internal fun HomeFilteringBottomSheet(
189196
)
190197
}
191198
},
192-
isEnabled = checkButtonEnable(currentFilteringInfo = currentFilteringInfo)
199+
isEnabled = checkButtonEnable(
200+
currentFilteringInfo = currentFilteringInfo,
201+
isCheckBoxChecked = isCheckBoxChecked
202+
)
193203
)
194204
}
195205

@@ -243,10 +253,12 @@ fun TerningTab(
243253
}
244254
}
245255

246-
private fun checkButtonEnable(currentFilteringInfo: HomeFilteringInfo): Boolean =
256+
private fun checkButtonEnable(
257+
currentFilteringInfo: HomeFilteringInfo,
258+
isCheckBoxChecked: Boolean
259+
): Boolean =
247260
with(currentFilteringInfo) {
248-
listOf(grade, workingPeriod, startYear, startMonth).all { it == null || it == 0 } ||
249-
listOf(grade, workingPeriod, startYear, startMonth).none { it == null || it == 0 }
261+
isCheckBoxChecked || listOf(grade, workingPeriod, startYear, startMonth).none { it == null }
250262
}
251263

252264
@Composable
@@ -255,6 +267,7 @@ private fun GetPagerHeight(
255267
) {
256268
PlanFilteringScreen(
257269
currentFilteringInfo = HomeFilteringInfo(null, null, null, null, "total"),
270+
isCheckBoxChecked = false,
258271
modifier = Modifier
259272
.onGloballyPositioned {
260273
onHeightMeasured(it.size.height)

โ€Žfeature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.ktโ€Ž

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ import kotlinx.collections.immutable.toImmutableList
4343
@Composable
4444
internal fun PlanFilteringScreen(
4545
currentFilteringInfo: HomeFilteringInfo,
46+
isCheckBoxChecked: Boolean,
4647
modifier: Modifier = Modifier,
4748
updateGrade: (Int?) -> Unit = {},
4849
updateWorkingPeriod: (Int?) -> Unit = {},
4950
updateStartYear: (Int?) -> Unit = {},
5051
updateStartMonth: (Int?) -> Unit = {},
52+
updateIsCheckBoxChecked: (Boolean) -> Unit = {},
5153
) {
5254
var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == 0 || currentFilteringInfo.startYear == null) }
5355
var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == 0 || currentFilteringInfo.startMonth == null) }
5456

55-
var isCheckBoxChecked by remember { mutableStateOf(false) }
56-
5757
var isInitialNullState by remember { mutableStateOf(false) }
5858

5959
val yearsList by remember(isYearNull) {
@@ -93,7 +93,7 @@ internal fun PlanFilteringScreen(
9393
).toImmutableList(),
9494
onButtonClick = {
9595
updateGrade(it)
96-
isCheckBoxChecked = false
96+
updateIsCheckBoxChecked(false)
9797
},
9898
columns = 4,
9999
modifier = Modifier
@@ -118,7 +118,7 @@ internal fun PlanFilteringScreen(
118118
).toImmutableList(),
119119
onButtonClick = {
120120
updateWorkingPeriod(it)
121-
isCheckBoxChecked = false
121+
updateIsCheckBoxChecked(false)
122122
},
123123
modifier = Modifier
124124
.padding(horizontal = 23.dp),
@@ -136,15 +136,15 @@ internal fun PlanFilteringScreen(
136136
onYearChosen = { year, isInitialSelection ->
137137
updateStartYear(year)
138138
if (year != null) {
139-
isCheckBoxChecked = false
139+
updateIsCheckBoxChecked(false)
140140
isYearNull = false
141141
isInitialNullState = isInitialSelection
142142
}
143143
},
144144
onMonthChosen = { month, isInitialSelection ->
145145
updateStartMonth(month)
146146
if (month != null) {
147-
isCheckBoxChecked = false
147+
updateIsCheckBoxChecked(false)
148148
isMonthNull = false
149149
isInitialNullState = isInitialSelection
150150
}
@@ -179,7 +179,7 @@ internal fun PlanFilteringScreen(
179179
updateStartYear(null)
180180
updateStartMonth(null)
181181
}
182-
isCheckBoxChecked = isChecked
182+
updateIsCheckBoxChecked(isChecked)
183183
},
184184
colors = CheckboxDefaults.colors(
185185
checkedColor = TerningMain,

0 commit comments

Comments
ย (0)