Skip to content

Commit

Permalink
[FEAT/#313] list -> immutableList 변경 및 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyobeen-Park committed Jan 4, 2025
1 parent 7cf5be0 commit 488d334
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ fun HomeScreen(

val homeFilteringInfo = when (homeState.homeFilteringInfoState) {
is UiState.Success -> (homeState.homeFilteringInfoState as UiState.Success<HomeFilteringInfo>).data
else -> HomeFilteringInfo(null, null, null, null, JobType.TOTAL.stringValue)
else -> HomeFilteringInfo(
grade = null,
workingPeriod = null,
startYear = null,
startMonth = null,
jobType = JobType.TOTAL.stringValue
)
}

val homeRecommendInternList: ImmutableList<HomeRecommendIntern.HomeRecommendInternDetail> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ private val filterType =
@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun HomeFilteringBottomSheet(
modifier: Modifier = Modifier,
defaultFilteringInfo: HomeFilteringInfo,
onDismiss: () -> Unit,
onChangeButtonClick: (String?, String?, Int?, Int?, String) -> Unit,
modifier: Modifier = Modifier,
) {
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)

Expand Down Expand Up @@ -98,7 +98,8 @@ internal fun HomeFilteringBottomSheet(
coroutineScope.launch {
pagerState.animateScrollToPage(index)
}
})
}
)
}
}

Expand Down Expand Up @@ -235,6 +236,6 @@ fun TerningTab(

private fun checkButtonEnable(currentFilteringInfo: HomeFilteringInfo): Boolean =
with(currentFilteringInfo) {
(grade == null && workingPeriod == null && startYear == null && startMonth == null)
|| (grade != null && workingPeriod != null && startYear != null && startMonth != null)
listOf(grade, workingPeriod, startYear, startMonth).all { it == null }
listOf(grade, workingPeriod, startYear, startMonth).none { it == null }
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import com.terning.core.designsystem.type.WorkingPeriod
import com.terning.core.designsystem.util.NoRippleInteractionSource
import com.terning.domain.home.entity.HomeFilteringInfo
import com.terning.feature.home.R
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -86,7 +87,7 @@ internal fun PlanFilteringScreen(
R.string.change_filter_grade_2,
R.string.change_filter_grade_3,
R.string.change_filter_grade_4,
),
).toImmutableList(),
onButtonClick = {
updateGrade(it)
isCheckBoxChecked = false
Expand All @@ -111,7 +112,7 @@ internal fun PlanFilteringScreen(
R.string.change_filter_period_1,
R.string.change_filter_period_2,
R.string.change_filter_period_3,
),
).toImmutableList(),
onButtonClick = {
updateWorkingPeriod(it)
isCheckBoxChecked = false
Expand Down Expand Up @@ -198,12 +199,12 @@ internal fun PlanFilteringScreen(

@Composable
private fun ChangePlanFilteringRadioGroup(
optionList: List<Int>,
optionList: ImmutableList<Int>,
initOption: Int,
isCheckBoxChecked: Boolean,
onButtonClick: (Int) -> Unit,
columns: Int = 3,
modifier: Modifier = Modifier,
columns: Int = 3,
) {
var selectedIndex by remember { mutableIntStateOf(initOption) }

Expand Down

0 comments on commit 488d334

Please sign in to comment.