From 93a540f4c3a32c302b41938d0928028a9ce8bcf9 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 20 Dec 2024 19:25:43 +0900 Subject: [PATCH 01/27] =?UTF-8?q?[ADD/#313]=20=EC=95=84=EC=9D=B4=EC=BD=98?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/drawable/ic_job_accounting_24.xml | 56 +++++++++++++++ .../src/main/res/drawable/ic_job_all_24.xml | 30 ++++++++ .../main/res/drawable/ic_job_design_24.xml | 31 +++++++++ .../src/main/res/drawable/ic_job_extra_24.xml | 24 +++++++ .../src/main/res/drawable/ic_job_it_24.xml | 44 ++++++++++++ .../main/res/drawable/ic_job_marketing_24.xml | 31 +++++++++ .../src/main/res/drawable/ic_job_plan_24.xml | 68 +++++++++++++++++++ .../main/res/drawable/ic_job_research_24.xml | 41 +++++++++++ .../src/main/res/drawable/ic_job_sales_24.xml | 68 +++++++++++++++++++ 9 files changed, 393 insertions(+) create mode 100644 feature/home/src/main/res/drawable/ic_job_accounting_24.xml create mode 100644 feature/home/src/main/res/drawable/ic_job_all_24.xml create mode 100644 feature/home/src/main/res/drawable/ic_job_design_24.xml create mode 100644 feature/home/src/main/res/drawable/ic_job_extra_24.xml create mode 100644 feature/home/src/main/res/drawable/ic_job_it_24.xml create mode 100644 feature/home/src/main/res/drawable/ic_job_marketing_24.xml create mode 100644 feature/home/src/main/res/drawable/ic_job_plan_24.xml create mode 100644 feature/home/src/main/res/drawable/ic_job_research_24.xml create mode 100644 feature/home/src/main/res/drawable/ic_job_sales_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_accounting_24.xml b/feature/home/src/main/res/drawable/ic_job_accounting_24.xml new file mode 100644 index 00000000..a6e01c86 --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_accounting_24.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + diff --git a/feature/home/src/main/res/drawable/ic_job_all_24.xml b/feature/home/src/main/res/drawable/ic_job_all_24.xml new file mode 100644 index 00000000..be926f90 --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_all_24.xml @@ -0,0 +1,30 @@ + + + + + + diff --git a/feature/home/src/main/res/drawable/ic_job_design_24.xml b/feature/home/src/main/res/drawable/ic_job_design_24.xml new file mode 100644 index 00000000..f8c06562 --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_design_24.xml @@ -0,0 +1,31 @@ + + + + + + + diff --git a/feature/home/src/main/res/drawable/ic_job_extra_24.xml b/feature/home/src/main/res/drawable/ic_job_extra_24.xml new file mode 100644 index 00000000..2368d1f2 --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_extra_24.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/feature/home/src/main/res/drawable/ic_job_it_24.xml b/feature/home/src/main/res/drawable/ic_job_it_24.xml new file mode 100644 index 00000000..73ce99d7 --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_it_24.xml @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/feature/home/src/main/res/drawable/ic_job_marketing_24.xml b/feature/home/src/main/res/drawable/ic_job_marketing_24.xml new file mode 100644 index 00000000..7fded015 --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_marketing_24.xml @@ -0,0 +1,31 @@ + + + + + + + diff --git a/feature/home/src/main/res/drawable/ic_job_plan_24.xml b/feature/home/src/main/res/drawable/ic_job_plan_24.xml new file mode 100644 index 00000000..e3509dfe --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_plan_24.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + diff --git a/feature/home/src/main/res/drawable/ic_job_research_24.xml b/feature/home/src/main/res/drawable/ic_job_research_24.xml new file mode 100644 index 00000000..83d0f880 --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_research_24.xml @@ -0,0 +1,41 @@ + + + + + + + + diff --git a/feature/home/src/main/res/drawable/ic_job_sales_24.xml b/feature/home/src/main/res/drawable/ic_job_sales_24.xml new file mode 100644 index 00000000..25793d5e --- /dev/null +++ b/feature/home/src/main/res/drawable/ic_job_sales_24.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + From dc561945d2e489c7083e71bc5918bfc21d575ff9 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 20 Dec 2024 19:27:14 +0900 Subject: [PATCH 02/27] =?UTF-8?q?[MOD/#313]=20=EA=B3=84=ED=9A=8D=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EB=A7=81=20=ED=95=A8=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/home/HomeRoute.kt | 7 +- .../component/HomeFilteringBottomSheet.kt | 216 ++++++++++-------- 2 files changed, 122 insertions(+), 101 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index 9cb4c1b5..085aeed3 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -190,13 +190,8 @@ fun HomeScreen( if (changeFilteringSheetState) { HomeFilteringBottomSheet( - defaultGrade = homeFilteringInfo.grade?.let { Grade.fromString(it) }, - defaultWorkingPeriod = homeFilteringInfo.workingPeriod?.let { - WorkingPeriod.fromString(it) - }, - defaultStartYear = homeFilteringInfo.startYear, - defaultStartMonth = homeFilteringInfo.startMonth, onDismiss = { changeFilteringSheetState = false }, + defaultFilteringInfo = homeFilteringInfo, onChangeButtonClick = { grade, workingPeriod, year, month -> amplitudeTracker.track( type = EventType.CLICK, 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 27fb6e5b..e97dce72 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 @@ -21,6 +21,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.R import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet import com.terning.core.designsystem.component.button.ChangeFilterButton import com.terning.core.designsystem.component.button.RoundButton @@ -31,33 +32,21 @@ 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.R +import com.terning.domain.home.entity.HomeFilteringInfo import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @Composable fun HomeFilteringBottomSheet( modifier: Modifier = Modifier, - defaultGrade: Grade?, - defaultWorkingPeriod: WorkingPeriod?, - defaultStartYear: Int?, - defaultStartMonth: Int?, + defaultFilteringInfo: HomeFilteringInfo, onDismiss: () -> Unit, onChangeButtonClick: (String, String, Int, Int) -> Unit, ) { val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) - var currentGrade by remember { mutableStateOf(defaultGrade) } - var currentPeriod by remember { mutableStateOf(defaultWorkingPeriod) } - var currentStartYear by remember { - mutableIntStateOf( - defaultStartYear ?: Calendar.getInstance().currentYear - ) - } - var currentStartMonth by remember { - mutableIntStateOf( - defaultStartMonth ?: Calendar.getInstance().currentMonth - ) + var currentFilteringInfo by remember { + mutableStateOf(defaultFilteringInfo) } TerningBasicBottomSheet( @@ -66,79 +55,30 @@ fun HomeFilteringBottomSheet( modifier = modifier .fillMaxWidth(), ) { - Text( - text = stringResource(id = R.string.change_filter_top_bar_title), - style = TerningTheme.typography.title2, - color = Black, - modifier = Modifier - .padding(horizontal = 24.dp) - .padding(bottom = 16.dp), - ) - - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_grade_title), - modifier = Modifier - .padding(top = 18.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) - ) - - ChangeFilteringRadioGroup( - initOption = defaultGrade?.ordinal ?: -1, - optionList = listOf( - R.string.change_filter_grade_1, - R.string.change_filter_grade_2, - R.string.change_filter_grade_3, - R.string.change_filter_grade_4, - ), - onButtonClick = { index -> - currentGrade = Grade.entries[index] + PlanFilteringScreen( + currentFilteringInfo = currentFilteringInfo, + updateGrade = { + currentFilteringInfo = currentFilteringInfo.copy( + grade = Grade.entries[it].stringValue + ) }, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_period_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) - ) - - ChangeFilteringRadioGroup( - initOption = defaultWorkingPeriod?.ordinal ?: -1, - optionList = listOf( - R.string.change_filter_period_1, - R.string.change_filter_period_2, - R.string.change_filter_period_3, - ), - onButtonClick = { index -> - currentPeriod = WorkingPeriod.entries[index] + updateWorkingPeriod = { + currentFilteringInfo = currentFilteringInfo.copy( + workingPeriod = WorkingPeriod.entries[it].stringValue + ) + }, + updateStartYear = { + currentFilteringInfo = currentFilteringInfo.copy( + startYear = it + ) + }, + updateStartMonth = { + currentFilteringInfo = currentFilteringInfo.copy( + startMonth = it + ) }, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_start_work_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 49.dp) - .padding(horizontal = 24.dp) ) - YearMonthPicker( - chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, - chosenMonth = defaultStartMonth - ?: Calendar.getInstance().currentMonth, - onYearChosen = { currentStartYear = it }, - onMonthChosen = { currentStartMonth = it } - ) RoundButton( style = TerningTheme.typography.button0, paddingVertical = 19.dp, @@ -148,18 +88,22 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp) .padding(top = 51.dp), onButtonClick = { - currentGrade?.let { grade -> - currentPeriod?.let { workingPeriod -> - onChangeButtonClick( - grade.stringValue, - workingPeriod.stringValue, - currentStartYear, - currentStartMonth, - ) + currentFilteringInfo.grade?.let { + currentFilteringInfo.workingPeriod?.let { it1 -> + currentFilteringInfo.startYear?.let { it2 -> + currentFilteringInfo.startMonth?.let { it3 -> + onChangeButtonClick( + it, + it1, + it2, + it3 + ) + } + } } } }, - isEnabled = currentGrade != null && currentPeriod != null + isEnabled = currentFilteringInfo.grade != null && currentFilteringInfo.workingPeriod != null ) } @@ -169,6 +113,87 @@ fun HomeFilteringBottomSheet( ) } +@Composable +fun PlanFilteringScreen( + currentFilteringInfo: HomeFilteringInfo, + updateGrade: (Int) -> Unit, + updateWorkingPeriod: (Int) -> Unit, + updateStartYear: (Int) -> Unit, + updateStartMonth: (Int) -> Unit, +) { + Text( + text = stringResource(id = R.string.change_filter_top_bar_title), + style = TerningTheme.typography.title2, + color = Black, + modifier = Modifier + .padding(horizontal = 24.dp) + .padding(bottom = 16.dp), + ) + + HorizontalDivider( + thickness = 1.dp, + color = Grey200, + modifier = Modifier + .padding(horizontal = 24.dp), + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_grade_title), + modifier = Modifier + .padding(top = 18.dp, bottom = 12.dp) + .padding(horizontal = 24.dp) + ) + + ChangeFilteringRadioGroup( + initOption = currentFilteringInfo.grade?.let { Grade.fromString(it).ordinal } ?: -1, + optionList = listOf( + R.string.change_filter_grade_1, + R.string.change_filter_grade_2, + R.string.change_filter_grade_3, + R.string.change_filter_grade_4, + ), + onButtonClick = updateGrade, + columns = 4, + modifier = Modifier + .padding(horizontal = 24.dp), + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_period_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 12.dp) + .padding(horizontal = 24.dp) + ) + + ChangeFilteringRadioGroup( + initOption = currentFilteringInfo.workingPeriod?.let { WorkingPeriod.fromString(it).ordinal } + ?: -1, + optionList = listOf( + R.string.change_filter_period_1, + R.string.change_filter_period_2, + R.string.change_filter_period_3, + ), + onButtonClick = updateWorkingPeriod, + modifier = Modifier + .padding(horizontal = 24.dp), + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_start_work_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 49.dp) + .padding(horizontal = 24.dp) + ) + + YearMonthPicker( + chosenYear = currentFilteringInfo.startYear ?: Calendar.getInstance().currentYear, + chosenMonth = currentFilteringInfo.startMonth + ?: Calendar.getInstance().currentMonth, + onYearChosen = updateStartYear, + onMonthChosen = updateStartMonth, + ) +} + @Composable fun ChangeFilteringTitleText( text: String, @@ -187,12 +212,13 @@ fun ChangeFilteringRadioGroup( optionList: List, initOption: Int, onButtonClick: (Int) -> Unit, + columns: Int = 3, modifier: Modifier = Modifier, ) { var selectedIndex by remember { mutableIntStateOf(initOption) } LazyVerticalGrid( - columns = GridCells.Fixed(optionList.size), + columns = GridCells.Fixed(columns), horizontalArrangement = Arrangement.spacedBy(13.dp), modifier = modifier .fillMaxWidth() From df9e341fbcabb390274cc5d2f6e063ac2ed891fa Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 20 Dec 2024 19:36:25 +0900 Subject: [PATCH 03/27] =?UTF-8?q?[CHORE/#313]=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/home/HomeRoute.kt | 4 +- .../HomeFilteringBottomSheet.kt | 89 +--------------- .../bottomsheet/PlanFilteringScreen.kt | 100 ++++++++++++++++++ .../{ => bottomsheet}/YearMonthPicker.kt | 2 +- 4 files changed, 103 insertions(+), 92 deletions(-) rename feature/home/src/main/java/com/terning/feature/home/component/{ => bottomsheet}/HomeFilteringBottomSheet.kt (66%) create mode 100644 feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt rename feature/home/src/main/java/com/terning/feature/home/component/{ => bottomsheet}/YearMonthPicker.kt (99%) diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index 085aeed3..933ce9a4 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -43,14 +43,12 @@ import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White -import com.terning.core.designsystem.type.Grade -import com.terning.core.designsystem.type.WorkingPeriod import com.terning.domain.home.entity.HomeFilteringInfo import com.terning.domain.home.entity.HomeRecommendIntern import com.terning.domain.home.entity.HomeUpcomingIntern import com.terning.feature.dialog.cancel.ScrapCancelDialog import com.terning.feature.dialog.detail.ScrapDialog -import com.terning.feature.home.component.HomeFilteringBottomSheet +import com.terning.feature.home.component.bottomsheet.HomeFilteringBottomSheet import com.terning.feature.home.component.HomeFilteringScreen import com.terning.feature.home.component.HomeRecommendEmptyIntern import com.terning.feature.home.component.HomeUpcomingEmptyFilter 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/bottomsheet/HomeFilteringBottomSheet.kt similarity index 66% rename from feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt rename to feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index e97dce72..007fe7a0 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/bottomsheet/HomeFilteringBottomSheet.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.component +package com.terning.feature.home.component.bottomsheet import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -9,7 +9,6 @@ import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Text import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable @@ -19,21 +18,16 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.terning.core.designsystem.R import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet import com.terning.core.designsystem.component.button.ChangeFilterButton import com.terning.core.designsystem.component.button.RoundButton -import com.terning.core.designsystem.extension.currentMonth -import com.terning.core.designsystem.extension.currentYear import com.terning.core.designsystem.theme.Black -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.domain.home.entity.HomeFilteringInfo -import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -113,87 +107,6 @@ fun HomeFilteringBottomSheet( ) } -@Composable -fun PlanFilteringScreen( - currentFilteringInfo: HomeFilteringInfo, - updateGrade: (Int) -> Unit, - updateWorkingPeriod: (Int) -> Unit, - updateStartYear: (Int) -> Unit, - updateStartMonth: (Int) -> Unit, -) { - Text( - text = stringResource(id = R.string.change_filter_top_bar_title), - style = TerningTheme.typography.title2, - color = Black, - modifier = Modifier - .padding(horizontal = 24.dp) - .padding(bottom = 16.dp), - ) - - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_grade_title), - modifier = Modifier - .padding(top = 18.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) - ) - - ChangeFilteringRadioGroup( - initOption = currentFilteringInfo.grade?.let { Grade.fromString(it).ordinal } ?: -1, - optionList = listOf( - R.string.change_filter_grade_1, - R.string.change_filter_grade_2, - R.string.change_filter_grade_3, - R.string.change_filter_grade_4, - ), - onButtonClick = updateGrade, - columns = 4, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_period_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) - ) - - ChangeFilteringRadioGroup( - initOption = currentFilteringInfo.workingPeriod?.let { WorkingPeriod.fromString(it).ordinal } - ?: -1, - optionList = listOf( - R.string.change_filter_period_1, - R.string.change_filter_period_2, - R.string.change_filter_period_3, - ), - onButtonClick = updateWorkingPeriod, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_start_work_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 49.dp) - .padding(horizontal = 24.dp) - ) - - YearMonthPicker( - chosenYear = currentFilteringInfo.startYear ?: Calendar.getInstance().currentYear, - chosenMonth = currentFilteringInfo.startMonth - ?: Calendar.getInstance().currentMonth, - onYearChosen = updateStartYear, - onMonthChosen = updateStartMonth, - ) -} - @Composable fun ChangeFilteringTitleText( text: String, diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt new file mode 100644 index 00000000..12138696 --- /dev/null +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -0,0 +1,100 @@ +package com.terning.feature.home.component.bottomsheet + +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.R +import com.terning.core.designsystem.extension.currentMonth +import com.terning.core.designsystem.extension.currentYear +import com.terning.core.designsystem.theme.Black +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.domain.home.entity.HomeFilteringInfo +import java.util.Calendar + +@Composable +fun PlanFilteringScreen( + currentFilteringInfo: HomeFilteringInfo, + updateGrade: (Int) -> Unit, + updateWorkingPeriod: (Int) -> Unit, + updateStartYear: (Int) -> Unit, + updateStartMonth: (Int) -> Unit, +) { + Text( + text = stringResource(id = R.string.change_filter_top_bar_title), + style = TerningTheme.typography.title2, + color = Black, + modifier = Modifier + .padding(horizontal = 24.dp) + .padding(bottom = 16.dp), + ) + + HorizontalDivider( + thickness = 1.dp, + color = Grey200, + modifier = Modifier + .padding(horizontal = 24.dp), + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_grade_title), + modifier = Modifier + .padding(top = 18.dp, bottom = 12.dp) + .padding(horizontal = 24.dp) + ) + + ChangeFilteringRadioGroup( + initOption = currentFilteringInfo.grade?.let { Grade.fromString(it).ordinal } ?: -1, + optionList = listOf( + R.string.change_filter_grade_1, + R.string.change_filter_grade_2, + R.string.change_filter_grade_3, + R.string.change_filter_grade_4, + ), + onButtonClick = updateGrade, + columns = 4, + modifier = Modifier + .padding(horizontal = 24.dp), + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_period_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 12.dp) + .padding(horizontal = 24.dp) + ) + + ChangeFilteringRadioGroup( + initOption = currentFilteringInfo.workingPeriod?.let { WorkingPeriod.fromString(it).ordinal } + ?: -1, + optionList = listOf( + R.string.change_filter_period_1, + R.string.change_filter_period_2, + R.string.change_filter_period_3, + ), + onButtonClick = updateWorkingPeriod, + modifier = Modifier + .padding(horizontal = 24.dp), + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_start_work_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 49.dp) + .padding(horizontal = 24.dp) + ) + + YearMonthPicker( + chosenYear = currentFilteringInfo.startYear ?: Calendar.getInstance().currentYear, + chosenMonth = currentFilteringInfo.startMonth + ?: Calendar.getInstance().currentMonth, + onYearChosen = updateStartYear, + onMonthChosen = updateStartMonth, + ) +} \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/component/YearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/YearMonthPicker.kt similarity index 99% rename from feature/home/src/main/java/com/terning/feature/home/component/YearMonthPicker.kt rename to feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/YearMonthPicker.kt index 1771bc4b..7f546689 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/YearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/YearMonthPicker.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.component +package com.terning.feature.home.component.bottomsheet import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior import androidx.compose.foundation.layout.Arrangement From abb209dd8677f055c411b0677766ac77ef25465a Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 27 Dec 2024 08:56:48 +0900 Subject: [PATCH 04/27] =?UTF-8?q?[FEAT/#313]=20=EA=B3=84=ED=9A=8D=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EB=A7=81=20=EC=B2=B4=ED=81=AC=EB=B0=95?= =?UTF-8?q?=EC=8A=A4=20=EC=A0=81=EC=9A=A9=20=EB=B0=8F=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 540 +++++++++--------- .../bottomsheet/HomeFilteringBottomSheet.kt | 3 +- .../bottomsheet/PlanFilteringScreen.kt | 112 +++- feature/home/src/main/res/values/strings.xml | 14 + 4 files changed, 387 insertions(+), 282 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 47d7df74..98f9cc6d 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,270 +1,270 @@ -package com.terning.feature.home.component - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.foundation.lazy.grid.GridCells -import androidx.compose.foundation.lazy.grid.LazyVerticalGrid -import androidx.compose.foundation.lazy.grid.itemsIndexed -import androidx.compose.material3.Checkbox -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Text -import androidx.compose.material3.rememberModalBottomSheetState -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.R -import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet -import com.terning.core.designsystem.component.button.ChangeFilterButton -import com.terning.core.designsystem.component.button.RoundButton -import com.terning.core.designsystem.extension.currentMonth -import com.terning.core.designsystem.extension.currentYear -import com.terning.core.designsystem.theme.Black -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 kotlinx.collections.immutable.toImmutableList -import java.util.Calendar - -@OptIn(ExperimentalMaterial3Api::class) -@Composable -fun HomeFilteringBottomSheet( - modifier: Modifier = Modifier, - defaultGrade: Grade?, - defaultWorkingPeriod: WorkingPeriod?, - defaultStartYear: Int?, - defaultStartMonth: Int?, - onDismiss: () -> Unit, - onChangeButtonClick: (String, String, Int, Int) -> Unit, -) { - val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) - - var currentGrade by remember { mutableStateOf(defaultGrade) } - var currentPeriod by remember { mutableStateOf(defaultWorkingPeriod) } - var currentStartYear by remember { - mutableIntStateOf( - defaultStartYear ?: Calendar.getInstance().currentYear - ) - } - var currentStartMonth by remember { - mutableIntStateOf( - defaultStartMonth ?: Calendar.getInstance().currentMonth - ) - } - - var isYearNull by remember { mutableStateOf(defaultStartYear != null) } - var isMonthNull by remember { mutableStateOf(defaultStartMonth != null) } - - var isCheckBoxChecked by remember { mutableStateOf(false) } - - var isInitialNullState by remember { mutableStateOf(false) } - - val yearsList by remember(isYearNull) { - mutableStateOf( - if (isYearNull || isInitialNullState) years + NULL_DATE - else years - ) - } - val monthsList by remember(isMonthNull) { - mutableStateOf( - if (isMonthNull || isInitialNullState) months + NULL_DATE - else months - ) - } - - TerningBasicBottomSheet( - content = { - Column( - modifier = modifier - .fillMaxWidth(), - ) { - Text( - text = stringResource(id = R.string.change_filter_top_bar_title), - style = TerningTheme.typography.title2, - color = Black, - modifier = Modifier - .padding(horizontal = 24.dp) - .padding(bottom = 16.dp), - ) - - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_grade_title), - modifier = Modifier - .padding(top = 18.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) - ) - - ChangeFilteringRadioGroup( - initOption = defaultGrade?.ordinal ?: -1, - optionList = listOf( - R.string.change_filter_grade_1, - R.string.change_filter_grade_2, - R.string.change_filter_grade_3, - R.string.change_filter_grade_4, - ), - onButtonClick = { index -> - currentGrade = Grade.entries[index] - }, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_period_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) - ) - - ChangeFilteringRadioGroup( - initOption = defaultWorkingPeriod?.ordinal ?: -1, - optionList = listOf( - R.string.change_filter_period_1, - R.string.change_filter_period_2, - R.string.change_filter_period_3, - ), - onButtonClick = { index -> - currentPeriod = WorkingPeriod.entries[index] - }, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_start_work_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 49.dp) - .padding(horizontal = 24.dp) - ) - - //TODO: 아래는 임시 체크박스로, 추후 수정 부탁합니다! - Checkbox( - checked = isCheckBoxChecked, - onCheckedChange = { isChecked -> - if (isChecked) { - isYearNull = true - isMonthNull = true - } - isCheckBoxChecked = isChecked - }, - modifier = Modifier.padding(start = 20.dp) - ) - - HomeYearMonthPicker( - chosenYear = defaultStartYear, - chosenMonth = defaultStartMonth, - onYearChosen = { year, isInitialSelection -> - if (year != null) { - currentStartYear = year - isCheckBoxChecked = false - isYearNull = false - isInitialNullState = isInitialSelection - } - }, - onMonthChosen = { month, isInitialSelection -> - if (month != null) { - currentStartMonth = month - isCheckBoxChecked = false - isMonthNull = false - isInitialNullState = isInitialSelection - } - }, - isYearNull = isYearNull, - isMonthNull = isMonthNull, - yearsList = yearsList.toImmutableList(), - monthsList = monthsList.toImmutableList(), - isInitialNullState = isInitialNullState - ) - - RoundButton( - style = TerningTheme.typography.button0, - paddingVertical = 19.dp, - text = R.string.change_filter_save, - cornerRadius = 10.dp, - modifier = Modifier - .padding(horizontal = 24.dp) - .padding(top = 51.dp), - onButtonClick = { - currentGrade?.let { grade -> - currentPeriod?.let { workingPeriod -> - onChangeButtonClick( - grade.stringValue, - workingPeriod.stringValue, - currentStartYear, - currentStartMonth, - ) - } - } - }, - isEnabled = currentGrade != null && currentPeriod != null - ) - } - }, - onDismissRequest = onDismiss, - sheetState = sheetState, - ) -} - -@Composable -fun ChangeFilteringTitleText( - text: String, - modifier: Modifier = Modifier, -) { - Text( - text = text, - style = TerningTheme.typography.title4, - color = Black, - modifier = modifier, - ) -} - -@Composable -fun ChangeFilteringRadioGroup( - optionList: List, - initOption: Int, - onButtonClick: (Int) -> Unit, - modifier: Modifier = Modifier, -) { - var selectedIndex by remember { mutableIntStateOf(initOption) } - - LazyVerticalGrid( - columns = GridCells.Fixed(optionList.size), - horizontalArrangement = Arrangement.spacedBy(13.dp), - modifier = modifier - .fillMaxWidth() - .wrapContentHeight() - - ) { - itemsIndexed(optionList) { index, option -> - ChangeFilterButton( - isSelected = selectedIndex == index, - modifier = Modifier - .wrapContentHeight(), - text = option, - cornerRadius = 10.dp, - paddingVertical = 10.dp, - onButtonClick = { - selectedIndex = index - onButtonClick(index) - } - ) - } - } -} \ No newline at end of file +//package com.terning.feature.home.component +// +//import androidx.compose.foundation.layout.Arrangement +//import androidx.compose.foundation.layout.Column +//import androidx.compose.foundation.layout.fillMaxWidth +//import androidx.compose.foundation.layout.padding +//import androidx.compose.foundation.layout.wrapContentHeight +//import androidx.compose.foundation.lazy.grid.GridCells +//import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +//import androidx.compose.foundation.lazy.grid.itemsIndexed +//import androidx.compose.material3.Checkbox +//import androidx.compose.material3.ExperimentalMaterial3Api +//import androidx.compose.material3.HorizontalDivider +//import androidx.compose.material3.Text +//import androidx.compose.material3.rememberModalBottomSheetState +//import androidx.compose.runtime.Composable +//import androidx.compose.runtime.getValue +//import androidx.compose.runtime.mutableIntStateOf +//import androidx.compose.runtime.mutableStateOf +//import androidx.compose.runtime.remember +//import androidx.compose.runtime.setValue +//import androidx.compose.ui.Modifier +//import androidx.compose.ui.res.stringResource +//import androidx.compose.ui.unit.dp +//import com.terning.core.designsystem.R +//import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet +//import com.terning.core.designsystem.component.button.ChangeFilterButton +//import com.terning.core.designsystem.component.button.RoundButton +//import com.terning.core.designsystem.extension.currentMonth +//import com.terning.core.designsystem.extension.currentYear +//import com.terning.core.designsystem.theme.Black +//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 kotlinx.collections.immutable.toImmutableList +//import java.util.Calendar +// +//@OptIn(ExperimentalMaterial3Api::class) +//@Composable +//fun HomeFilteringBottomSheet( +// modifier: Modifier = Modifier, +// defaultGrade: Grade?, +// defaultWorkingPeriod: WorkingPeriod?, +// defaultStartYear: Int?, +// defaultStartMonth: Int?, +// onDismiss: () -> Unit, +// onChangeButtonClick: (String, String, Int, Int) -> Unit, +//) { +// val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) +// +// var currentGrade by remember { mutableStateOf(defaultGrade) } +// var currentPeriod by remember { mutableStateOf(defaultWorkingPeriod) } +// var currentStartYear by remember { +// mutableIntStateOf( +// defaultStartYear ?: Calendar.getInstance().currentYear +// ) +// } +// var currentStartMonth by remember { +// mutableIntStateOf( +// defaultStartMonth ?: Calendar.getInstance().currentMonth +// ) +// } +// +// var isYearNull by remember { mutableStateOf(defaultStartYear != null) } +// var isMonthNull by remember { mutableStateOf(defaultStartMonth != null) } +// +// var isCheckBoxChecked by remember { mutableStateOf(false) } +// +// var isInitialNullState by remember { mutableStateOf(false) } +// +// val yearsList by remember(isYearNull) { +// mutableStateOf( +// if (isYearNull || isInitialNullState) years + NULL_DATE +// else years +// ) +// } +// val monthsList by remember(isMonthNull) { +// mutableStateOf( +// if (isMonthNull || isInitialNullState) months + NULL_DATE +// else months +// ) +// } +// +// TerningBasicBottomSheet( +// content = { +// Column( +// modifier = modifier +// .fillMaxWidth(), +// ) { +// Text( +// text = stringResource(id = R.string.change_filter_top_bar_title), +// style = TerningTheme.typography.title2, +// color = Black, +// modifier = Modifier +// .padding(horizontal = 24.dp) +// .padding(bottom = 16.dp), +// ) +// +// HorizontalDivider( +// thickness = 1.dp, +// color = Grey200, +// modifier = Modifier +// .padding(horizontal = 24.dp), +// ) +// +// ChangeFilteringTitleText( +// text = stringResource(id = R.string.change_filter_grade_title), +// modifier = Modifier +// .padding(top = 18.dp, bottom = 12.dp) +// .padding(horizontal = 24.dp) +// ) +// +// ChangeFilteringRadioGroup( +// initOption = defaultGrade?.ordinal ?: -1, +// optionList = listOf( +// R.string.change_filter_grade_1, +// R.string.change_filter_grade_2, +// R.string.change_filter_grade_3, +// R.string.change_filter_grade_4, +// ), +// onButtonClick = { index -> +// currentGrade = Grade.entries[index] +// }, +// modifier = Modifier +// .padding(horizontal = 24.dp), +// ) +// +// ChangeFilteringTitleText( +// text = stringResource(id = R.string.change_filter_period_title), +// modifier = Modifier +// .padding(top = 32.dp, bottom = 12.dp) +// .padding(horizontal = 24.dp) +// ) +// +// ChangeFilteringRadioGroup( +// initOption = defaultWorkingPeriod?.ordinal ?: -1, +// optionList = listOf( +// R.string.change_filter_period_1, +// R.string.change_filter_period_2, +// R.string.change_filter_period_3, +// ), +// onButtonClick = { index -> +// currentPeriod = WorkingPeriod.entries[index] +// }, +// modifier = Modifier +// .padding(horizontal = 24.dp), +// ) +// +// ChangeFilteringTitleText( +// text = stringResource(id = R.string.change_filter_start_work_title), +// modifier = Modifier +// .padding(top = 32.dp, bottom = 49.dp) +// .padding(horizontal = 24.dp) +// ) +// +// //TODO: 아래는 임시 체크박스로, 추후 수정 부탁합니다! +// Checkbox( +// checked = isCheckBoxChecked, +// onCheckedChange = { isChecked -> +// if (isChecked) { +// isYearNull = true +// isMonthNull = true +// } +// isCheckBoxChecked = isChecked +// }, +// modifier = Modifier.padding(start = 20.dp) +// ) +// +// HomeYearMonthPicker( +// chosenYear = defaultStartYear, +// chosenMonth = defaultStartMonth, +// onYearChosen = { year, isInitialSelection -> +// if (year != null) { +// currentStartYear = year +// isCheckBoxChecked = false +// isYearNull = false +// isInitialNullState = isInitialSelection +// } +// }, +// onMonthChosen = { month, isInitialSelection -> +// if (month != null) { +// currentStartMonth = month +// isCheckBoxChecked = false +// isMonthNull = false +// isInitialNullState = isInitialSelection +// } +// }, +// isYearNull = isYearNull, +// isMonthNull = isMonthNull, +// yearsList = yearsList.toImmutableList(), +// monthsList = monthsList.toImmutableList(), +// isInitialNullState = isInitialNullState +// ) +// +// RoundButton( +// style = TerningTheme.typography.button0, +// paddingVertical = 19.dp, +// text = R.string.change_filter_save, +// cornerRadius = 10.dp, +// modifier = Modifier +// .padding(horizontal = 24.dp) +// .padding(top = 51.dp), +// onButtonClick = { +// currentGrade?.let { grade -> +// currentPeriod?.let { workingPeriod -> +// onChangeButtonClick( +// grade.stringValue, +// workingPeriod.stringValue, +// currentStartYear, +// currentStartMonth, +// ) +// } +// } +// }, +// isEnabled = currentGrade != null && currentPeriod != null +// ) +// } +// }, +// onDismissRequest = onDismiss, +// sheetState = sheetState, +// ) +//} +// +//@Composable +//fun ChangeFilteringTitleText( +// text: String, +// modifier: Modifier = Modifier, +//) { +// Text( +// text = text, +// style = TerningTheme.typography.title4, +// color = Black, +// modifier = modifier, +// ) +//} +// +//@Composable +//fun ChangeFilteringRadioGroup( +// optionList: List, +// initOption: Int, +// onButtonClick: (Int) -> Unit, +// modifier: Modifier = Modifier, +//) { +// var selectedIndex by remember { mutableIntStateOf(initOption) } +// +// LazyVerticalGrid( +// columns = GridCells.Fixed(optionList.size), +// horizontalArrangement = Arrangement.spacedBy(13.dp), +// modifier = modifier +// .fillMaxWidth() +// .wrapContentHeight() +// +// ) { +// itemsIndexed(optionList) { index, option -> +// ChangeFilterButton( +// isSelected = selectedIndex == index, +// modifier = Modifier +// .wrapContentHeight(), +// text = option, +// cornerRadius = 10.dp, +// paddingVertical = 10.dp, +// onButtonClick = { +// selectedIndex = index +// onButtonClick(index) +// } +// ) +// } +// } +//} \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 007fe7a0..240417c6 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -79,8 +79,7 @@ fun HomeFilteringBottomSheet( text = R.string.change_filter_save, cornerRadius = 10.dp, modifier = Modifier - .padding(horizontal = 24.dp) - .padding(top = 51.dp), + .padding(horizontal = 24.dp), onButtonClick = { currentFilteringInfo.grade?.let { currentFilteringInfo.workingPeriod?.let { it1 -> diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index 12138696..ab5a0de3 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -1,23 +1,43 @@ package com.terning.feature.home.component.bottomsheet +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Checkbox +import androidx.compose.material3.CheckboxDefaults +import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.LocalMinimumInteractiveComponentEnforcement import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.R -import com.terning.core.designsystem.extension.currentMonth -import com.terning.core.designsystem.extension.currentYear import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 +import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.core.designsystem.type.Grade import com.terning.core.designsystem.type.WorkingPeriod +import com.terning.core.designsystem.util.NoRippleInteractionSource import com.terning.domain.home.entity.HomeFilteringInfo -import java.util.Calendar +import com.terning.feature.home.R +import com.terning.feature.home.component.HomeYearMonthPicker +import com.terning.feature.home.component.NULL_DATE +import com.terning.feature.home.component.months +import com.terning.feature.home.component.years +import kotlinx.collections.immutable.toImmutableList +@OptIn(ExperimentalMaterial3Api::class) @Composable fun PlanFilteringScreen( currentFilteringInfo: HomeFilteringInfo, @@ -26,6 +46,26 @@ fun PlanFilteringScreen( updateStartYear: (Int) -> Unit, updateStartMonth: (Int) -> Unit, ) { + var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == null) } + var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == null) } + + var isCheckBoxChecked by remember { mutableStateOf(false) } + + var isInitialNullState by remember { mutableStateOf(false) } + + val yearsList by remember(isYearNull) { + mutableStateOf( + if (isYearNull || isInitialNullState) years + NULL_DATE + else years + ) + } + val monthsList by remember(isMonthNull) { + mutableStateOf( + if (isMonthNull || isInitialNullState) months + NULL_DATE + else months + ) + } + Text( text = stringResource(id = R.string.change_filter_top_bar_title), style = TerningTheme.typography.title2, @@ -90,11 +130,63 @@ fun PlanFilteringScreen( .padding(horizontal = 24.dp) ) - YearMonthPicker( - chosenYear = currentFilteringInfo.startYear ?: Calendar.getInstance().currentYear, - chosenMonth = currentFilteringInfo.startMonth - ?: Calendar.getInstance().currentMonth, - onYearChosen = updateStartYear, - onMonthChosen = updateStartMonth, + HomeYearMonthPicker( + chosenYear = currentFilteringInfo.startYear, + chosenMonth = currentFilteringInfo.startMonth, + onYearChosen = { year, isInitialSelection -> + if (year != null) { + updateStartYear(year) + isCheckBoxChecked = false + isYearNull = false + isInitialNullState = isInitialSelection + } + }, + onMonthChosen = { month, isInitialSelection -> + if (month != null) { + updateStartMonth(month) + isCheckBoxChecked = false + isMonthNull = false + isInitialNullState = isInitialSelection + } + }, + isYearNull = isYearNull, + isMonthNull = isMonthNull, + yearsList = yearsList.toImmutableList(), + monthsList = monthsList.toImmutableList(), + isInitialNullState = isInitialNullState ) + + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.End, + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 13.dp, top = 26.dp, end = 24.dp), + ) { + CompositionLocalProvider(LocalMinimumInteractiveComponentEnforcement provides false) { + Checkbox( + checked = isCheckBoxChecked, + onCheckedChange = { isChecked -> + if (isChecked) { + isYearNull = true + isMonthNull = true + } + isCheckBoxChecked = isChecked + }, + colors = CheckboxDefaults.colors( + checkedColor = TerningMain, + uncheckedColor = Grey300, + checkmarkColor = White, + ), + interactionSource = NoRippleInteractionSource + ) + } + + Text( + text = stringResource(id = R.string.intern_with_no_plan_filter), + style = TerningTheme.typography.button3, + color = Grey300, + modifier = Modifier.padding(start = 6.dp), + ) + } } \ No newline at end of file diff --git a/feature/home/src/main/res/values/strings.xml b/feature/home/src/main/res/values/strings.xml index 9e4291b1..6b0c63a0 100644 --- a/feature/home/src/main/res/values/strings.xml +++ b/feature/home/src/main/res/values/strings.xml @@ -26,4 +26,18 @@ - 오늘 마감인 공고가 없어요 지원마감 + + 필터링 + 재학 상태 + 저장하기 + 1학년 + 2학년 + 3학년 + 4학년 + 희망 근무 기간 + 1 ~ 3개월 + 4 ~ 6개월 + 7개월 이상 + 근무 시작 시기 + 계획 필터링 없이 모든 공고 보기 From 9ff017916437710fa2e8b2abce02672d1333c808 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 27 Dec 2024 11:21:50 +0900 Subject: [PATCH 05/27] =?UTF-8?q?[FEAT/#313]=20=EC=A7=81=EB=AC=B4=20enum?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/core/designsystem/type/JobType.kt | 36 +++++++++++++++++++ .../res/drawable/ic_job_accounting_24.xml | 0 .../src/main/res/drawable/ic_job_all_24.xml | 0 .../main/res/drawable/ic_job_design_24.xml | 0 .../src/main/res/drawable/ic_job_extra_24.xml | 0 .../src/main/res/drawable/ic_job_it_24.xml | 0 .../main/res/drawable/ic_job_marketing_24.xml | 0 .../src/main/res/drawable/ic_job_plan_24.xml | 0 .../main/res/drawable/ic_job_research_24.xml | 0 .../src/main/res/drawable/ic_job_sales_24.xml | 0 10 files changed, 36 insertions(+) create mode 100644 core/designsystem/src/main/java/com/terning/core/designsystem/type/JobType.kt rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_accounting_24.xml (100%) rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_all_24.xml (100%) rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_design_24.xml (100%) rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_extra_24.xml (100%) rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_it_24.xml (100%) rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_marketing_24.xml (100%) rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_plan_24.xml (100%) rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_research_24.xml (100%) rename {feature/home => core/designsystem}/src/main/res/drawable/ic_job_sales_24.xml (100%) diff --git a/core/designsystem/src/main/java/com/terning/core/designsystem/type/JobType.kt b/core/designsystem/src/main/java/com/terning/core/designsystem/type/JobType.kt new file mode 100644 index 00000000..1789533a --- /dev/null +++ b/core/designsystem/src/main/java/com/terning/core/designsystem/type/JobType.kt @@ -0,0 +1,36 @@ +package com.terning.core.designsystem.type + +import androidx.annotation.DrawableRes +import androidx.annotation.StringRes +import com.terning.core.designsystem.R + +enum class JobType( + val stringValue: String, + @DrawableRes val drawableResId: Int, + @StringRes val stringResId: Int, +) { + PLAN("plan", R.drawable.ic_job_plan_24, R.string.job_type_plan), + MARKETING("marketing", R.drawable.ic_job_marketing_24, R.string.job_type_marketing), + SALES("sales", R.drawable.ic_job_sales_24, R.string.job_type_sales), + ADMIN("admin", R.drawable.ic_job_accounting_24, R.string.job_type_admin), + DESIGN("design", R.drawable.ic_job_design_24, R.string.job_type_design), + IT("it", R.drawable.ic_job_it_24, R.string.job_type_it), + RESEARCH("research", R.drawable.ic_bookmark_filled, R.string.job_type_research), + ETC("etc", R.drawable.ic_job_extra_24, R.string.job_type_etc), + TOTAL("total", R.drawable.ic_job_all_24, R.string.job_type_total), ; + + + companion object { + fun fromString(value: String?): JobType = when (value) { + "plan" -> PLAN + "marketing" -> MARKETING + "admin" -> ADMIN + "sales" -> SALES + "design" -> DESIGN + "it" -> IT + "research" -> RESEARCH + "etc" -> ETC + else -> TOTAL + } + } +} \ No newline at end of file diff --git a/feature/home/src/main/res/drawable/ic_job_accounting_24.xml b/core/designsystem/src/main/res/drawable/ic_job_accounting_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_accounting_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_accounting_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_all_24.xml b/core/designsystem/src/main/res/drawable/ic_job_all_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_all_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_all_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_design_24.xml b/core/designsystem/src/main/res/drawable/ic_job_design_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_design_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_design_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_extra_24.xml b/core/designsystem/src/main/res/drawable/ic_job_extra_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_extra_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_extra_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_it_24.xml b/core/designsystem/src/main/res/drawable/ic_job_it_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_it_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_it_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_marketing_24.xml b/core/designsystem/src/main/res/drawable/ic_job_marketing_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_marketing_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_marketing_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_plan_24.xml b/core/designsystem/src/main/res/drawable/ic_job_plan_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_plan_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_plan_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_research_24.xml b/core/designsystem/src/main/res/drawable/ic_job_research_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_research_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_research_24.xml diff --git a/feature/home/src/main/res/drawable/ic_job_sales_24.xml b/core/designsystem/src/main/res/drawable/ic_job_sales_24.xml similarity index 100% rename from feature/home/src/main/res/drawable/ic_job_sales_24.xml rename to core/designsystem/src/main/res/drawable/ic_job_sales_24.xml From 2af0fdc45c34825e93385c19bf58ca03a8434d93 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 27 Dec 2024 15:02:00 +0900 Subject: [PATCH 06/27] =?UTF-8?q?[CHORE/#313]=20Column=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20=ED=83=80=EC=9D=B4=ED=8B=80=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 --- .../bottomsheet/PlanFilteringScreen.kt | 265 ++++++++++-------- 1 file changed, 145 insertions(+), 120 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index ab5a0de3..5e286b70 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -1,18 +1,23 @@ package com.terning.feature.home.component.bottomsheet import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.material3.Checkbox import androidx.compose.material3.CheckboxDefaults import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.LocalMinimumInteractiveComponentEnforcement import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -20,8 +25,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.Grey200 +import com.terning.core.designsystem.component.button.ChangeFilterButton import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme @@ -66,127 +70,148 @@ fun PlanFilteringScreen( ) } - Text( - text = stringResource(id = R.string.change_filter_top_bar_title), - style = TerningTheme.typography.title2, - color = Black, - modifier = Modifier - .padding(horizontal = 24.dp) - .padding(bottom = 16.dp), - ) - - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_grade_title), - modifier = Modifier - .padding(top = 18.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) - ) - - ChangeFilteringRadioGroup( - initOption = currentFilteringInfo.grade?.let { Grade.fromString(it).ordinal } ?: -1, - optionList = listOf( - R.string.change_filter_grade_1, - R.string.change_filter_grade_2, - R.string.change_filter_grade_3, - R.string.change_filter_grade_4, - ), - onButtonClick = updateGrade, - columns = 4, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_period_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) - ) - - ChangeFilteringRadioGroup( - initOption = currentFilteringInfo.workingPeriod?.let { WorkingPeriod.fromString(it).ordinal } - ?: -1, - optionList = listOf( - R.string.change_filter_period_1, - R.string.change_filter_period_2, - R.string.change_filter_period_3, - ), - onButtonClick = updateWorkingPeriod, - modifier = Modifier - .padding(horizontal = 24.dp), - ) - - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_start_work_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 49.dp) - .padding(horizontal = 24.dp) - ) - - HomeYearMonthPicker( - chosenYear = currentFilteringInfo.startYear, - chosenMonth = currentFilteringInfo.startMonth, - onYearChosen = { year, isInitialSelection -> - if (year != null) { - updateStartYear(year) - isCheckBoxChecked = false - isYearNull = false - isInitialNullState = isInitialSelection - } - }, - onMonthChosen = { month, isInitialSelection -> - if (month != null) { - updateStartMonth(month) - isCheckBoxChecked = false - isMonthNull = false - isInitialNullState = isInitialSelection + Column { + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_grade_title), + modifier = Modifier + .padding(top = 18.dp, bottom = 12.dp) + .padding(horizontal = 24.dp) + ) + + ChangePlanFilteringRadioGroup( + initOption = currentFilteringInfo.grade?.let { Grade.fromString(it).ordinal } ?: -1, + optionList = listOf( + R.string.change_filter_grade_1, + R.string.change_filter_grade_2, + R.string.change_filter_grade_3, + R.string.change_filter_grade_4, + ), + onButtonClick = updateGrade, + columns = 4, + modifier = Modifier + .padding(horizontal = 24.dp), + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_period_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 12.dp) + .padding(horizontal = 24.dp) + ) + + ChangePlanFilteringRadioGroup( + initOption = currentFilteringInfo.workingPeriod?.let { WorkingPeriod.fromString(it).ordinal } + ?: -1, + optionList = listOf( + R.string.change_filter_period_1, + R.string.change_filter_period_2, + R.string.change_filter_period_3, + ), + onButtonClick = updateWorkingPeriod, + modifier = Modifier + .padding(horizontal = 24.dp), + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_start_work_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 49.dp) + .padding(horizontal = 24.dp) + ) + + HomeYearMonthPicker( + chosenYear = currentFilteringInfo.startYear, + chosenMonth = currentFilteringInfo.startMonth, + onYearChosen = { year, isInitialSelection -> + if (year != null) { + updateStartYear(year) + isCheckBoxChecked = false + isYearNull = false + isInitialNullState = isInitialSelection + } + }, + onMonthChosen = { month, isInitialSelection -> + if (month != null) { + updateStartMonth(month) + isCheckBoxChecked = false + isMonthNull = false + isInitialNullState = isInitialSelection + } + }, + isYearNull = isYearNull, + isMonthNull = isMonthNull, + yearsList = yearsList.toImmutableList(), + monthsList = monthsList.toImmutableList(), + isInitialNullState = isInitialNullState + ) + + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.End, + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 13.dp, top = 26.dp, end = 24.dp), + ) { + CompositionLocalProvider(LocalMinimumInteractiveComponentEnforcement provides false) { + Checkbox( + checked = isCheckBoxChecked, + onCheckedChange = { isChecked -> + if (isChecked) { + isYearNull = true + isMonthNull = true + } + isCheckBoxChecked = isChecked + }, + colors = CheckboxDefaults.colors( + checkedColor = TerningMain, + uncheckedColor = Grey300, + checkmarkColor = White, + ), + interactionSource = NoRippleInteractionSource + ) } - }, - isYearNull = isYearNull, - isMonthNull = isMonthNull, - yearsList = yearsList.toImmutableList(), - monthsList = monthsList.toImmutableList(), - isInitialNullState = isInitialNullState - ) - - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.End, - modifier = Modifier + + Text( + text = stringResource(id = R.string.intern_with_no_plan_filter), + style = TerningTheme.typography.button3, + color = Grey300, + modifier = Modifier.padding(start = 6.dp), + ) + } + } +} + +@Composable +fun ChangePlanFilteringRadioGroup( + optionList: List, + initOption: Int, + onButtonClick: (Int) -> Unit, + columns: Int = 3, + modifier: Modifier = Modifier, +) { + var selectedIndex by remember { mutableIntStateOf(initOption) } + + LazyVerticalGrid( + columns = GridCells.Fixed(columns), + horizontalArrangement = Arrangement.spacedBy(13.dp), + modifier = modifier .fillMaxWidth() - .padding(bottom = 13.dp, top = 26.dp, end = 24.dp), + .wrapContentHeight() + ) { - CompositionLocalProvider(LocalMinimumInteractiveComponentEnforcement provides false) { - Checkbox( - checked = isCheckBoxChecked, - onCheckedChange = { isChecked -> - if (isChecked) { - isYearNull = true - isMonthNull = true - } - isCheckBoxChecked = isChecked - }, - colors = CheckboxDefaults.colors( - checkedColor = TerningMain, - uncheckedColor = Grey300, - checkmarkColor = White, - ), - interactionSource = NoRippleInteractionSource + itemsIndexed(optionList) { index, option -> + ChangeFilterButton( + isSelected = selectedIndex == index, + modifier = Modifier + .wrapContentHeight(), + text = option, + cornerRadius = 10.dp, + paddingVertical = 10.dp, + onButtonClick = { + selectedIndex = index + onButtonClick(index) + } ) } - - Text( - text = stringResource(id = R.string.intern_with_no_plan_filter), - style = TerningTheme.typography.button3, - color = Grey300, - modifier = Modifier.padding(start = 6.dp), - ) } } \ No newline at end of file From b9bf94eb066b865b34b4d88985dae758ad9c875b Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 27 Dec 2024 15:02:42 +0900 Subject: [PATCH 07/27] =?UTF-8?q?[FEAT/#313]=20=EC=A7=81=EB=AC=B4=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EB=A7=81=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/JobFilteringScreen.kt | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt new file mode 100644 index 00000000..8a980971 --- /dev/null +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt @@ -0,0 +1,102 @@ +package com.terning.feature.home.component.bottomsheet + +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.itemsIndexed +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.extension.noRippleClickable +import com.terning.core.designsystem.theme.Grey200 +import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.Grey350 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.type.JobType + +@Composable +fun JobFilteringScreen( + initOption: Int, + onButtonClick: (JobType) -> Unit, + modifier: Modifier = Modifier, +) { + var selectedIndex by remember { mutableIntStateOf(initOption) } + + LazyVerticalGrid( + columns = GridCells.Fixed(3), + horizontalArrangement = Arrangement.spacedBy(10.dp), + verticalArrangement = Arrangement.spacedBy(12.dp), + modifier = modifier + .fillMaxWidth() + .wrapContentHeight() + .padding(bottom = 60.dp, start = 23.dp, end = 23.dp, top = 16.dp), + + ) { + itemsIndexed(JobType.entries) { index, option -> + JobTypeItem( + jobType = option, + onButtonClick = { + selectedIndex = index + onButtonClick(option) + }, + isSelected = selectedIndex == index + ) + } + } +} + +@Composable +private fun JobTypeItem( + jobType: JobType, + isSelected: Boolean, + onButtonClick: (JobType) -> Unit, + modifier: Modifier = Modifier, +) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = modifier + .border( + width = 1.dp, + color = if (isSelected) TerningMain else Grey200, + shape = RoundedCornerShape(10.dp) + ) + .noRippleClickable { onButtonClick(jobType) } + .padding( + top = 31.dp, + bottom = 33.dp, + start = 27.dp, + end = 26.dp + ), + ) { + Icon( + imageVector = ImageVector.vectorResource(id = jobType.drawableResId), + contentDescription = jobType.stringValue, + tint = if (isSelected) TerningMain else Grey300 + ) + + Text( + text = stringResource(id = jobType.stringResId), + style = TerningTheme.typography.body6, + color = if (isSelected) TerningMain else Grey350, + modifier = Modifier + .padding(top = 7.dp) + ) + } +} \ No newline at end of file From f392528b67b58fc1a743f9a112e6bc7eb4500bb4 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 27 Dec 2024 15:46:07 +0900 Subject: [PATCH 08/27] =?UTF-8?q?[CHORE/#313]=20=EC=A7=81=EB=AC=B4=20?= =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/core/designsystem/type/JobType.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/designsystem/src/main/java/com/terning/core/designsystem/type/JobType.kt b/core/designsystem/src/main/java/com/terning/core/designsystem/type/JobType.kt index 1789533a..37030eda 100644 --- a/core/designsystem/src/main/java/com/terning/core/designsystem/type/JobType.kt +++ b/core/designsystem/src/main/java/com/terning/core/designsystem/type/JobType.kt @@ -15,7 +15,7 @@ enum class JobType( ADMIN("admin", R.drawable.ic_job_accounting_24, R.string.job_type_admin), DESIGN("design", R.drawable.ic_job_design_24, R.string.job_type_design), IT("it", R.drawable.ic_job_it_24, R.string.job_type_it), - RESEARCH("research", R.drawable.ic_bookmark_filled, R.string.job_type_research), + RESEARCH("research", R.drawable.ic_job_research_24, R.string.job_type_research), ETC("etc", R.drawable.ic_job_extra_24, R.string.job_type_etc), TOTAL("total", R.drawable.ic_job_all_24, R.string.job_type_total), ; From 47f4a12c62387a83d5e74478f2c9d8eabc4c4b26 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 27 Dec 2024 16:15:05 +0900 Subject: [PATCH 09/27] =?UTF-8?q?[FEAT/#313]=20=ED=95=84=ED=84=B0=EB=A7=81?= =?UTF-8?q?=20=EC=9E=AC=EC=84=A4=EC=A0=95=20=EB=B7=B0=20UI=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/values/strings.xml | 15 +- .../bottomsheet/HomeFilteringBottomSheet.kt | 171 ++++++++++++------ .../bottomsheet/JobFilteringScreen.kt | 2 +- .../bottomsheet/PlanFilteringScreen.kt | 3 +- feature/home/src/main/res/values/strings.xml | 2 + 5 files changed, 129 insertions(+), 64 deletions(-) diff --git a/core/designsystem/src/main/res/values/strings.xml b/core/designsystem/src/main/res/values/strings.xml index 4204e68a..552e4d90 100644 --- a/core/designsystem/src/main/res/values/strings.xml +++ b/core/designsystem/src/main/res/values/strings.xml @@ -69,17 +69,22 @@ 닉네임은 12자리 이내로 설정해 주세요 - 필터링 재설정 - 재학 상태 - 저장하기 1학년 2학년 3학년 4학년 - 희망 근무 기간 1 ~ 3개월 4 ~ 6개월 7개월 이상 - 근무 시작 시기 + + 기획/전략 + 마케팅/홍보 + 사무/회계 + 인사/영업 + 디자인/예술 + 개발/IT + 연구/생산 + 기타 + 전체 직무 \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 240417c6..4e88b64f 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -1,33 +1,49 @@ package com.terning.feature.home.component.bottomsheet +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.IntrinsicSize +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.foundation.lazy.grid.GridCells -import androidx.compose.foundation.lazy.grid.LazyVerticalGrid -import androidx.compose.foundation.lazy.grid.itemsIndexed +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Text import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.R import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet -import com.terning.core.designsystem.component.button.ChangeFilterButton import com.terning.core.designsystem.component.button.RoundButton +import com.terning.core.designsystem.extension.noRippleClickable import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey200 +import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.Grade import com.terning.core.designsystem.type.WorkingPeriod import com.terning.domain.home.entity.HomeFilteringInfo +import com.terning.feature.home.R +import kotlinx.coroutines.launch +import okhttp3.internal.toImmutableList + +val filterType = + listOf(R.string.change_job_type_filter, R.string.change_plan_type_filter).toImmutableList() @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -42,6 +58,8 @@ fun HomeFilteringBottomSheet( var currentFilteringInfo by remember { mutableStateOf(defaultFilteringInfo) } + val pagerState = rememberPagerState { 2 } + val coroutineScope = rememberCoroutineScope() TerningBasicBottomSheet( content = { @@ -49,30 +67,75 @@ fun HomeFilteringBottomSheet( modifier = modifier .fillMaxWidth(), ) { - PlanFilteringScreen( - currentFilteringInfo = currentFilteringInfo, - updateGrade = { - currentFilteringInfo = currentFilteringInfo.copy( - grade = Grade.entries[it].stringValue - ) - }, - updateWorkingPeriod = { - currentFilteringInfo = currentFilteringInfo.copy( - workingPeriod = WorkingPeriod.entries[it].stringValue - ) - }, - updateStartYear = { - currentFilteringInfo = currentFilteringInfo.copy( - startYear = it - ) - }, - updateStartMonth = { - currentFilteringInfo = currentFilteringInfo.copy( - startMonth = it - ) - }, + Text( + text = stringResource(id = R.string.change_filter_top_bar_title), + style = TerningTheme.typography.title2, + color = Black, + modifier = Modifier + .padding(horizontal = 24.dp) + .padding(bottom = 16.dp), + ) + + Row( + modifier = Modifier + .padding(horizontal = 23.dp), + verticalAlignment = Alignment.Bottom, + ) { + filterType.forEachIndexed { index, option -> + if (index == 1) { + Spacer(modifier = Modifier.width(28.dp)) + } + TerningTab( + tabText = stringResource(id = option), + selected = pagerState.currentPage == index, + onTabClick = { + coroutineScope.launch { + pagerState.animateScrollToPage(index) + } + }) + } + } + + HorizontalDivider( + thickness = 1.dp, + color = Grey200, + modifier = Modifier + .padding(horizontal = 24.dp), ) + HorizontalPager( + state = pagerState, + modifier = Modifier.padding(top = 16.dp) + ) { + if (pagerState.currentPage == 0) { + JobFilteringScreen(initOption = 0, onButtonClick = {}) + } else { + PlanFilteringScreen( + currentFilteringInfo = currentFilteringInfo, + updateGrade = { + currentFilteringInfo = currentFilteringInfo.copy( + grade = Grade.entries[it].stringValue + ) + }, + updateWorkingPeriod = { + currentFilteringInfo = currentFilteringInfo.copy( + workingPeriod = WorkingPeriod.entries[it].stringValue + ) + }, + updateStartYear = { + currentFilteringInfo = currentFilteringInfo.copy( + startYear = it + ) + }, + updateStartMonth = { + currentFilteringInfo = currentFilteringInfo.copy( + startMonth = it + ) + }, + ) + } + } + RoundButton( style = TerningTheme.typography.button0, paddingVertical = 19.dp, @@ -120,36 +183,32 @@ fun ChangeFilteringTitleText( } @Composable -fun ChangeFilteringRadioGroup( - optionList: List, - initOption: Int, - onButtonClick: (Int) -> Unit, - columns: Int = 3, +fun TerningTab( + tabText: String, + selected: Boolean, + onTabClick: () -> Unit, modifier: Modifier = Modifier, ) { - var selectedIndex by remember { mutableIntStateOf(initOption) } - - LazyVerticalGrid( - columns = GridCells.Fixed(columns), - horizontalArrangement = Arrangement.spacedBy(13.dp), + Column( modifier = modifier - .fillMaxWidth() - .wrapContentHeight() - + .width(IntrinsicSize.Max) + .noRippleClickable { onTabClick() }, + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, ) { - itemsIndexed(optionList) { index, option -> - ChangeFilterButton( - isSelected = selectedIndex == index, - modifier = Modifier - .wrapContentHeight(), - text = option, - cornerRadius = 10.dp, - paddingVertical = 10.dp, - onButtonClick = { - selectedIndex = index - onButtonClick(index) - } - ) - } + Text( + text = tabText, + style = TerningTheme.typography.title4, + color = if (selected) TerningMain else Grey300, + modifier = Modifier + .padding(bottom = 7.dp), + ) + + Spacer( + modifier = Modifier + .height(4.dp) + .fillMaxWidth() + .background(if (selected) TerningMain else Color.Transparent) + ) } } \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt index 8a980971..7c427460 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt @@ -46,7 +46,7 @@ fun JobFilteringScreen( modifier = modifier .fillMaxWidth() .wrapContentHeight() - .padding(bottom = 60.dp, start = 23.dp, end = 23.dp, top = 16.dp), + .padding(bottom = 60.dp, start = 23.dp, end = 23.dp), ) { itemsIndexed(JobType.entries) { index, option -> diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index 5e286b70..b457b5f2 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -74,8 +74,7 @@ fun PlanFilteringScreen( ChangeFilteringTitleText( text = stringResource(id = R.string.change_filter_grade_title), modifier = Modifier - .padding(top = 18.dp, bottom = 12.dp) - .padding(horizontal = 24.dp) + .padding(start = 23.dp, end = 23.dp, bottom = 12.dp) ) ChangePlanFilteringRadioGroup( diff --git a/feature/home/src/main/res/values/strings.xml b/feature/home/src/main/res/values/strings.xml index 6b0c63a0..76061479 100644 --- a/feature/home/src/main/res/values/strings.xml +++ b/feature/home/src/main/res/values/strings.xml @@ -28,6 +28,8 @@ 지원마감 필터링 + 직무 카테고리 + 계획 재학 상태 저장하기 1학년 From 986eff82492a7517eef383a24b949f5df8710371 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 28 Dec 2024 08:44:03 +0900 Subject: [PATCH 10/27] =?UTF-8?q?[FEAT/#313]=20=EC=A7=81=EB=AC=B4=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EB=A7=81=20=EC=84=9C=EB=B2=84=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/home/dto/request/ChangeFilterRequestDto.kt | 11 +++++++---- .../home/dto/response/HomeFilteringInfoResponseDto.kt | 2 ++ .../data/home/mapper/HomeFilteringInfoMapper.kt | 1 + .../domain/home/entity/ChangeFilteringRequestModel.kt | 9 +++++---- .../terning/domain/home/entity/HomeFilteringInfo.kt | 1 + .../main/java/com/terning/feature/home/HomeRoute.kt | 9 +++++---- .../java/com/terning/feature/home/HomeViewModel.kt | 11 +++++++++-- 7 files changed, 30 insertions(+), 14 deletions(-) diff --git a/data/home/src/main/java/com/terning/data/home/dto/request/ChangeFilterRequestDto.kt b/data/home/src/main/java/com/terning/data/home/dto/request/ChangeFilterRequestDto.kt index e476b414..126ddada 100644 --- a/data/home/src/main/java/com/terning/data/home/dto/request/ChangeFilterRequestDto.kt +++ b/data/home/src/main/java/com/terning/data/home/dto/request/ChangeFilterRequestDto.kt @@ -7,13 +7,15 @@ import kotlinx.serialization.Serializable @Serializable data class ChangeFilterRequestDto( @SerialName("grade") - val grade: String, + val grade: String?, @SerialName("workingPeriod") - val workingPeriod: String, + val workingPeriod: String?, @SerialName("startYear") - val startYear: Int, + val startYear: Int?, @SerialName("startMonth") - val startMonth: Int, + val startMonth: Int?, + @SerialName("jobType") + val jobType: String, ) fun ChangeFilteringRequestModel.toChangeFilterRequestDto(): ChangeFilterRequestDto = @@ -22,4 +24,5 @@ fun ChangeFilteringRequestModel.toChangeFilterRequestDto(): ChangeFilterRequestD workingPeriod = workingPeriod, startYear = startYear, startMonth = startMonth, + jobType = jobType, ) diff --git a/data/home/src/main/java/com/terning/data/home/dto/response/HomeFilteringInfoResponseDto.kt b/data/home/src/main/java/com/terning/data/home/dto/response/HomeFilteringInfoResponseDto.kt index 699a9a58..37bb4862 100644 --- a/data/home/src/main/java/com/terning/data/home/dto/response/HomeFilteringInfoResponseDto.kt +++ b/data/home/src/main/java/com/terning/data/home/dto/response/HomeFilteringInfoResponseDto.kt @@ -13,4 +13,6 @@ data class HomeFilteringInfoResponseDto( val startYear: Int?, @SerialName("startMonth") val startMonth: Int?, + @SerialName("jobType") + val jobType: String, ) diff --git a/data/home/src/main/java/com/terning/data/home/mapper/HomeFilteringInfoMapper.kt b/data/home/src/main/java/com/terning/data/home/mapper/HomeFilteringInfoMapper.kt index dc32a148..7ba34cb7 100644 --- a/data/home/src/main/java/com/terning/data/home/mapper/HomeFilteringInfoMapper.kt +++ b/data/home/src/main/java/com/terning/data/home/mapper/HomeFilteringInfoMapper.kt @@ -9,4 +9,5 @@ fun HomeFilteringInfoResponseDto.toHomeFilteringInfo(): HomeFilteringInfo = workingPeriod = this.workingPeriod, startYear = this.startYear, startMonth = this.startMonth, + jobType = this.jobType, ) \ No newline at end of file diff --git a/domain/home/src/main/java/com/terning/domain/home/entity/ChangeFilteringRequestModel.kt b/domain/home/src/main/java/com/terning/domain/home/entity/ChangeFilteringRequestModel.kt index ab722760..7da40f18 100644 --- a/domain/home/src/main/java/com/terning/domain/home/entity/ChangeFilteringRequestModel.kt +++ b/domain/home/src/main/java/com/terning/domain/home/entity/ChangeFilteringRequestModel.kt @@ -1,8 +1,9 @@ package com.terning.domain.home.entity data class ChangeFilteringRequestModel( - val grade: String, - val workingPeriod: String, - val startYear: Int, - val startMonth: Int, + val grade: String?, + val workingPeriod: String?, + val startYear: Int?, + val startMonth: Int?, + val jobType: String, ) diff --git a/domain/home/src/main/java/com/terning/domain/home/entity/HomeFilteringInfo.kt b/domain/home/src/main/java/com/terning/domain/home/entity/HomeFilteringInfo.kt index 9f117640..1a8392e6 100644 --- a/domain/home/src/main/java/com/terning/domain/home/entity/HomeFilteringInfo.kt +++ b/domain/home/src/main/java/com/terning/domain/home/entity/HomeFilteringInfo.kt @@ -5,4 +5,5 @@ data class HomeFilteringInfo( val workingPeriod: String?, val startYear: Int?, val startMonth: Int?, + val jobType: String, ) diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index 8c8e1131..d8873ba4 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -43,17 +43,18 @@ import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White +import com.terning.core.designsystem.type.JobType import com.terning.domain.home.entity.HomeFilteringInfo import com.terning.domain.home.entity.HomeRecommendIntern import com.terning.domain.home.entity.HomeUpcomingIntern import com.terning.feature.dialog.cancel.ScrapCancelDialog import com.terning.feature.dialog.detail.ScrapDialog -import com.terning.feature.home.component.bottomsheet.HomeFilteringBottomSheet import com.terning.feature.home.component.HomeFilteringScreen import com.terning.feature.home.component.HomeRecommendEmptyIntern import com.terning.feature.home.component.HomeUpcomingEmptyFilter import com.terning.feature.home.component.HomeUpcomingEmptyIntern import com.terning.feature.home.component.HomeUpcomingInternScreen +import com.terning.feature.home.component.bottomsheet.HomeFilteringBottomSheet import okhttp3.internal.toImmutableList const val NAME_MAX_LENGTH = 5 @@ -145,7 +146,7 @@ fun HomeScreen( val homeFilteringInfo = when (homeState.homeFilteringInfoState) { is UiState.Success -> (homeState.homeFilteringInfoState as UiState.Success).data - else -> HomeFilteringInfo(null, null, null, null) + else -> HomeFilteringInfo(null, null, null, null, JobType.TOTAL.stringValue) } val homeRecommendInternList = when (homeState.homeRecommendInternState) { @@ -188,12 +189,12 @@ fun HomeScreen( HomeFilteringBottomSheet( onDismiss = { changeFilteringSheetState = false }, defaultFilteringInfo = homeFilteringInfo, - onChangeButtonClick = { grade, workingPeriod, year, month -> + onChangeButtonClick = { grade, workingPeriod, year, month, jobType -> amplitudeTracker.track( type = EventType.CLICK, name = "home_filtering_save" ) - viewModel.putFilteringInfo(grade, workingPeriod, year, month) + viewModel.putFilteringInfo(grade, workingPeriod, year, month, jobType) changeFilteringSheetState = false } ) diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt index 06636e31..0aa39c74 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt @@ -75,14 +75,21 @@ class HomeViewModel @Inject constructor( } } - fun putFilteringInfo(grade: String, workingPeriod: String, year: Int, month: Int) { + fun putFilteringInfo( + grade: String?, + workingPeriod: String?, + year: Int?, + month: Int?, + jobType: String + ) { viewModelScope.launch { homeRepository.putFilteringInfo( ChangeFilteringRequestModel( grade, workingPeriod, year, - month + month, + jobType ) ).onSuccess { getFilteringInfo() From e23985942040778ab846c6cfee3219bb8d4cd641 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 28 Dec 2024 09:05:28 +0900 Subject: [PATCH 11/27] =?UTF-8?q?[FEAT/#313]=20padding=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/HomeFilteringBottomSheet.kt | 41 ++++++++++--------- .../bottomsheet/PlanFilteringScreen.kt | 10 ++--- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 4e88b64f..7c587144 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -36,6 +36,7 @@ import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.Grade +import com.terning.core.designsystem.type.JobType import com.terning.core.designsystem.type.WorkingPeriod import com.terning.domain.home.entity.HomeFilteringInfo import com.terning.feature.home.R @@ -51,7 +52,7 @@ fun HomeFilteringBottomSheet( modifier: Modifier = Modifier, defaultFilteringInfo: HomeFilteringInfo, onDismiss: () -> Unit, - onChangeButtonClick: (String, String, Int, Int) -> Unit, + onChangeButtonClick: (String?, String?, Int?, Int?, String) -> Unit, ) { val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) @@ -80,11 +81,9 @@ fun HomeFilteringBottomSheet( modifier = Modifier .padding(horizontal = 23.dp), verticalAlignment = Alignment.Bottom, + horizontalArrangement = Arrangement.spacedBy(28.dp), ) { filterType.forEachIndexed { index, option -> - if (index == 1) { - Spacer(modifier = Modifier.width(28.dp)) - } TerningTab( tabText = stringResource(id = option), selected = pagerState.currentPage == index, @@ -92,6 +91,7 @@ fun HomeFilteringBottomSheet( coroutineScope.launch { pagerState.animateScrollToPage(index) } + currentFilteringInfo = defaultFilteringInfo }) } } @@ -105,10 +105,18 @@ fun HomeFilteringBottomSheet( HorizontalPager( state = pagerState, - modifier = Modifier.padding(top = 16.dp) + modifier = Modifier + .padding(top = 16.dp), ) { if (pagerState.currentPage == 0) { - JobFilteringScreen(initOption = 0, onButtonClick = {}) + JobFilteringScreen( + initOption = JobType.fromString(currentFilteringInfo.jobType).ordinal, + onButtonClick = { jobType -> + currentFilteringInfo = currentFilteringInfo.copy( + jobType = jobType.stringValue + ) + }, + ) } else { PlanFilteringScreen( currentFilteringInfo = currentFilteringInfo, @@ -144,19 +152,14 @@ fun HomeFilteringBottomSheet( modifier = Modifier .padding(horizontal = 24.dp), onButtonClick = { - currentFilteringInfo.grade?.let { - currentFilteringInfo.workingPeriod?.let { it1 -> - currentFilteringInfo.startYear?.let { it2 -> - currentFilteringInfo.startMonth?.let { it3 -> - onChangeButtonClick( - it, - it1, - it2, - it3 - ) - } - } - } + with(currentFilteringInfo) { + onChangeButtonClick( + grade, + workingPeriod, + startYear, + startMonth, + jobType + ) } }, isEnabled = currentFilteringInfo.grade != null && currentFilteringInfo.workingPeriod != null diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index b457b5f2..82e6ef84 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -88,13 +88,13 @@ fun PlanFilteringScreen( onButtonClick = updateGrade, columns = 4, modifier = Modifier - .padding(horizontal = 24.dp), + .padding(horizontal = 23.dp), ) ChangeFilteringTitleText( text = stringResource(id = R.string.change_filter_period_title), modifier = Modifier - .padding(top = 32.dp, bottom = 12.dp) + .padding(top = 24.dp, bottom = 12.dp) .padding(horizontal = 24.dp) ) @@ -108,14 +108,13 @@ fun PlanFilteringScreen( ), onButtonClick = updateWorkingPeriod, modifier = Modifier - .padding(horizontal = 24.dp), + .padding(horizontal = 23.dp), ) ChangeFilteringTitleText( text = stringResource(id = R.string.change_filter_start_work_title), modifier = Modifier - .padding(top = 32.dp, bottom = 49.dp) - .padding(horizontal = 24.dp) + .padding(24.dp) ) HomeYearMonthPicker( @@ -196,7 +195,6 @@ fun ChangePlanFilteringRadioGroup( modifier = modifier .fillMaxWidth() .wrapContentHeight() - ) { itemsIndexed(optionList) { index, option -> ChangeFilterButton( From 1540186ae5277e47f6ba63dc5db732c3098c18ac Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 28 Dec 2024 11:26:41 +0900 Subject: [PATCH 12/27] =?UTF-8?q?[FEAT/#313]=20=EB=B0=94=ED=85=80=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EA=B8=B8=EC=9D=B4=20=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/component/bottomsheet/HomeFilteringBottomSheet.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 7c587144..1af019f4 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -66,7 +67,8 @@ fun HomeFilteringBottomSheet( content = { Column( modifier = modifier - .fillMaxWidth(), + .fillMaxWidth() + .fillMaxHeight(3 / 4f), ) { Text( text = stringResource(id = R.string.change_filter_top_bar_title), @@ -105,6 +107,7 @@ fun HomeFilteringBottomSheet( HorizontalPager( state = pagerState, + beyondViewportPageCount = 1, modifier = Modifier .padding(top = 16.dp), ) { @@ -144,6 +147,8 @@ fun HomeFilteringBottomSheet( } } + Spacer(modifier = Modifier.weight(1f)) + RoundButton( style = TerningTheme.typography.button0, paddingVertical = 19.dp, From 94c26d38481ae7c1aad291b72b694ec8e0b24787 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Mon, 30 Dec 2024 23:44:52 +0900 Subject: [PATCH 13/27] =?UTF-8?q?[CHORE/#313]=20ImmutableList=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/terning/feature/home/HomeRoute.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index d8873ba4..88194300 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -55,7 +55,9 @@ import com.terning.feature.home.component.HomeUpcomingEmptyFilter import com.terning.feature.home.component.HomeUpcomingEmptyIntern import com.terning.feature.home.component.HomeUpcomingInternScreen import com.terning.feature.home.component.bottomsheet.HomeFilteringBottomSheet -import okhttp3.internal.toImmutableList +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.persistentListOf +import kotlinx.collections.immutable.toImmutableList const val NAME_MAX_LENGTH = 5 @@ -149,10 +151,11 @@ fun HomeScreen( else -> HomeFilteringInfo(null, null, null, null, JobType.TOTAL.stringValue) } - val homeRecommendInternList = when (homeState.homeRecommendInternState) { - is UiState.Success -> (homeState.homeRecommendInternState as UiState.Success).data.homeRecommendInternDetail.toImmutableList() - else -> listOf() - } + val homeRecommendInternList: ImmutableList = + when (homeState.homeRecommendInternState) { + is UiState.Success -> (homeState.homeRecommendInternState as UiState.Success).data.homeRecommendInternDetail.toImmutableList() + else -> persistentListOf() + } val homeRecommendInternTotal = when (homeState.homeRecommendInternState) { is UiState.Success -> (homeState.homeRecommendInternState as UiState.Success).data.totalCount From b0744fb7f2d8cadf99fe6f9a0c588e70d555d9c2 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Mon, 30 Dec 2024 23:45:09 +0900 Subject: [PATCH 14/27] =?UTF-8?q?[DELETE/#313]=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 270 ------------------ 1 file changed, 270 deletions(-) delete mode 100644 feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt 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 deleted file mode 100644 index 98f9cc6d..00000000 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ /dev/null @@ -1,270 +0,0 @@ -//package com.terning.feature.home.component -// -//import androidx.compose.foundation.layout.Arrangement -//import androidx.compose.foundation.layout.Column -//import androidx.compose.foundation.layout.fillMaxWidth -//import androidx.compose.foundation.layout.padding -//import androidx.compose.foundation.layout.wrapContentHeight -//import androidx.compose.foundation.lazy.grid.GridCells -//import androidx.compose.foundation.lazy.grid.LazyVerticalGrid -//import androidx.compose.foundation.lazy.grid.itemsIndexed -//import androidx.compose.material3.Checkbox -//import androidx.compose.material3.ExperimentalMaterial3Api -//import androidx.compose.material3.HorizontalDivider -//import androidx.compose.material3.Text -//import androidx.compose.material3.rememberModalBottomSheetState -//import androidx.compose.runtime.Composable -//import androidx.compose.runtime.getValue -//import androidx.compose.runtime.mutableIntStateOf -//import androidx.compose.runtime.mutableStateOf -//import androidx.compose.runtime.remember -//import androidx.compose.runtime.setValue -//import androidx.compose.ui.Modifier -//import androidx.compose.ui.res.stringResource -//import androidx.compose.ui.unit.dp -//import com.terning.core.designsystem.R -//import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet -//import com.terning.core.designsystem.component.button.ChangeFilterButton -//import com.terning.core.designsystem.component.button.RoundButton -//import com.terning.core.designsystem.extension.currentMonth -//import com.terning.core.designsystem.extension.currentYear -//import com.terning.core.designsystem.theme.Black -//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 kotlinx.collections.immutable.toImmutableList -//import java.util.Calendar -// -//@OptIn(ExperimentalMaterial3Api::class) -//@Composable -//fun HomeFilteringBottomSheet( -// modifier: Modifier = Modifier, -// defaultGrade: Grade?, -// defaultWorkingPeriod: WorkingPeriod?, -// defaultStartYear: Int?, -// defaultStartMonth: Int?, -// onDismiss: () -> Unit, -// onChangeButtonClick: (String, String, Int, Int) -> Unit, -//) { -// val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) -// -// var currentGrade by remember { mutableStateOf(defaultGrade) } -// var currentPeriod by remember { mutableStateOf(defaultWorkingPeriod) } -// var currentStartYear by remember { -// mutableIntStateOf( -// defaultStartYear ?: Calendar.getInstance().currentYear -// ) -// } -// var currentStartMonth by remember { -// mutableIntStateOf( -// defaultStartMonth ?: Calendar.getInstance().currentMonth -// ) -// } -// -// var isYearNull by remember { mutableStateOf(defaultStartYear != null) } -// var isMonthNull by remember { mutableStateOf(defaultStartMonth != null) } -// -// var isCheckBoxChecked by remember { mutableStateOf(false) } -// -// var isInitialNullState by remember { mutableStateOf(false) } -// -// val yearsList by remember(isYearNull) { -// mutableStateOf( -// if (isYearNull || isInitialNullState) years + NULL_DATE -// else years -// ) -// } -// val monthsList by remember(isMonthNull) { -// mutableStateOf( -// if (isMonthNull || isInitialNullState) months + NULL_DATE -// else months -// ) -// } -// -// TerningBasicBottomSheet( -// content = { -// Column( -// modifier = modifier -// .fillMaxWidth(), -// ) { -// Text( -// text = stringResource(id = R.string.change_filter_top_bar_title), -// style = TerningTheme.typography.title2, -// color = Black, -// modifier = Modifier -// .padding(horizontal = 24.dp) -// .padding(bottom = 16.dp), -// ) -// -// HorizontalDivider( -// thickness = 1.dp, -// color = Grey200, -// modifier = Modifier -// .padding(horizontal = 24.dp), -// ) -// -// ChangeFilteringTitleText( -// text = stringResource(id = R.string.change_filter_grade_title), -// modifier = Modifier -// .padding(top = 18.dp, bottom = 12.dp) -// .padding(horizontal = 24.dp) -// ) -// -// ChangeFilteringRadioGroup( -// initOption = defaultGrade?.ordinal ?: -1, -// optionList = listOf( -// R.string.change_filter_grade_1, -// R.string.change_filter_grade_2, -// R.string.change_filter_grade_3, -// R.string.change_filter_grade_4, -// ), -// onButtonClick = { index -> -// currentGrade = Grade.entries[index] -// }, -// modifier = Modifier -// .padding(horizontal = 24.dp), -// ) -// -// ChangeFilteringTitleText( -// text = stringResource(id = R.string.change_filter_period_title), -// modifier = Modifier -// .padding(top = 32.dp, bottom = 12.dp) -// .padding(horizontal = 24.dp) -// ) -// -// ChangeFilteringRadioGroup( -// initOption = defaultWorkingPeriod?.ordinal ?: -1, -// optionList = listOf( -// R.string.change_filter_period_1, -// R.string.change_filter_period_2, -// R.string.change_filter_period_3, -// ), -// onButtonClick = { index -> -// currentPeriod = WorkingPeriod.entries[index] -// }, -// modifier = Modifier -// .padding(horizontal = 24.dp), -// ) -// -// ChangeFilteringTitleText( -// text = stringResource(id = R.string.change_filter_start_work_title), -// modifier = Modifier -// .padding(top = 32.dp, bottom = 49.dp) -// .padding(horizontal = 24.dp) -// ) -// -// //TODO: 아래는 임시 체크박스로, 추후 수정 부탁합니다! -// Checkbox( -// checked = isCheckBoxChecked, -// onCheckedChange = { isChecked -> -// if (isChecked) { -// isYearNull = true -// isMonthNull = true -// } -// isCheckBoxChecked = isChecked -// }, -// modifier = Modifier.padding(start = 20.dp) -// ) -// -// HomeYearMonthPicker( -// chosenYear = defaultStartYear, -// chosenMonth = defaultStartMonth, -// onYearChosen = { year, isInitialSelection -> -// if (year != null) { -// currentStartYear = year -// isCheckBoxChecked = false -// isYearNull = false -// isInitialNullState = isInitialSelection -// } -// }, -// onMonthChosen = { month, isInitialSelection -> -// if (month != null) { -// currentStartMonth = month -// isCheckBoxChecked = false -// isMonthNull = false -// isInitialNullState = isInitialSelection -// } -// }, -// isYearNull = isYearNull, -// isMonthNull = isMonthNull, -// yearsList = yearsList.toImmutableList(), -// monthsList = monthsList.toImmutableList(), -// isInitialNullState = isInitialNullState -// ) -// -// RoundButton( -// style = TerningTheme.typography.button0, -// paddingVertical = 19.dp, -// text = R.string.change_filter_save, -// cornerRadius = 10.dp, -// modifier = Modifier -// .padding(horizontal = 24.dp) -// .padding(top = 51.dp), -// onButtonClick = { -// currentGrade?.let { grade -> -// currentPeriod?.let { workingPeriod -> -// onChangeButtonClick( -// grade.stringValue, -// workingPeriod.stringValue, -// currentStartYear, -// currentStartMonth, -// ) -// } -// } -// }, -// isEnabled = currentGrade != null && currentPeriod != null -// ) -// } -// }, -// onDismissRequest = onDismiss, -// sheetState = sheetState, -// ) -//} -// -//@Composable -//fun ChangeFilteringTitleText( -// text: String, -// modifier: Modifier = Modifier, -//) { -// Text( -// text = text, -// style = TerningTheme.typography.title4, -// color = Black, -// modifier = modifier, -// ) -//} -// -//@Composable -//fun ChangeFilteringRadioGroup( -// optionList: List, -// initOption: Int, -// onButtonClick: (Int) -> Unit, -// modifier: Modifier = Modifier, -//) { -// var selectedIndex by remember { mutableIntStateOf(initOption) } -// -// LazyVerticalGrid( -// columns = GridCells.Fixed(optionList.size), -// horizontalArrangement = Arrangement.spacedBy(13.dp), -// modifier = modifier -// .fillMaxWidth() -// .wrapContentHeight() -// -// ) { -// itemsIndexed(optionList) { index, option -> -// ChangeFilterButton( -// isSelected = selectedIndex == index, -// modifier = Modifier -// .wrapContentHeight(), -// text = option, -// cornerRadius = 10.dp, -// paddingVertical = 10.dp, -// onButtonClick = { -// selectedIndex = index -// onButtonClick(index) -// } -// ) -// } -// } -//} \ No newline at end of file From c4ea3224de532c0e9045fe25f1ac1e5e11317148 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Mon, 30 Dec 2024 23:45:45 +0900 Subject: [PATCH 15/27] =?UTF-8?q?[FEAT/#313]=20=ED=83=AD=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=20=EC=8B=9C=20=EC=83=81=ED=83=9C=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/HomeFilteringBottomSheet.kt | 76 ++++++++++--------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 1af019f4..ed6097a2 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -18,6 +18,7 @@ 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.mutableStateOf import androidx.compose.runtime.remember @@ -63,6 +64,10 @@ fun HomeFilteringBottomSheet( val pagerState = rememberPagerState { 2 } val coroutineScope = rememberCoroutineScope() + LaunchedEffect(pagerState.currentPage) { + currentFilteringInfo = defaultFilteringInfo + } + TerningBasicBottomSheet( content = { Column( @@ -93,7 +98,6 @@ fun HomeFilteringBottomSheet( coroutineScope.launch { pagerState.animateScrollToPage(index) } - currentFilteringInfo = defaultFilteringInfo }) } } @@ -111,39 +115,43 @@ fun HomeFilteringBottomSheet( modifier = Modifier .padding(top = 16.dp), ) { - if (pagerState.currentPage == 0) { - JobFilteringScreen( - initOption = JobType.fromString(currentFilteringInfo.jobType).ordinal, - onButtonClick = { jobType -> - currentFilteringInfo = currentFilteringInfo.copy( - jobType = jobType.stringValue - ) - }, - ) - } else { - PlanFilteringScreen( - currentFilteringInfo = currentFilteringInfo, - updateGrade = { - currentFilteringInfo = currentFilteringInfo.copy( - grade = Grade.entries[it].stringValue - ) - }, - updateWorkingPeriod = { - currentFilteringInfo = currentFilteringInfo.copy( - workingPeriod = WorkingPeriod.entries[it].stringValue - ) - }, - updateStartYear = { - currentFilteringInfo = currentFilteringInfo.copy( - startYear = it - ) - }, - updateStartMonth = { - currentFilteringInfo = currentFilteringInfo.copy( - startMonth = it - ) - }, - ) + when (pagerState.currentPage) { + 0 -> { + JobFilteringScreen( + initOption = JobType.fromString(currentFilteringInfo.jobType).ordinal, + onButtonClick = { jobType -> + currentFilteringInfo = currentFilteringInfo.copy( + jobType = jobType.stringValue + ) + }, + ) + } + + 1 -> { + PlanFilteringScreen( + currentFilteringInfo = currentFilteringInfo, + updateGrade = { + currentFilteringInfo = currentFilteringInfo.copy( + grade = Grade.entries[it].stringValue + ) + }, + updateWorkingPeriod = { + currentFilteringInfo = currentFilteringInfo.copy( + workingPeriod = WorkingPeriod.entries[it].stringValue + ) + }, + updateStartYear = { + currentFilteringInfo = currentFilteringInfo.copy( + startYear = it + ) + }, + updateStartMonth = { + currentFilteringInfo = currentFilteringInfo.copy( + startMonth = it + ) + }, + ) + } } } From f950e927a0ce4b16faca7aec84bc5943a3aea2f2 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Tue, 31 Dec 2024 04:07:12 +0900 Subject: [PATCH 16/27] =?UTF-8?q?[FEAT/#313]=20=EB=9D=BC=EB=94=94=EC=98=A4?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=EB=B0=95=EC=8A=A4=20=ED=95=B4=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/HomeFilteringBottomSheet.kt | 18 ++++++++--- .../bottomsheet/PlanFilteringScreen.kt | 30 ++++++++++++++----- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index ed6097a2..395ad7d9 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -132,12 +132,16 @@ fun HomeFilteringBottomSheet( currentFilteringInfo = currentFilteringInfo, updateGrade = { currentFilteringInfo = currentFilteringInfo.copy( - grade = Grade.entries[it].stringValue + grade = if (it != null) { + Grade.entries[it].stringValue + } else null ) }, updateWorkingPeriod = { currentFilteringInfo = currentFilteringInfo.copy( - workingPeriod = WorkingPeriod.entries[it].stringValue + workingPeriod = if (it != null) { + WorkingPeriod.entries[it].stringValue + } else null ) }, updateStartYear = { @@ -175,7 +179,7 @@ fun HomeFilteringBottomSheet( ) } }, - isEnabled = currentFilteringInfo.grade != null && currentFilteringInfo.workingPeriod != null + isEnabled = checkButtonEnable(currentFilteringInfo = currentFilteringInfo) ) } @@ -227,4 +231,10 @@ fun TerningTab( .background(if (selected) TerningMain else Color.Transparent) ) } -} \ No newline at end of file +} + +private fun checkButtonEnable(currentFilteringInfo: HomeFilteringInfo): Boolean = + with(currentFilteringInfo) { + (grade == null && workingPeriod == null && startYear == null && startMonth == null) + || (grade != null && workingPeriod != null && startYear != null && startMonth != null) + } \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index 82e6ef84..7ebd7fcb 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -45,10 +45,10 @@ import kotlinx.collections.immutable.toImmutableList @Composable fun PlanFilteringScreen( currentFilteringInfo: HomeFilteringInfo, - updateGrade: (Int) -> Unit, - updateWorkingPeriod: (Int) -> Unit, - updateStartYear: (Int) -> Unit, - updateStartMonth: (Int) -> Unit, + updateGrade: (Int?) -> Unit, + updateWorkingPeriod: (Int?) -> Unit, + updateStartYear: (Int?) -> Unit, + updateStartMonth: (Int?) -> Unit, ) { var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == null) } var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == null) } @@ -79,13 +79,17 @@ fun PlanFilteringScreen( ChangePlanFilteringRadioGroup( initOption = currentFilteringInfo.grade?.let { Grade.fromString(it).ordinal } ?: -1, + isCheckBoxChecked = isCheckBoxChecked, optionList = listOf( R.string.change_filter_grade_1, R.string.change_filter_grade_2, R.string.change_filter_grade_3, R.string.change_filter_grade_4, ), - onButtonClick = updateGrade, + onButtonClick = { + updateGrade(it) + isCheckBoxChecked = false + }, columns = 4, modifier = Modifier .padding(horizontal = 23.dp), @@ -101,12 +105,16 @@ fun PlanFilteringScreen( ChangePlanFilteringRadioGroup( initOption = currentFilteringInfo.workingPeriod?.let { WorkingPeriod.fromString(it).ordinal } ?: -1, + isCheckBoxChecked = isCheckBoxChecked, optionList = listOf( R.string.change_filter_period_1, R.string.change_filter_period_2, R.string.change_filter_period_3, ), - onButtonClick = updateWorkingPeriod, + onButtonClick = { + updateWorkingPeriod(it) + isCheckBoxChecked = false + }, modifier = Modifier .padding(horizontal = 23.dp), ) @@ -157,6 +165,10 @@ fun PlanFilteringScreen( if (isChecked) { isYearNull = true isMonthNull = true + updateGrade(null) + updateWorkingPeriod(null) + updateStartYear(null) + updateStartMonth(null) } isCheckBoxChecked = isChecked }, @@ -183,11 +195,15 @@ fun PlanFilteringScreen( fun ChangePlanFilteringRadioGroup( optionList: List, initOption: Int, + isCheckBoxChecked: Boolean, onButtonClick: (Int) -> Unit, columns: Int = 3, modifier: Modifier = Modifier, ) { var selectedIndex by remember { mutableIntStateOf(initOption) } + if (isCheckBoxChecked) { + selectedIndex = -1 + } LazyVerticalGrid( columns = GridCells.Fixed(columns), @@ -198,7 +214,7 @@ fun ChangePlanFilteringRadioGroup( ) { itemsIndexed(optionList) { index, option -> ChangeFilterButton( - isSelected = selectedIndex == index, + isSelected = selectedIndex == index && !isCheckBoxChecked, modifier = Modifier .wrapContentHeight(), text = option, From fbdc62774ba51d9f611d925f72f4b984e3f67130 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 4 Jan 2025 03:45:22 +0900 Subject: [PATCH 17/27] =?UTF-8?q?[CHORE/#313]=20=ED=99=88=20=EB=B7=B0=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=A0=91=EA=B7=BC?= =?UTF-8?q?=EC=A0=9C=EC=96=B4=EC=9E=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/bottomsheet/HomeFilteringBottomSheet.kt | 2 +- .../component/{ => bottomsheet}/HomeYearMonthPicker.kt | 10 +++++----- .../home/component/bottomsheet/JobFilteringScreen.kt | 2 +- .../home/component/bottomsheet/PlanFilteringScreen.kt | 8 ++------ 4 files changed, 9 insertions(+), 13 deletions(-) rename feature/home/src/main/java/com/terning/feature/home/component/{ => bottomsheet}/HomeYearMonthPicker.kt (97%) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 395ad7d9..70bf3d49 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -50,7 +50,7 @@ val filterType = @OptIn(ExperimentalMaterial3Api::class) @Composable -fun HomeFilteringBottomSheet( +internal fun HomeFilteringBottomSheet( modifier: Modifier = Modifier, defaultFilteringInfo: HomeFilteringInfo, onDismiss: () -> Unit, 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/bottomsheet/HomeYearMonthPicker.kt similarity index 97% rename from feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt rename to feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeYearMonthPicker.kt index d1f613ea..eab6e1bb 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/bottomsheet/HomeYearMonthPicker.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.component +package com.terning.feature.home.component.bottomsheet import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior import androidx.compose.foundation.layout.Arrangement @@ -52,10 +52,10 @@ class PickerState { } @Composable -fun rememberPickerState() = remember { PickerState() } +private fun rememberPickerState() = remember { PickerState() } @Composable -fun HomeYearMonthPicker( +internal fun HomeYearMonthPicker( modifier: Modifier = Modifier, chosenYear: Int?, chosenMonth: Int?, @@ -116,7 +116,7 @@ fun HomeYearMonthPicker( } @Composable -fun DatePicker( +private fun DatePicker( items: ImmutableList, modifier: Modifier = Modifier, pickerState: PickerState = rememberPickerState(), @@ -196,7 +196,7 @@ fun DatePicker( } @Composable -fun DatePickerContent( +private fun DatePickerContent( color: Color, text: String, modifier: Modifier = Modifier, diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt index 7c427460..03f24343 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/JobFilteringScreen.kt @@ -32,7 +32,7 @@ import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.JobType @Composable -fun JobFilteringScreen( +internal fun JobFilteringScreen( initOption: Int, onButtonClick: (JobType) -> Unit, modifier: Modifier = Modifier, diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index 7ebd7fcb..7cb74b2b 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -35,15 +35,11 @@ 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 com.terning.feature.home.component.HomeYearMonthPicker -import com.terning.feature.home.component.NULL_DATE -import com.terning.feature.home.component.months -import com.terning.feature.home.component.years import kotlinx.collections.immutable.toImmutableList @OptIn(ExperimentalMaterial3Api::class) @Composable -fun PlanFilteringScreen( +internal fun PlanFilteringScreen( currentFilteringInfo: HomeFilteringInfo, updateGrade: (Int?) -> Unit, updateWorkingPeriod: (Int?) -> Unit, @@ -192,7 +188,7 @@ fun PlanFilteringScreen( } @Composable -fun ChangePlanFilteringRadioGroup( +private fun ChangePlanFilteringRadioGroup( optionList: List, initOption: Int, isCheckBoxChecked: Boolean, From 7cf5be01f5cbb7b193ae8f9646e707870ff24450 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 4 Jan 2025 16:08:30 +0900 Subject: [PATCH 18/27] =?UTF-8?q?[FEAT/#313]=20selectedIndex=20LaunchedEff?= =?UTF-8?q?ect=20=EB=82=B4=EB=B6=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/HomeFilteringBottomSheet.kt | 4 ++-- .../bottomsheet/PlanFilteringScreen.kt | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 70bf3d49..93e31aec 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -45,7 +45,7 @@ import com.terning.feature.home.R import kotlinx.coroutines.launch import okhttp3.internal.toImmutableList -val filterType = +private val filterType = listOf(R.string.change_job_type_filter, R.string.change_plan_type_filter).toImmutableList() @OptIn(ExperimentalMaterial3Api::class) @@ -61,7 +61,7 @@ internal fun HomeFilteringBottomSheet( var currentFilteringInfo by remember { mutableStateOf(defaultFilteringInfo) } - val pagerState = rememberPagerState { 2 } + val pagerState = rememberPagerState { filterType.size } val coroutineScope = rememberCoroutineScope() LaunchedEffect(pagerState.currentPage) { diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index 7cb74b2b..d1d98e47 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -16,6 +16,7 @@ import androidx.compose.material3.LocalMinimumInteractiveComponentEnforcement import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf @@ -70,7 +71,11 @@ internal fun PlanFilteringScreen( ChangeFilteringTitleText( text = stringResource(id = R.string.change_filter_grade_title), modifier = Modifier - .padding(start = 23.dp, end = 23.dp, bottom = 12.dp) + .padding( + start = 23.dp, + end = 23.dp, + bottom = 12.dp + ) ) ChangePlanFilteringRadioGroup( @@ -152,7 +157,11 @@ internal fun PlanFilteringScreen( horizontalArrangement = Arrangement.End, modifier = Modifier .fillMaxWidth() - .padding(bottom = 13.dp, top = 26.dp, end = 24.dp), + .padding( + bottom = 13.dp, + top = 26.dp, + end = 24.dp + ), ) { CompositionLocalProvider(LocalMinimumInteractiveComponentEnforcement provides false) { Checkbox( @@ -197,8 +206,11 @@ private fun ChangePlanFilteringRadioGroup( modifier: Modifier = Modifier, ) { var selectedIndex by remember { mutableIntStateOf(initOption) } - if (isCheckBoxChecked) { - selectedIndex = -1 + + LaunchedEffect(isCheckBoxChecked) { + if (isCheckBoxChecked) { + selectedIndex = -1 + } } LazyVerticalGrid( From 488d334229346c2097432a9cc5b23e37dc64181c Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 4 Jan 2025 16:17:49 +0900 Subject: [PATCH 19/27] =?UTF-8?q?[FEAT/#313]=20list=20->=20immutableList?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/home/HomeRoute.kt | 8 +++++++- .../component/bottomsheet/HomeFilteringBottomSheet.kt | 9 +++++---- .../home/component/bottomsheet/PlanFilteringScreen.kt | 9 +++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index 88194300..a68b0f76 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -148,7 +148,13 @@ fun HomeScreen( val homeFilteringInfo = when (homeState.homeFilteringInfoState) { is UiState.Success -> (homeState.homeFilteringInfoState as UiState.Success).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 = diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 93e31aec..9e3d0406 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -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) @@ -98,7 +98,8 @@ internal fun HomeFilteringBottomSheet( coroutineScope.launch { pagerState.animateScrollToPage(index) } - }) + } + ) } } @@ -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 } } \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index d1d98e47..037bbd68 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -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) @@ -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 @@ -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 @@ -198,12 +199,12 @@ internal fun PlanFilteringScreen( @Composable private fun ChangePlanFilteringRadioGroup( - optionList: List, + optionList: ImmutableList, initOption: Int, isCheckBoxChecked: Boolean, onButtonClick: (Int) -> Unit, - columns: Int = 3, modifier: Modifier = Modifier, + columns: Int = 3, ) { var selectedIndex by remember { mutableIntStateOf(initOption) } From 65c6d3f9e29aa43a4879b36099ae287161dd97c6 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 4 Jan 2025 16:18:43 +0900 Subject: [PATCH 20/27] =?UTF-8?q?[FEAT/#310]=200=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B0=98=EC=98=81=20=EB=B0=8F=20=EA=B8=B0=EC=A1=B4=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/component/HomeYearMonthPicker.kt | 24 +++++++++++++++++-- .../bottomsheet/PlanFilteringScreen.kt | 10 +++++--- 2 files changed, 29 insertions(+), 5 deletions(-) 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 d1f613ea..afa79060 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,5 +1,6 @@ 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 @@ -56,7 +57,6 @@ fun rememberPickerState() = remember { PickerState() } @Composable fun HomeYearMonthPicker( - modifier: Modifier = Modifier, chosenYear: Int?, chosenMonth: Int?, onYearChosen: (Int?, Boolean) -> Unit, @@ -65,7 +65,8 @@ fun HomeYearMonthPicker( isMonthNull: Boolean, yearsList: ImmutableList, monthsList: ImmutableList, - isInitialNullState: Boolean + isInitialNullState: Boolean, + modifier: Modifier = Modifier, ) { val yearPickerState = rememberPickerState() val monthPickerState = rememberPickerState() @@ -75,9 +76,12 @@ fun HomeYearMonthPicker( val startYearIndex = if (isYearNull) yearsList.lastIndex else yearsList.indexOf("${chosenYear ?: "-"}년") .takeIf { it >= 0 } ?: 0 + Log.d("LYB", "INSIDE datapicker startYearIndex = $startYearIndex") val startMonthIndex = if (isMonthNull) monthsList.lastIndex else monthsList.indexOf("${chosenMonth ?: "-"}월") .takeIf { it >= 0 } ?: 0 + Log.d("LYB", "INSIDE datapicker startMonthIndex = $startMonthIndex") + Row( modifier = modifier @@ -92,6 +96,7 @@ fun HomeYearMonthPicker( startIndex = startYearIndex, onItemSelected = { year -> if (year == NULL_DATE && !isInitialSelection) isInitialSelection = true + Log.d("LYB", "INSIDE datepicker year = $year") onYearChosen( if (year == NULL_DATE) null else year.dropLast(1).toInt(), isInitialSelection @@ -134,19 +139,34 @@ fun DatePicker( LaunchedEffect(itemHeightPixel, startIndex) { if (itemHeightPixel > 0 && startIndex >= 0) scrollState.scrollToItem(startIndex) } + // 현재 index를 상태로 저장 + var savedIndex by remember { mutableIntStateOf(startIndex) } + + LaunchedEffect(itemHeightPixel, savedIndex) { +// if (itemHeightPixel > 0 && savedIndex > 0) { + scrollState.scrollToItem(savedIndex) + } + // } LaunchedEffect(scrollState) { snapshotFlow { scrollState.firstVisibleItemIndex } .map { index -> +// savedIndex = index // 현재 index를 저장 val hasNullDate = items.size == (END_YEAR - START_YEAR + 1) || items.size == (END_MONTH - START_MONTH + 1) val adjustedItems = if (hasNullDate) items + NULL_DATE else items + Log.d("LYB", "***index*** = $index") + + if (index == 12) savedIndex = 12 + if (index == 21) savedIndex = 21 + Log.d("LYB", "***savedIndex*** = $savedIndex") adjustedItems.getOrNull(index) } .distinctUntilChanged() .collect { item -> item?.let { pickerState.selectedItem = it + Log.d("LYB", "INSIDE datepicker it = $it") onItemSelected(it) } } diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index 7ebd7fcb..28fb412d 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -1,5 +1,6 @@ package com.terning.feature.home.component.bottomsheet +import android.util.Log import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -50,8 +51,8 @@ fun PlanFilteringScreen( updateStartYear: (Int?) -> Unit, updateStartMonth: (Int?) -> Unit, ) { - var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == null) } - var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == null) } + var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == 0) } + var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == 0) } var isCheckBoxChecked by remember { mutableStateOf(false) } @@ -124,12 +125,14 @@ fun PlanFilteringScreen( modifier = Modifier .padding(24.dp) ) - + Log.d("LYB", "current startYear = ${currentFilteringInfo.startYear}") + Log.d("LYB", "current startMonth = ${currentFilteringInfo.startMonth}") HomeYearMonthPicker( chosenYear = currentFilteringInfo.startYear, chosenMonth = currentFilteringInfo.startMonth, onYearChosen = { year, isInitialSelection -> if (year != null) { + Log.d("LYB", "current year = ${year}") updateStartYear(year) isCheckBoxChecked = false isYearNull = false @@ -138,6 +141,7 @@ fun PlanFilteringScreen( }, onMonthChosen = { month, isInitialSelection -> if (month != null) { + Log.d("LYB", "current month = ${month}") updateStartMonth(month) isCheckBoxChecked = false isMonthNull = false From 26a7a2342e78d0d7cf8a3d5e3db04ed1435cea54 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 4 Jan 2025 22:38:37 +0900 Subject: [PATCH 21/27] =?UTF-8?q?[FEAT/#310]=20=EC=8A=A4=ED=81=AC=EB=A1=A4?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/home/component/HomeYearMonthPicker.kt | 14 +++----------- .../component/bottomsheet/PlanFilteringScreen.kt | 11 +++++------ 2 files changed, 8 insertions(+), 17 deletions(-) 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 afa79060..ea9eac58 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 @@ -75,14 +75,13 @@ fun HomeYearMonthPicker( val startYearIndex = if (isYearNull) yearsList.lastIndex else yearsList.indexOf("${chosenYear ?: "-"}년") - .takeIf { it >= 0 } ?: 0 + .takeIf { it >= 0 } ?: yearsList.lastIndex Log.d("LYB", "INSIDE datapicker startYearIndex = $startYearIndex") val startMonthIndex = if (isMonthNull) monthsList.lastIndex else monthsList.indexOf("${chosenMonth ?: "-"}월") - .takeIf { it >= 0 } ?: 0 + .takeIf { it >= 0 } ?: monthsList.lastIndex Log.d("LYB", "INSIDE datapicker startMonthIndex = $startMonthIndex") - Row( modifier = modifier .fillMaxWidth() @@ -139,27 +138,20 @@ fun DatePicker( LaunchedEffect(itemHeightPixel, startIndex) { if (itemHeightPixel > 0 && startIndex >= 0) scrollState.scrollToItem(startIndex) } - // 현재 index를 상태로 저장 + var savedIndex by remember { mutableIntStateOf(startIndex) } LaunchedEffect(itemHeightPixel, savedIndex) { -// if (itemHeightPixel > 0 && savedIndex > 0) { scrollState.scrollToItem(savedIndex) } - // } LaunchedEffect(scrollState) { snapshotFlow { scrollState.firstVisibleItemIndex } .map { index -> -// savedIndex = index // 현재 index를 저장 val hasNullDate = items.size == (END_YEAR - START_YEAR + 1) || items.size == (END_MONTH - START_MONTH + 1) val adjustedItems = if (hasNullDate) items + NULL_DATE else items Log.d("LYB", "***index*** = $index") - - if (index == 12) savedIndex = 12 - if (index == 21) savedIndex = 21 - Log.d("LYB", "***savedIndex*** = $savedIndex") adjustedItems.getOrNull(index) } .distinctUntilChanged() diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index 28fb412d..7d757e69 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -125,24 +125,23 @@ fun PlanFilteringScreen( modifier = Modifier .padding(24.dp) ) - Log.d("LYB", "current startYear = ${currentFilteringInfo.startYear}") - Log.d("LYB", "current startMonth = ${currentFilteringInfo.startMonth}") + HomeYearMonthPicker( chosenYear = currentFilteringInfo.startYear, chosenMonth = currentFilteringInfo.startMonth, onYearChosen = { year, isInitialSelection -> + Log.d("LYB", "current year = ${year}") + updateStartYear(year) if (year != null) { - Log.d("LYB", "current year = ${year}") - updateStartYear(year) isCheckBoxChecked = false isYearNull = false isInitialNullState = isInitialSelection } }, onMonthChosen = { month, isInitialSelection -> + Log.d("LYB", "current month = ${month}") + updateStartMonth(month) if (month != null) { - Log.d("LYB", "current month = ${month}") - updateStartMonth(month) isCheckBoxChecked = false isMonthNull = false isInitialNullState = isInitialSelection From 44124cf15a078dedf28ab4cb164276c7bcf8dab6 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 4 Jan 2025 23:09:27 +0900 Subject: [PATCH 22/27] =?UTF-8?q?[FEAT/#319]=200=20=EB=98=90=EB=8A=94=20nu?= =?UTF-8?q?ll=20=EC=B2=98=EB=A6=AC=20=EC=A1=B0=EA=B1=B4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/component/HomeYearMonthPicker.kt | 8 +------- .../home/component/bottomsheet/PlanFilteringScreen.kt | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) 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 ea9eac58..f120245f 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 @@ -76,11 +75,9 @@ fun HomeYearMonthPicker( val startYearIndex = if (isYearNull) yearsList.lastIndex else yearsList.indexOf("${chosenYear ?: "-"}년") .takeIf { it >= 0 } ?: yearsList.lastIndex - Log.d("LYB", "INSIDE datapicker startYearIndex = $startYearIndex") val startMonthIndex = if (isMonthNull) monthsList.lastIndex else monthsList.indexOf("${chosenMonth ?: "-"}월") .takeIf { it >= 0 } ?: monthsList.lastIndex - Log.d("LYB", "INSIDE datapicker startMonthIndex = $startMonthIndex") Row( modifier = modifier @@ -95,7 +92,6 @@ fun HomeYearMonthPicker( startIndex = startYearIndex, onItemSelected = { year -> if (year == NULL_DATE && !isInitialSelection) isInitialSelection = true - Log.d("LYB", "INSIDE datepicker year = $year") onYearChosen( if (year == NULL_DATE) null else year.dropLast(1).toInt(), isInitialSelection @@ -139,7 +135,7 @@ fun DatePicker( if (itemHeightPixel > 0 && startIndex >= 0) scrollState.scrollToItem(startIndex) } - var savedIndex by remember { mutableIntStateOf(startIndex) } + val savedIndex by remember { mutableIntStateOf(startIndex) } LaunchedEffect(itemHeightPixel, savedIndex) { scrollState.scrollToItem(savedIndex) @@ -151,14 +147,12 @@ fun DatePicker( val hasNullDate = items.size == (END_YEAR - START_YEAR + 1) || items.size == (END_MONTH - START_MONTH + 1) val adjustedItems = if (hasNullDate) items + NULL_DATE else items - Log.d("LYB", "***index*** = $index") adjustedItems.getOrNull(index) } .distinctUntilChanged() .collect { item -> item?.let { pickerState.selectedItem = it - Log.d("LYB", "INSIDE datepicker it = $it") onItemSelected(it) } } diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index 7d757e69..71f10a9e 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -51,8 +51,8 @@ fun PlanFilteringScreen( updateStartYear: (Int?) -> Unit, updateStartMonth: (Int?) -> Unit, ) { - var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == 0) } - var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == 0) } + 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) } From 9072a3885354d28db7efe1112316ae11a269bafa Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 5 Jan 2025 01:01:02 +0900 Subject: [PATCH 23/27] =?UTF-8?q?[FEAT/#313]=20pager=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=20=EC=8A=AC=EB=9D=BC=EC=9D=B4=EB=93=9C=20=EC=8B=9C=20=EA=B0=99?= =?UTF-8?q?=EC=9D=80=20=ED=99=94=EB=A9=B4=20=EB=B3=B4=EC=9D=B4=EB=8A=94=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/component/bottomsheet/HomeFilteringBottomSheet.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 76a2743b..79cdb039 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -115,8 +115,8 @@ internal fun HomeFilteringBottomSheet( beyondViewportPageCount = 1, modifier = Modifier .padding(top = 16.dp), - ) { - when (pagerState.currentPage) { + ) { currentPage -> + when (currentPage) { 0 -> { JobFilteringScreen( initOption = JobType.fromString(currentFilteringInfo.jobType).ordinal, From 5c829366c26f7e6aec0b81efeec28228e40b2598 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 5 Jan 2025 02:06:08 +0900 Subject: [PATCH 24/27] =?UTF-8?q?[FEAT/#313]=20=EB=B0=94=ED=85=80=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EA=B8=B0=EA=B8=B0=EB=8C=80=EC=9D=91=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/HomeFilteringBottomSheet.kt | 34 +++++++++++++++---- .../bottomsheet/PlanFilteringScreen.kt | 13 ++++--- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index 79cdb039..c7eef17f 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -20,6 +19,7 @@ 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 import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope @@ -27,6 +27,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet @@ -64,16 +66,24 @@ internal fun HomeFilteringBottomSheet( val pagerState = rememberPagerState { filterType.size } val coroutineScope = rememberCoroutineScope() + val density = LocalDensity.current + var pageHeight by remember { mutableIntStateOf(0) } + LaunchedEffect(pagerState.currentPage) { currentFilteringInfo = defaultFilteringInfo } + GetPagerHeight( + onHeightMeasured = { + pageHeight = it + } + ) + TerningBasicBottomSheet( content = { Column( modifier = modifier - .fillMaxWidth() - .fillMaxHeight(3 / 4f), + .fillMaxWidth(), ) { Text( text = stringResource(id = R.string.change_filter_top_bar_title), @@ -125,6 +135,7 @@ internal fun HomeFilteringBottomSheet( jobType = jobType.stringValue ) }, + modifier = Modifier.height(with(density) { pageHeight.toDp() }) ) } @@ -160,8 +171,6 @@ internal fun HomeFilteringBottomSheet( } } - Spacer(modifier = Modifier.weight(1f)) - RoundButton( style = TerningTheme.typography.button0, paddingVertical = 19.dp, @@ -238,4 +247,17 @@ private fun checkButtonEnable(currentFilteringInfo: HomeFilteringInfo): Boolean with(currentFilteringInfo) { listOf(grade, workingPeriod, startYear, startMonth).all { it == null } || listOf(grade, workingPeriod, startYear, startMonth).none { it == null } - } \ No newline at end of file + } + +@Composable +private fun GetPagerHeight( + onHeightMeasured: (Int) -> Unit, +) { + PlanFilteringScreen( + currentFilteringInfo = HomeFilteringInfo(null, null, null, null, "total"), + modifier = Modifier + .onGloballyPositioned { + onHeightMeasured(it.size.height) + } + ) +} \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt index e5d8d2b3..8f3eca20 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt @@ -43,10 +43,11 @@ import kotlinx.collections.immutable.toImmutableList @Composable internal fun PlanFilteringScreen( currentFilteringInfo: HomeFilteringInfo, - updateGrade: (Int?) -> Unit, - updateWorkingPeriod: (Int?) -> Unit, - updateStartYear: (Int?) -> Unit, - updateStartMonth: (Int?) -> Unit, + modifier: Modifier = Modifier, + updateGrade: (Int?) -> Unit = {}, + updateWorkingPeriod: (Int?) -> Unit = {}, + updateStartYear: (Int?) -> Unit = {}, + updateStartMonth: (Int?) -> Unit = {}, ) { var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == 0 || currentFilteringInfo.startYear == null) } var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == 0 || currentFilteringInfo.startMonth == null) } @@ -68,7 +69,9 @@ internal fun PlanFilteringScreen( ) } - Column { + Column( + modifier = modifier + ) { ChangeFilteringTitleText( text = stringResource(id = R.string.change_filter_grade_title), modifier = Modifier From b786182c8465f85a68eaf2eb65dc2ccbfd08481b Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 5 Jan 2025 02:15:09 +0900 Subject: [PATCH 25/27] =?UTF-8?q?[FEAT/#313]=20=EC=A0=95=EB=A0=AC=EA=B8=B0?= =?UTF-8?q?=EC=A4=80=20=EB=B2=84=ED=8A=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/button/SortingButton.kt | 42 ++++++------- .../com/terning/feature/home/HomeRoute.kt | 3 +- .../home/component/HomeSortingButton.kt | 62 +++++++++++++++++++ 3 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 feature/home/src/main/java/com/terning/feature/home/component/HomeSortingButton.kt diff --git a/core/designsystem/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt b/core/designsystem/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt index 324962c8..8cf9ac65 100644 --- a/core/designsystem/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt +++ b/core/designsystem/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt @@ -1,5 +1,6 @@ package com.terning.core.designsystem.component.button +import androidx.compose.foundation.Image import androidx.compose.foundation.border import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding @@ -11,11 +12,13 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp import com.terning.core.designsystem.R import com.terning.core.designsystem.extension.noRippleClickable +import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey350 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.SortBy @@ -27,36 +30,31 @@ fun SortingButton( onCLick: () -> Unit, ) { Row( - verticalAlignment = Alignment.CenterVertically, modifier = modifier - .border( - width = 1.dp, - color = Grey350, - shape = RoundedCornerShape(5.dp) - ) .noRippleClickable(onCLick), ) { - Icon( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_down_18), - contentDescription = stringResource(id = R.string.sort_button_description), - tint = Grey350, - modifier = Modifier - .padding( - start = 7.dp, - end = 6.dp, - top = 5.dp, - bottom = 5.dp, - ) - .size(20.dp) - ) Text( text = stringResource( id = SortBy.entries[sortBy].sortBy ), style = TerningTheme.typography.button3, - color = Grey350, + color = Black, + modifier = Modifier + .padding( + top = 6.dp, + bottom = 6.dp, + ) + ) + Image( + painter = painterResource(id = R.drawable.ic_down_18), + contentDescription = stringResource(id = R.string.sort_button_description), modifier = Modifier - .padding(end = 11.dp) + .padding( + start = 2.dp, + end = 2.dp, + top = 6.dp, + bottom = 4.dp, + ) ) } -} +} \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index 190d0466..613e59f1 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -52,6 +52,7 @@ import com.terning.feature.dialog.cancel.ScrapCancelDialog import com.terning.feature.dialog.detail.ScrapDialog import com.terning.feature.home.component.HomeFilteringScreen import com.terning.feature.home.component.HomeRecommendEmptyIntern +import com.terning.feature.home.component.HomeSortingButton import com.terning.feature.home.component.HomeUpcomingEmptyFilter import com.terning.feature.home.component.HomeUpcomingEmptyIntern import com.terning.feature.home.component.HomeUpcomingInternScreen @@ -308,7 +309,7 @@ fun HomeScreen( ) } Spacer(modifier = Modifier.weight(1f)) - SortingButton( + HomeSortingButton( sortBy = homeState.sortBy.ordinal, onCLick = { updateSortingSheetVisibility(true) }, ) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeSortingButton.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeSortingButton.kt new file mode 100644 index 00000000..15415de5 --- /dev/null +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeSortingButton.kt @@ -0,0 +1,62 @@ +package com.terning.feature.home.component + +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.R +import com.terning.core.designsystem.extension.noRippleClickable +import com.terning.core.designsystem.theme.Grey350 +import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.type.SortBy + +@Composable +internal fun HomeSortingButton( + modifier: Modifier = Modifier, + sortBy: Int = 0, + onCLick: () -> Unit, +) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = modifier + .border( + width = 1.dp, + color = Grey350, + shape = RoundedCornerShape(5.dp) + ) + .noRippleClickable(onCLick), + ) { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_down_18), + contentDescription = stringResource(id = R.string.sort_button_description), + tint = Grey350, + modifier = Modifier + .padding( + start = 7.dp, + end = 6.dp, + top = 5.dp, + bottom = 5.dp, + ) + .size(20.dp) + ) + Text( + text = stringResource( + id = SortBy.entries[sortBy].sortBy + ), + style = TerningTheme.typography.button3, + color = Grey350, + modifier = Modifier + .padding(end = 11.dp) + ) + } +} From 853b9f0ed13501440a766d45afccfc5b21d3d6d7 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 5 Jan 2025 02:41:09 +0900 Subject: [PATCH 26/27] =?UTF-8?q?[FEAT/#313]=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=ED=99=9C=EC=84=B1=ED=99=94=20=EA=B8=B0=EC=A4=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/component/bottomsheet/HomeFilteringBottomSheet.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt index c7eef17f..e56e6e70 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -245,8 +245,8 @@ fun TerningTab( private fun checkButtonEnable(currentFilteringInfo: HomeFilteringInfo): Boolean = with(currentFilteringInfo) { - listOf(grade, workingPeriod, startYear, startMonth).all { it == null } || - listOf(grade, workingPeriod, startYear, startMonth).none { it == null } + listOf(grade, workingPeriod, startYear, startMonth).all { it == null || it == 0 } || + listOf(grade, workingPeriod, startYear, startMonth).none { it == null || it == 0 } } @Composable From e69e3e5912227fe129a52ac5b1a2da4033fc6281 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 5 Jan 2025 02:59:10 +0900 Subject: [PATCH 27/27] =?UTF-8?q?[DEL/#313]=20=ED=95=84=ED=84=B0=EB=A7=81?= =?UTF-8?q?=20=EC=97=A0=ED=8B=B0=EB=B7=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/home/HomeRoute.kt | 6 +----- feature/home/src/main/res/values/strings.xml | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index 613e59f1..ee307342 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -32,7 +32,6 @@ import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.terning.core.analytics.EventType import com.terning.core.analytics.LocalTracker import com.terning.core.designsystem.component.bottomsheet.SortingBottomSheet -import com.terning.core.designsystem.component.button.SortingButton import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.component.item.InternItemWithShadow import com.terning.core.designsystem.extension.noRippleClickable @@ -322,13 +321,10 @@ fun HomeScreen( } } - if (recommendedInternList.itemCount == 0) { item { HomeRecommendEmptyIntern( - text = - if (homeState.homeFilteringInfoState is UiState.Success && homeFilteringInfo.grade == null) R.string.home_recommend_no_filtering - else R.string.home_recommend_no_intern + text = R.string.home_recommend_no_intern ) } } else { diff --git a/feature/home/src/main/res/values/strings.xml b/feature/home/src/main/res/values/strings.xml index 3203520f..390dfff0 100644 --- a/feature/home/src/main/res/values/strings.xml +++ b/feature/home/src/main/res/values/strings.xml @@ -13,9 +13,6 @@ %s년 %s월 아직 채용중인 인턴 공고가 없어요!\n새로운 공고가 올라오면 보여드릴게요 인턴 공고가 없어요! - - 지금 공고 필터링을 설정하고\n내 계획에 딱 맞는 대학생 인턴 공고를 추천받아보세요! - 설정된 필터링 정보가 없어요