From 3c3cdd58bb0244897ce4d0d5b36289eb02260f8a Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Thu, 29 Aug 2024 05:21:20 +0900 Subject: [PATCH 01/36] =?UTF-8?q?[UI/#204]=20=ED=99=88=20=EB=B7=B0=20?= =?UTF-8?q?=EA=B3=A7=20=EB=A7=88=EA=B0=90=EB=90=98=EB=8A=94=20=EA=B3=B5?= =?UTF-8?q?=EA=B3=A0=20=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/component/HomeTodayInternItem.kt | 97 ++++++++++++++++--- feature/src/main/res/values/strings.xml | 2 + 2 files changed, 87 insertions(+), 12 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt index f97e42b1d..f387f9414 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt @@ -1,54 +1,127 @@ package com.terning.feature.home.home.component +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import coil.compose.AsyncImage +import coil.request.ImageRequest import com.terning.core.designsystem.component.item.ScrapBox import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey150 +import com.terning.core.designsystem.theme.Grey500 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningSub3 import com.terning.core.designsystem.theme.TerningTheme +import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.feature.R @Composable fun HomeTodayInternItem( - title: String, - scrapColor: Color, + homeTodayIntern: HomeTodayIntern, modifier: Modifier = Modifier ) { ScrapBox( - modifier = modifier - .height(116.dp) - .width(140.dp), + modifier = Modifier + .width(246.dp), cornerRadius = 5.dp, - scrapColor = scrapColor, + scrapColor = Color(android.graphics.Color.parseColor(homeTodayIntern.color)), borderWidth = 1.dp, borderColor = Grey150, content = { Column( modifier = modifier .fillMaxHeight(), - verticalArrangement = Arrangement.Bottom + verticalArrangement = Arrangement.SpaceBetween, ) { Text( - text = title, + text = homeTodayIntern.title, modifier = modifier .padding( - start = 8.dp, - end = 9.dp, - bottom = 8.dp + start = 12.dp, + end = 12.dp, + top = 16.dp ), style = TerningTheme.typography.button3, color = Black, maxLines = 3, + minLines = 3, ) + + Row( + modifier = Modifier + .padding( + start = 12.dp, + end = 12.dp, + bottom = 12.dp, + top = 8.dp + ) + .fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween + ) { + AsyncImage( + model = ImageRequest.Builder(LocalContext.current) + .data(homeTodayIntern.companyImage) + .build(), + contentDescription = stringResource(id = R.string.home_company_image), + contentScale = ContentScale.Crop, + modifier = Modifier + .height(32.dp) + .aspectRatio(1f) + .border(BorderStroke(1.dp, Grey150), CircleShape) + .clip(CircleShape) + ) + + Text( + text = "유한킴벌리", + style = TerningTheme.typography.button5, + color = Grey500, + maxLines = 1, + modifier = Modifier + .padding(start = 6.dp) + .weight(1f) + ) + + Row( + modifier = Modifier + .size(width = 40.dp, height = 20.dp) + .background( + color = TerningSub3, + shape = RoundedCornerShape(size = 5.dp) + ), + horizontalArrangement = Arrangement.Center, + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = homeTodayIntern.dDay, + style = TerningTheme.typography.body4, + color = TerningMain, + ) + } + } } } ) -} \ No newline at end of file +} diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 7d1c5157d..263394dcc 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -80,6 +80,8 @@ - 오늘 마감인 공고가 없어요 + 기업 이미지 + 터치 3번으로\n원하는 대학생 인턴 공고를 띄워드릴게요 시작화면 이미지 From 2ae81c559e128c7318af1946d7460c43ed876897 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 30 Aug 2024 22:04:20 +0900 Subject: [PATCH 02/36] =?UTF-8?q?[UI/#204]=20=ED=99=88=20=EB=B7=B0=20?= =?UTF-8?q?=EA=B3=A7=20=EB=A7=88=EA=B0=90=EB=90=98=EB=8A=94=20=EA=B3=B5?= =?UTF-8?q?=EA=B3=A0=20=EC=95=84=EC=9D=B4=ED=85=9C=20padding=20=EA=B0=92?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/home/component/HomeTodayInternItem.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt index f387f9414..717100a80 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt @@ -100,7 +100,7 @@ fun HomeTodayInternItem( color = Grey500, maxLines = 1, modifier = Modifier - .padding(start = 6.dp) + .padding(start = 6.dp, end = 15.dp) .weight(1f) ) From 879e51f7424285192f619b1395627e67fb84fba0 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 30 Aug 2024 22:18:50 +0900 Subject: [PATCH 03/36] =?UTF-8?q?[UI/#204]=20=ED=99=88=20=EB=B7=B0=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EB=A7=81=20=EB=B2=84=ED=8A=BC=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/HomeFilteringScreen.kt | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index 8011d60cf..b694179ee 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -1,7 +1,6 @@ package com.terning.feature.home.home.component -import androidx.compose.foundation.Image -import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row @@ -10,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable @@ -23,7 +23,6 @@ import com.terning.core.designsystem.theme.Black 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.extension.noRippleClickable import com.terning.feature.R @@ -37,35 +36,36 @@ fun HomeFilteringScreen( ) { Row( modifier = modifier - .padding(top = 10.dp, bottom = 11.dp) - .padding(horizontal = 24.dp) + .padding(horizontal = 24.dp, vertical = 12.dp) .height(IntrinsicSize.Min) .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween ) { Row( - modifier = modifier - .background( + modifier = Modifier + .border( + width = 1.dp, color = TerningMain, - shape = RoundedCornerShape(5.dp), + shape = RoundedCornerShape(5.dp) ) .align(Alignment.CenterVertically) .noRippleClickable { onChangeFilterClick() }, ) { - Image( + Icon( painter = painterResource(id = R.drawable.ic_home_filtering_28), contentDescription = stringResource(id = R.string.home_recommend_filtering), modifier = modifier - .padding(horizontal = 2.dp), + .padding(start = 1.dp), + tint = TerningMain, ) Text( text = stringResource(id = R.string.home_recommend_filtering), - style = TerningTheme.typography.button4, - color = White, + style = TerningTheme.typography.button3, + color = TerningMain, textAlign = TextAlign.Center, - modifier = modifier - .padding(end = 6.dp) - .align(Alignment.CenterVertically) + modifier = Modifier + .padding(start = 5.dp, end = 10.dp) + .align(Alignment.CenterVertically), ) } From 11b44423f090cb40eecba7ce342327c105389f96 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 30 Aug 2024 22:36:43 +0900 Subject: [PATCH 04/36] =?UTF-8?q?[UI/#204]=20=ED=99=88=20=EB=B7=B0=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EB=A7=81=20=EC=A0=95=EB=B3=B4=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/HomeFilteringScreen.kt | 71 ++++++++++--------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index b694179ee..62badd7ec 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -1,26 +1,29 @@ package com.terning.feature.home.home.component +import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.Text -import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.Grey350 +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.extension.noRippleClickable @@ -30,7 +33,7 @@ import com.terning.feature.R fun HomeFilteringScreen( grade: String, period: String, - startYear: String, + startYearMonth: String, onChangeFilterClick: () -> Unit, modifier: Modifier = Modifier, ) { @@ -39,7 +42,8 @@ fun HomeFilteringScreen( .padding(horizontal = 24.dp, vertical = 12.dp) .height(IntrinsicSize.Min) .fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, ) { Row( modifier = Modifier @@ -69,46 +73,49 @@ fun HomeFilteringScreen( ) } - HomeFilteringText( - text = grade, - modifier = Modifier - .padding(vertical = 7.dp) - ) - HomeFilteringDivider() - HomeFilteringText( - text = period, - modifier = Modifier - .padding(vertical = 7.dp) - ) - HomeFilteringDivider() - HomeFilteringText( - text = startYear, - modifier = Modifier - .padding(top = 7.dp, bottom = 7.dp) - ) + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + HomeFilteringInfoText( + text = grade, + modifier = Modifier + .padding(end = 6.dp), + ) + HomeFilteringInfoDivider() + HomeFilteringInfoText( + text = period, + modifier = Modifier + .padding(horizontal = 6.dp), + ) + HomeFilteringInfoDivider() + HomeFilteringInfoText( + text = startYearMonth, + modifier = Modifier + .padding(start = 6.dp), + ) + } } } @Composable -private fun HomeFilteringText( +private fun HomeFilteringInfoText( text: String, modifier: Modifier = Modifier ) { Text( text = text, - style = TerningTheme.typography.detail2, - color = Black, + style = TerningTheme.typography.body5, + color = Grey400, modifier = modifier, ) } @Composable -private fun HomeFilteringDivider() { - VerticalDivider( - color = Grey300, - thickness = 2.dp, +private fun HomeFilteringInfoDivider() { + Box( modifier = Modifier - .fillMaxHeight() - .padding(vertical = 4.dp), + .size(4.dp) + .clip(CircleShape) + .background(Grey350), ) } \ No newline at end of file From 85ccbe45e824c3a995d7b813290a1eb627ef081b Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 00:33:32 +0900 Subject: [PATCH 05/36] =?UTF-8?q?[CHORE/#204]=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EB=B0=8F=20=ED=95=A8=EC=88=98=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=AF=B8=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/terning/feature/home/home/HomeRoute.kt | 6 +++--- .../terning/feature/home/home/component/HomeTodayIntern.kt | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index cc92f3bdf..3056abba5 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -383,7 +383,7 @@ private fun ShowTodayIntern( HomeTodayIntern( internList = homeTodayInternState.data, homeDialogState = homeDialogState, - navigateToIntern = { navigateToIntern(it) }, + navigateToIntern = navigateToIntern ) } } @@ -423,7 +423,7 @@ private fun ShowInternFilter( HomeFilteringScreen( grade = stringResource(id = R.string.home_recommend_no_filtering_hyphen), period = stringResource(id = R.string.home_recommend_no_filtering_hyphen), - startYear = stringResource(id = R.string.home_recommend_no_filtering_hyphen), + startYearMonth = stringResource(id = R.string.home_recommend_no_filtering_hyphen), onChangeFilterClick = onChangeFilterClick, ) } else { @@ -438,7 +438,7 @@ private fun ShowInternFilter( else -> R.string.home_recommend_no_filtering_hyphen } ), - startYear = startYear.toString() + stringResource(id = R.string.home_recommend_filtering_startYear) + startYearMonth = startYear.toString() + stringResource(id = R.string.home_recommend_filtering_startYear) + " " + startMonth.toString() + stringResource(id = R.string.home_recommend_filtering_startMonth), onChangeFilterClick = onChangeFilterClick, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt index d6c93b782..dc88b0019 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt @@ -39,8 +39,7 @@ fun HomeTodayIntern( ) { items(internList.size) { index -> HomeTodayInternItem( - title = internList[index].title, - scrapColor = Color(android.graphics.Color.parseColor(internList[index].color)), + homeTodayIntern = internList[index], modifier = Modifier .noRippleClickable { homeViewModel.updateScrapDialogVisible(true) From b5b99f0886a444987e23e9f7e068d7542dd0002e Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 00:34:51 +0900 Subject: [PATCH 06/36] =?UTF-8?q?[UI/#204]=20divider=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/home/HomeRoute.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 3056abba5..84cc3c609 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -199,11 +199,6 @@ fun HomeScreen( ShowRecommendTitle() ShowInternFilter(homeFilteringInfo = homeFilteringInfo, onChangeFilterClick) - HorizontalDivider( - thickness = 4.dp, - color = Grey150, - ) - Row( modifier = Modifier .fillMaxWidth(), From 61496e06c71f2c0d8f098c3529464b91bf2d6ce8 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 00:53:31 +0900 Subject: [PATCH 07/36] =?UTF-8?q?[UI/#204]=20=EC=A0=95=EB=A0=AC=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=ED=8C=A8?= =?UTF-8?q?=EB=94=A9=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 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt index 27693a251..22eb7c6c5 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt @@ -17,13 +17,13 @@ import com.terning.core.extension.noRippleClickable @Composable fun SortingButton( - sortBy: Int = 0, modifier: Modifier = Modifier, + sortBy: Int = 0, onCLick: () -> Unit, ) { Row( modifier = modifier - .noRippleClickable { onCLick() } + .noRippleClickable { onCLick() }, ) { Text( text = stringResource( @@ -31,19 +31,22 @@ fun SortingButton( ), style = TerningTheme.typography.button3, color = Black, - modifier = modifier + modifier = Modifier .padding( top = 6.dp, - bottom = 5.dp, - start = 12.dp, + bottom = 6.dp, ) ) Image( painter = painterResource(id = R.drawable.ic_down_18), contentDescription = stringResource(id = R.string.sort_button_description), - modifier = modifier - .padding(vertical = 5.dp) - .padding(end = 2.dp) + modifier = Modifier + .padding( + start = 2.dp, + end = 2.dp, + top = 6.dp, + bottom = 4.dp, + ) ) } } From e885a11ac3d4e54242f76023dfb815fc6be771c8 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 00:55:07 +0900 Subject: [PATCH 08/36] =?UTF-8?q?[UI/#204]=20=EA=B3=B5=EA=B3=A0=20?= =?UTF-8?q?=EA=B0=9C=EC=88=98=20=ED=91=9C=EC=8B=9C=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 --- .../terning/feature/home/home/HomeRoute.kt | 47 +++++++++++++------ feature/src/main/res/values/strings.xml | 2 + 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 84cc3c609..97f468170 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -6,12 +6,10 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -50,7 +48,8 @@ import com.terning.core.designsystem.theme.CalPink import com.terning.core.designsystem.theme.CalPurple import com.terning.core.designsystem.theme.CalRed import com.terning.core.designsystem.theme.CalYellow -import com.terning.core.designsystem.theme.Grey150 +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.extension.noRippleClickable @@ -200,19 +199,39 @@ fun HomeScreen( ShowInternFilter(homeFilteringInfo = homeFilteringInfo, onChangeFilterClick) Row( + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, modifier = Modifier - .fillMaxWidth(), - horizontalArrangement = Arrangement.End, + .fillMaxWidth() + .padding(start = 24.dp, end = 18.dp), ) { - SortingButton( - sortBy = currentSortBy.value, - onCLick = { sheetState = true }, - modifier = Modifier - .padding(vertical = 4.dp) - ) - Spacer( - modifier = Modifier.padding(9.dp) - ) + Row { + Text( + text = stringResource(id = R.string.home_recommend_total), + style = TerningTheme.typography.detail1, + color = Grey400, + modifier = Modifier + .padding(end = 3.dp), + ) + Text( + text = "0", + style = TerningTheme.typography.button3, + color = TerningMain, + ) + Text( + text = stringResource(id = R.string.home_recommend_count), + style = TerningTheme.typography.detail1, + color = Grey400, + ) + } + Row { + SortingButton( + sortBy = currentSortBy.value, + onCLick = { sheetState = true }, + modifier = Modifier + .padding(vertical = 4.dp) + ) + } } } } diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 263394dcc..b53885c9d 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -79,6 +79,8 @@ - 오늘 마감인 공고가 없어요 + + 개의 공고가 있어요 기업 이미지 From 6318b9a8fe8d1c6dd7ce3053a1f98c397e76d797 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 04:25:29 +0900 Subject: [PATCH 09/36] =?UTF-8?q?[UI/#204]=20theme=20=EC=83=89=EC=83=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/main/java/com/terning/core/designsystem/theme/Color.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/com/terning/core/designsystem/theme/Color.kt b/core/src/main/java/com/terning/core/designsystem/theme/Color.kt index bea5eb805..161d5816d 100644 --- a/core/src/main/java/com/terning/core/designsystem/theme/Color.kt +++ b/core/src/main/java/com/terning/core/designsystem/theme/Color.kt @@ -4,11 +4,13 @@ import androidx.compose.ui.graphics.Color // Grey Scale val White = Color(0xFFFFFFFF) +val Grey50 = Color(0xFFFCFCFC) val Grey100 = Color(0xFFF5F5F5) val Grey150 = Color(0xFFE9E9E9) val Grey200 = Color(0xFFDDDDDD) val Grey300 = Color(0xFFBCBCBC) val Grey350 = Color(0xFFADADAD) +val Grey375 = Color(0xFF898989) val Grey400 = Color(0xFF666666) val Grey500 = Color(0xFF373737) val Black = Color(0xFF171717) From edc307f19d977076ca8be2efadd91ccd07da4b3c Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 04:29:14 +0900 Subject: [PATCH 10/36] =?UTF-8?q?[UI/#204]=20domain/type=EC=97=90=20enum?= =?UTF-8?q?=20class=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/src/main/java/com/terning/domain/type/Grade.kt | 8 ++++++++ .../main/java/com/terning/domain/type/WorkingPeriod.kt | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 domain/src/main/java/com/terning/domain/type/Grade.kt create mode 100644 domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt diff --git a/domain/src/main/java/com/terning/domain/type/Grade.kt b/domain/src/main/java/com/terning/domain/type/Grade.kt new file mode 100644 index 000000000..bb4bae2f5 --- /dev/null +++ b/domain/src/main/java/com/terning/domain/type/Grade.kt @@ -0,0 +1,8 @@ +package com.terning.domain.type + +enum class Grade(val grade: String) { + FRESHMAN("freshman"), + SOPHOMORE("sophomore"), + JUNIOR("junior"), + SENIOR("senior"), +} \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt b/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt new file mode 100644 index 000000000..d2f8235f1 --- /dev/null +++ b/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt @@ -0,0 +1,7 @@ +package com.terning.domain.type + +enum class WorkingPeriod { + FIRST, + SECOND, + THIRD, +} \ No newline at end of file From f67afb8912962bcb68e3e4c4d8ba9ce327cd98d6 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 04:52:59 +0900 Subject: [PATCH 11/36] =?UTF-8?q?[UI/#204]=20string=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/src/main/res/values/strings.xml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index b53885c9d..0f324c0eb 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -119,8 +119,17 @@ 필터링 재설정 - 재학 상태를 선택해 주세요 + 재학 상태 저장하기 + 1학년 + 2학년 + 3학년 + 4학년 + 희망 근무 기간 + 1개월 ~ 3개월 + 4개월 ~ 6개월 + 7개월 이상 + 근무 시작 시기 공유 아이콘 From 356d98599b86217a14e753aa861110885ed9c0ed Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 04:53:31 +0900 Subject: [PATCH 12/36] =?UTF-8?q?[UI/#204]=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=B0=94=ED=85=80=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt new file mode 100644 index 000000000..a8feddf6c --- /dev/null +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt @@ -0,0 +1,200 @@ +package com.terning.feature.home.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.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.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.component.bottomsheet.TerningBasicBottomSheet +import com.terning.core.designsystem.component.button.ChangeFilterButton +import com.terning.core.designsystem.component.button.RoundButton +import com.terning.core.designsystem.component.datepicker.DatePickerUI +import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey200 +import com.terning.core.designsystem.theme.TerningTheme +import com.terning.domain.type.Grade +import com.terning.domain.type.WorkingPeriod +import com.terning.feature.R +import java.time.LocalDate + +const val MIN_INDEX = 0 +const val MAX_WORKING_INDEX = 2 +const val MAX_GRADE_INDEX = 3 + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun HomeFilteringBottomSheet( + modifier: Modifier = Modifier, + defaultGrade: Grade?, + defaultWorkingPeriod: WorkingPeriod?, + defaultStartYear: Int?, + defaultStartMonth: Int?, + onDismiss: () -> Unit, + onChangeButtonClick: (Int, Int, Int, Int) -> Unit, +) { + val currentYear = LocalDate.now().year + val currentMonth = LocalDate.now().monthValue + + val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) + + var currentGrade by remember { mutableIntStateOf(defaultGrade?.ordinal ?: -1) } + var currentPeriod by remember { mutableIntStateOf(defaultWorkingPeriod?.ordinal ?: -1) } + var currentStartYear by remember { mutableIntStateOf(defaultStartYear ?: currentYear) } + var currentStartMonth by remember { mutableIntStateOf(defaultStartMonth ?: currentMonth) } + + TerningBasicBottomSheet( + content = { + Column( + modifier = modifier + .padding(horizontal = 24.dp) + .fillMaxWidth(), + ) { + Text( + text = stringResource(id = R.string.change_filter_top_bar_title), + style = TerningTheme.typography.title2, + color = Black, + modifier = Modifier + .padding(bottom = 16.dp), + ) + + HorizontalDivider( + thickness = 1.dp, + color = Grey200, + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_grade_title), + modifier = Modifier + .padding(top = 18.dp, bottom = 12.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 = index + } + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_period_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 12.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 = index + } + ) + + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_start_work_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 49.dp) + ) + + DatePickerUI( + chosenYear = defaultStartYear ?: currentYear, + chosenMonth = defaultStartMonth?.minus(1) ?: currentMonth, + onYearChosen = { currentStartYear = it }, + onMonthChosen = { currentStartMonth = it }, + ) + + RoundButton( + style = TerningTheme.typography.button0, + paddingVertical = 19.dp, + text = R.string.change_filter_save, + cornerRadius = 10.dp, + modifier = Modifier + .padding(top = 51.dp), + onButtonClick = { + onChangeButtonClick( + currentGrade, + currentPeriod, + currentStartYear, + currentStartMonth, + ) + }, + isEnabled = currentGrade in MIN_INDEX..MAX_GRADE_INDEX && currentPeriod in MIN_INDEX..MAX_WORKING_INDEX + ) + } + + }, + 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(12.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 b3293643e60b795e8efea559e732757452885e92 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 04:57:28 +0900 Subject: [PATCH 13/36] =?UTF-8?q?[UI/#204]=20=ED=95=84=ED=84=B0=EB=A7=81?= =?UTF-8?q?=20=EC=9E=AC=EC=84=A4=EC=A0=95=20=ED=99=94=EB=A9=B4=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=83=89=EC=83=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/button/ChangeFilterButton.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/ChangeFilterButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/ChangeFilterButton.kt index 3aeadcc0d..dbef1eb85 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/ChangeFilterButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/ChangeFilterButton.kt @@ -21,10 +21,11 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.Grey150 +import com.terning.core.designsystem.theme.Grey200 +import com.terning.core.designsystem.theme.Grey375 +import com.terning.core.designsystem.theme.Grey50 import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningSub1 -import com.terning.core.designsystem.theme.TerningSub5 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White import com.terning.core.util.NoRippleTheme @@ -42,16 +43,16 @@ fun ChangeFilterButton( val isPressed by interactionSource.collectIsPressedAsState() val backgroundColor = when { !isSelected && !isPressed -> White - !isSelected && isPressed -> TerningSub5 - else -> TerningMain + !isSelected && isPressed -> Grey50 + else -> White } val textColor = when { - !isSelected -> Grey400 - else -> White + !isSelected -> Grey375 + else -> TerningMain } val borderColor = when { - !isSelected && !isPressed -> TerningMain - !isSelected && isPressed -> TerningSub1 + !isSelected && !isPressed -> Grey150 + !isSelected && isPressed -> Grey200 else -> TerningMain } From 384fe8ed0d1b5674ea67939d0603b16f4144b58d Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 04:57:50 +0900 Subject: [PATCH 14/36] =?UTF-8?q?[UI/#204]=20=EB=B0=94=ED=85=80=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EA=B4=80=EB=A0=A8=20=EB=A1=9C=EC=A7=81=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 --- .../terning/feature/home/home/HomeRoute.kt | 37 ++++++++++++++++--- .../feature/home/home/HomeViewModel.kt | 4 +- .../home/component/HomeFilteringScreen.kt | 2 +- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 97f468170..020ba5976 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -58,8 +58,11 @@ import com.terning.core.state.UiState import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.domain.type.Grade +import com.terning.domain.type.WorkingPeriod import com.terning.feature.R import com.terning.feature.home.changefilter.navigation.navigateChangeFilter +import com.terning.feature.home.home.component.HomeFilteringBottomSheet import com.terning.feature.home.home.component.HomeFilteringEmptyIntern import com.terning.feature.home.home.component.HomeFilteringScreen import com.terning.feature.home.home.component.HomeRecommendEmptyIntern @@ -141,13 +144,14 @@ fun HomeScreen( } val currentSortBy: MutableState = remember { mutableIntStateOf(0) } - var sheetState by remember { mutableStateOf(false) } + var sortingSheetState by remember { mutableStateOf(false) } + var changeFilteringSheetState by remember { mutableStateOf(false) } var scrapId by remember { mutableIntStateOf(-1) } - if (sheetState) { + if (sortingSheetState) { SortingBottomSheet( onDismiss = { - sheetState = false + sortingSheetState = false viewModel.getRecommendInternsData( currentSortBy.value, homeFilteringInfo.startYear, @@ -159,6 +163,26 @@ fun HomeScreen( ) } + if (changeFilteringSheetState) { + HomeFilteringBottomSheet( + defaultGrade = homeFilteringInfo.grade?.let { Grade.entries[it] }, + defaultWorkingPeriod = homeFilteringInfo.workingPeriod?.let { WorkingPeriod.entries[it] }, + defaultStartYear = homeFilteringInfo.startYear, + defaultStartMonth = homeFilteringInfo.startMonth, + onDismiss = { changeFilteringSheetState = false }, + onChangeButtonClick = { grade, workingPeriod, year, month -> + viewModel.putFilteringInfo(grade, workingPeriod, year, month) + changeFilteringSheetState = false + } + ) + } + + LaunchedEffect(changeFilteringSheetState) { + if (!changeFilteringSheetState) { + viewModel.getFilteringInfo() + } + } + Column( horizontalAlignment = Alignment.Start, ) { @@ -196,7 +220,10 @@ fun HomeScreen( .background(White) ) { ShowRecommendTitle() - ShowInternFilter(homeFilteringInfo = homeFilteringInfo, onChangeFilterClick) + ShowInternFilter( + homeFilteringInfo = homeFilteringInfo, + onChangeFilterClick = { changeFilteringSheetState = true }, + ) Row( horizontalArrangement = Arrangement.SpaceBetween, @@ -227,7 +254,7 @@ fun HomeScreen( Row { SortingButton( sortBy = currentSortBy.value, - onCLick = { sheetState = true }, + onCLick = { sortingSheetState = true }, modifier = Modifier .padding(vertical = 4.dp) ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt index 96c958fe1..4e1c9dbb8 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt @@ -103,10 +103,10 @@ class HomeViewModel @Inject constructor( } } - fun putFilteringInfo(changeFilterRequest: ChangeFilteringRequestModel) { + fun putFilteringInfo(grade: Int, workingPeriod: Int, year: Int, month: Int) { viewModelScope.launch { homeRepository.putFilteringInfo( - changeFilterRequest + ChangeFilteringRequestModel(grade, workingPeriod, year, month) ).onSuccess { _homeSideEffect.emit(HomeSideEffect.NavigateToHome) } diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index 62badd7ec..5eaf061c2 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -53,7 +53,7 @@ fun HomeFilteringScreen( shape = RoundedCornerShape(5.dp) ) .align(Alignment.CenterVertically) - .noRippleClickable { onChangeFilterClick() }, + .noRippleClickable(onChangeFilterClick), ) { Icon( painter = painterResource(id = R.drawable.ic_home_filtering_28), From 28f8b72e04fc11007f2619544464cc55ac4b3c07 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 31 Aug 2024 05:04:41 +0900 Subject: [PATCH 15/36] =?UTF-8?q?[DELETE/#204]=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EB=A7=81=20=EC=9E=AC=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=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 --- .../home/changefilter/ChangeFilterRoute.kt | 213 ------------------ .../component/ChangeFilteringRadioGroup.kt | 52 ----- .../component/FilteringMainTitleText.kt | 21 -- .../component/FilteringSubTitleText.kt | 21 -- .../navigation/ChangeFilterNavigation.kt | 45 ---- .../terning/feature/home/home/HomeRoute.kt | 4 - .../feature/home/home/HomeSideEffect.kt | 1 - .../com/terning/feature/main/MainScreen.kt | 2 - 8 files changed, 359 deletions(-) delete mode 100644 feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt delete mode 100644 feature/src/main/java/com/terning/feature/home/changefilter/component/ChangeFilteringRadioGroup.kt delete mode 100644 feature/src/main/java/com/terning/feature/home/changefilter/component/FilteringMainTitleText.kt delete mode 100644 feature/src/main/java/com/terning/feature/home/changefilter/component/FilteringSubTitleText.kt delete mode 100644 feature/src/main/java/com/terning/feature/home/changefilter/navigation/ChangeFilterNavigation.kt diff --git a/feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt b/feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt deleted file mode 100644 index ec13a8e4e..000000000 --- a/feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt +++ /dev/null @@ -1,213 +0,0 @@ -package com.terning.feature.home.changefilter - -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Scaffold -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.shadow -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel -import androidx.lifecycle.compose.LocalLifecycleOwner -import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.lifecycle.flowWithLifecycle -import androidx.navigation.NavController -import com.terning.core.designsystem.component.button.RectangleButton -import com.terning.core.designsystem.component.datepicker.DatePickerUI -import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar -import com.terning.core.designsystem.theme.TerningTheme -import com.terning.core.extension.toast -import com.terning.core.state.UiState -import com.terning.domain.entity.home.HomeFilteringInfo -import com.terning.domain.entity.request.ChangeFilteringRequestModel -import com.terning.feature.R -import com.terning.feature.home.changefilter.component.ChangeFilteringRadioGroup -import com.terning.feature.home.changefilter.component.FilteringMainTitleText -import com.terning.feature.home.changefilter.component.FilteringSubTitleText -import com.terning.feature.home.changefilter.navigation.navigateChangeFilter -import com.terning.feature.home.home.HomeSideEffect -import com.terning.feature.home.home.HomeViewModel - -const val MIN_INDEX = 0 -const val MAX_WORKING_INDEX = 2 -const val MAX_GRADE_INDEX = 3 - -@Composable -fun ChangeFilterRoute( - navController: NavController, - viewModel: HomeViewModel = hiltViewModel(), -) { - val lifecycleOwner = LocalLifecycleOwner.current - val context = LocalContext.current - - val homeState by viewModel.homeState.collectAsStateWithLifecycle() - - when (homeState.homeFilteringInfoState) { - is UiState.Success -> ChangeFilterScreen( - filterData = (homeState.homeFilteringInfoState as UiState.Success).data, - navigateToHome = { navController.popBackStack() }, - viewModel, - ) - - else -> {} - } - - LaunchedEffect(viewModel.homeSideEffect, lifecycleOwner) { - viewModel.homeSideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) - .collect { sideEffect -> - when (sideEffect) { - is HomeSideEffect.ShowToast -> context.toast(sideEffect.message) - is HomeSideEffect.NavigateToChangeFilter -> navController.navigateChangeFilter() - is HomeSideEffect.NavigateToHome -> navController.navigateUp() - } - } - } -} - -@Composable -fun ChangeFilterScreen( - filterData: HomeFilteringInfo, - navigateToHome: () -> Unit, - viewModel: HomeViewModel, -) { - var currentGrade by remember { mutableIntStateOf(filterData.grade ?: -1) } - var currentWorkingPeriod by remember { mutableIntStateOf(filterData.workingPeriod ?: -1) } - var currentStartYear by remember { - mutableIntStateOf( - filterData.startYear ?: viewModel.currentYear - ) - } - var currentStartMonth by remember { - mutableIntStateOf( - filterData.startMonth ?: viewModel.currentMonth - ) - } - - - Scaffold( - topBar = { - BackButtonTopAppBar( - title = stringResource(id = R.string.change_filter_top_bar_title), - onBackButtonClick = navigateToHome, - modifier = Modifier - .shadow(elevation = 2.dp) - ) - } - ) { paddingValues -> - Column( - modifier = Modifier - .padding( - top = paddingValues.calculateTopPadding(), - ) - ) { - ShowTitle( - mainTitle = stringResource(id = R.string.change_filter_grade_main), - subTitle = stringResource(id = R.string.filtering_status1_sub), - modifier = Modifier.padding( - top = 31.dp, - start = 24.dp, - end = 24.dp - ) - ) - ChangeFilteringRadioGroup( - initOption = filterData.grade ?: -1, - optionList = listOf( - R.string.filtering_status1_button1, - R.string.filtering_status1_button2, - R.string.filtering_status1_button3, - R.string.filtering_status1_button4, - ), - onButtonClick = { index -> - currentGrade = index - } - ) - - ShowTitle( - mainTitle = stringResource(id = R.string.filtering_status2_title), - subTitle = stringResource(id = R.string.filtering_status2_sub), - modifier = Modifier.padding( - top = 39.dp, - start = 24.dp, - end = 24.dp - ) - ) - ChangeFilteringRadioGroup( - initOption = filterData.workingPeriod ?: -1, - optionList = listOf( - R.string.filtering_status2_button1, - R.string.filtering_status2_button2, - R.string.filtering_status2_button3, - ), - onButtonClick = { index -> - currentWorkingPeriod = index - } - ) - - ShowTitle( - mainTitle = stringResource(id = R.string.filtering_status3_title), - subTitle = stringResource(id = R.string.filtering_status3_sub), - modifier = Modifier.padding( - top = 39.dp, - start = 24.dp, - end = 24.dp - ) - ) - - Spacer(modifier = Modifier.weight(1f)) - DatePickerUI( - chosenYear = filterData.startYear ?: currentStartYear, - chosenMonth = filterData.startMonth?.minus(1) ?: currentStartMonth, - onYearChosen = { currentStartYear = it }, - onMonthChosen = { currentStartMonth = it } - ) - Spacer(modifier = Modifier.weight(1f)) - - RectangleButton( - style = TerningTheme.typography.button0, - paddingVertical = 19.dp, - text = R.string.change_filter_save, - onButtonClick = { - viewModel.putFilteringInfo( - ChangeFilteringRequestModel( - grade = currentGrade, - workingPeriod = currentWorkingPeriod, - startYear = currentStartYear, - startMonth = currentStartMonth, - ) - ) - }, - isEnabled = currentGrade in MIN_INDEX..MAX_GRADE_INDEX && currentWorkingPeriod in MIN_INDEX..MAX_WORKING_INDEX - ) - } - } -} - -@Composable -private fun ShowTitle( - mainTitle: String, - subTitle: String, - modifier: Modifier = Modifier, -) { - FilteringMainTitleText( - text = mainTitle, - modifier = modifier.padding() - ) - FilteringSubTitleText( - text = subTitle, - modifier = Modifier - .padding( - top = 3.dp, - bottom = 13.dp, - start = 24.dp, - end = 24.dp - ) - ) -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/changefilter/component/ChangeFilteringRadioGroup.kt b/feature/src/main/java/com/terning/feature/home/changefilter/component/ChangeFilteringRadioGroup.kt deleted file mode 100644 index 97f0c3097..000000000 --- a/feature/src/main/java/com/terning/feature/home/changefilter/component/ChangeFilteringRadioGroup.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.terning.feature.home.changefilter.component - -import androidx.compose.foundation.layout.Arrangement -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.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.Modifier -import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.component.button.ChangeFilterButton - -@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(12.dp), - modifier = modifier - .fillMaxWidth() - .wrapContentHeight() - .padding(horizontal = 24.dp) - - ) { - 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/src/main/java/com/terning/feature/home/changefilter/component/FilteringMainTitleText.kt b/feature/src/main/java/com/terning/feature/home/changefilter/component/FilteringMainTitleText.kt deleted file mode 100644 index 1bc543e55..000000000 --- a/feature/src/main/java/com/terning/feature/home/changefilter/component/FilteringMainTitleText.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.terning.feature.home.changefilter.component - -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.TerningTheme - -@Composable -fun FilteringMainTitleText( - text: String, - modifier: Modifier = Modifier, -) { - Text( - text = text, - style = TerningTheme.typography.title3, - color = Black, - modifier = modifier, - ) -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/changefilter/component/FilteringSubTitleText.kt b/feature/src/main/java/com/terning/feature/home/changefilter/component/FilteringSubTitleText.kt deleted file mode 100644 index 1a26d42f4..000000000 --- a/feature/src/main/java/com/terning/feature/home/changefilter/component/FilteringSubTitleText.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.terning.feature.home.changefilter.component - -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import com.terning.core.designsystem.theme.Grey300 -import com.terning.core.designsystem.theme.TerningTheme - -@Composable -fun FilteringSubTitleText( - text: String, - modifier: Modifier = Modifier, -) { - Text( - text = text, - style = TerningTheme.typography.body5, - color = Grey300, - modifier = modifier, - ) -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/changefilter/navigation/ChangeFilterNavigation.kt b/feature/src/main/java/com/terning/feature/home/changefilter/navigation/ChangeFilterNavigation.kt deleted file mode 100644 index dbc6ce24a..000000000 --- a/feature/src/main/java/com/terning/feature/home/changefilter/navigation/ChangeFilterNavigation.kt +++ /dev/null @@ -1,45 +0,0 @@ -package com.terning.feature.home.changefilter.navigation - -import androidx.compose.animation.EnterTransition -import androidx.compose.animation.ExitTransition -import androidx.navigation.NavController -import androidx.navigation.NavGraphBuilder -import androidx.navigation.NavHostController -import androidx.navigation.NavOptions -import androidx.navigation.compose.composable -import com.terning.core.navigation.Route -import com.terning.feature.home.changefilter.ChangeFilterRoute -import kotlinx.serialization.Serializable - -fun NavController.navigateChangeFilter(navOptions: NavOptions? = null) { - navigate( - route = ChangeFilter, - navOptions = navOptions - ) -} - -fun NavGraphBuilder.changeFilterNavGraph( - navHostController: NavHostController -) { - composable( - exitTransition = { - ExitTransition.None - }, - popEnterTransition = { - EnterTransition.None - }, - enterTransition = { - EnterTransition.None - }, - popExitTransition = { - ExitTransition.None - } - ) { - ChangeFilterRoute( - navController = navHostController - ) - } -} - -@Serializable -data object ChangeFilter : Route \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 020ba5976..9599051b9 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -61,7 +61,6 @@ import com.terning.domain.entity.home.HomeTodayIntern import com.terning.domain.type.Grade import com.terning.domain.type.WorkingPeriod import com.terning.feature.R -import com.terning.feature.home.changefilter.navigation.navigateChangeFilter import com.terning.feature.home.home.component.HomeFilteringBottomSheet import com.terning.feature.home.home.component.HomeFilteringEmptyIntern import com.terning.feature.home.home.component.HomeFilteringScreen @@ -104,7 +103,6 @@ fun HomeRoute( .collect { sideEffect -> when (sideEffect) { is HomeSideEffect.ShowToast -> context.toast(sideEffect.message) - is HomeSideEffect.NavigateToChangeFilter -> navController.navigateChangeFilter() is HomeSideEffect.NavigateToHome -> navController.navigateUp() } } @@ -112,7 +110,6 @@ fun HomeRoute( HomeScreen( homeDialogState = homeDialogState, - onChangeFilterClick = { navController.navigateChangeFilter() }, navigateToIntern = { navController.navigateIntern(announcementId = it) }, viewModel = viewModel, ) @@ -122,7 +119,6 @@ fun HomeRoute( @Composable fun HomeScreen( homeDialogState: HomeDialogState, - onChangeFilterClick: () -> Unit, navigateToIntern: (Long) -> Unit, viewModel: HomeViewModel, ) { diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeSideEffect.kt b/feature/src/main/java/com/terning/feature/home/home/HomeSideEffect.kt index de575f6ff..ec74db512 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeSideEffect.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeSideEffect.kt @@ -4,6 +4,5 @@ import androidx.annotation.StringRes sealed class HomeSideEffect { data class ShowToast(@StringRes val message: Int) : HomeSideEffect() - data object NavigateToChangeFilter : HomeSideEffect() data object NavigateToHome : HomeSideEffect() } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index e5fbb5d02..948ac08ab 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -30,7 +30,6 @@ import com.terning.feature.filtering.filtering.navigation.filteringThreeNavGraph import com.terning.feature.filtering.filtering.navigation.filteringTwoNavGraph import com.terning.feature.filtering.startfiltering.navigation.startFilteringNavGraph import com.terning.feature.filtering.starthome.navigation.startHomeNavGraph -import com.terning.feature.home.changefilter.navigation.changeFilterNavGraph import com.terning.feature.home.home.navigation.homeNavGraph import com.terning.feature.intern.navigation.internNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph @@ -74,7 +73,6 @@ fun MainScreen( filteringTwoNavGraph(navHostController = navigator.navController) filteringThreeNavGraph(navHostController = navigator.navController) searchProcessNavGraph(navHostController = navigator.navController) - changeFilterNavGraph(navHostController = navigator.navController) startFilteringNavGraph(navHostController = navigator.navController) startHomeNavGraph(navHostController = navigator.navController) internNavGraph(navHostController = navigator.navController) From ca9f314ae3ba391b76adb45eb7c8a84ce9ccd62e Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 6 Sep 2024 19:51:50 +0900 Subject: [PATCH 16/36] =?UTF-8?q?[UI/#204]=20=ED=95=84=ED=84=B0=EB=A7=81?= =?UTF-8?q?=20=EC=A0=95=EB=B3=B4=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/domain/type/WorkingPeriod.kt | 8 +-- .../terning/feature/home/home/HomeRoute.kt | 29 ++-------- .../home/component/HomeFilteringScreen.kt | 58 +++++++++++-------- 3 files changed, 42 insertions(+), 53 deletions(-) diff --git a/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt b/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt index d2f8235f1..85cf7fa31 100644 --- a/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt +++ b/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt @@ -1,7 +1,7 @@ package com.terning.domain.type -enum class WorkingPeriod { - FIRST, - SECOND, - THIRD, +enum class WorkingPeriod(val workingPeriod: String) { + FIRST("1 ~ 3개월"), + SECOND("4 ~ 6개월"), + THIRD("7개월 이상"), } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 6b7bb894b..79ecb9c96 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -462,29 +462,8 @@ private fun ShowInternFilter( homeFilteringInfo: HomeFilteringInfo, onChangeFilterClick: () -> Unit, ) { - if (homeFilteringInfo.grade == null) { - HomeFilteringScreen( - grade = stringResource(id = R.string.home_recommend_no_filtering_hyphen), - period = stringResource(id = R.string.home_recommend_no_filtering_hyphen), - startYearMonth = stringResource(id = R.string.home_recommend_no_filtering_hyphen), - onChangeFilterClick = onChangeFilterClick, - ) - } else { - with(homeFilteringInfo) { - HomeFilteringScreen( - grade = (grade?.plus(1)).toString() + stringResource(id = R.string.home_recommend_filtering_grade), - period = stringResource( - id = when (workingPeriod) { - 0 -> R.string.filtering_status2_button1 - 1 -> R.string.filtering_status2_button2 - 2 -> R.string.filtering_status2_button3 - else -> R.string.home_recommend_no_filtering_hyphen - } - ), - startYearMonth = startYear.toString() + stringResource(id = R.string.home_recommend_filtering_startYear) - + " " + startMonth.toString() + stringResource(id = R.string.home_recommend_filtering_startMonth), - onChangeFilterClick = onChangeFilterClick, - ) - } - } + HomeFilteringScreen( + homeFilteringInfo = homeFilteringInfo, + onChangeFilterClick = onChangeFilterClick, + ) } diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index 5eaf061c2..eece80c26 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -27,13 +27,14 @@ 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.extension.noRippleClickable +import com.terning.domain.entity.home.HomeFilteringInfo +import com.terning.domain.type.Grade +import com.terning.domain.type.WorkingPeriod import com.terning.feature.R @Composable fun HomeFilteringScreen( - grade: String, - period: String, - startYearMonth: String, + homeFilteringInfo: HomeFilteringInfo, onChangeFilterClick: () -> Unit, modifier: Modifier = Modifier, ) { @@ -72,27 +73,36 @@ fun HomeFilteringScreen( .align(Alignment.CenterVertically), ) } - - Row( - verticalAlignment = Alignment.CenterVertically, - ) { - HomeFilteringInfoText( - text = grade, - modifier = Modifier - .padding(end = 6.dp), - ) - HomeFilteringInfoDivider() - HomeFilteringInfoText( - text = period, - modifier = Modifier - .padding(horizontal = 6.dp), - ) - HomeFilteringInfoDivider() - HomeFilteringInfoText( - text = startYearMonth, - modifier = Modifier - .padding(start = 6.dp), - ) + with(homeFilteringInfo) { + if (grade != null) { + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + HomeFilteringInfoText( + text = Grade.entries[grade ?: 0].grade, + modifier = Modifier + .padding(end = 6.dp), + ) + HomeFilteringInfoDivider() + HomeFilteringInfoText( + text = WorkingPeriod.entries[workingPeriod ?: 0].workingPeriod, + modifier = Modifier + .padding(horizontal = 6.dp), + ) + HomeFilteringInfoDivider() + HomeFilteringInfoText( + text = "$startYear 년 $startMonth 월", + modifier = Modifier + .padding(start = 6.dp), + ) + } + } else { + Text( + text = "설정된 필터링 정보가 없어요", + modifier = Modifier + .align(Alignment.CenterVertically), + ) + } } } } From f0ae573d57478d08fd10271def0eae3102b6f764 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 6 Sep 2024 20:16:29 +0900 Subject: [PATCH 17/36] =?UTF-8?q?[MOD/#204]=20enum=20class=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=20=EC=9D=B4=EB=8F=99=20=EB=B0=8F=20=ED=8C=8C?= =?UTF-8?q?=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/main/java/com/terning/core/type/Grade.kt | 14 ++++++++++++++ .../java/com/terning/core/type/WorkingPeriod.kt | 13 +++++++++++++ core/src/main/res/values/strings.xml | 14 ++++++++++++++ .../src/main/java/com/terning/domain/type/Grade.kt | 8 -------- .../java/com/terning/domain/type/WorkingPeriod.kt | 7 ------- 5 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 core/src/main/java/com/terning/core/type/Grade.kt create mode 100644 core/src/main/java/com/terning/core/type/WorkingPeriod.kt delete mode 100644 domain/src/main/java/com/terning/domain/type/Grade.kt delete mode 100644 domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt diff --git a/core/src/main/java/com/terning/core/type/Grade.kt b/core/src/main/java/com/terning/core/type/Grade.kt new file mode 100644 index 000000000..bcf4c8a54 --- /dev/null +++ b/core/src/main/java/com/terning/core/type/Grade.kt @@ -0,0 +1,14 @@ +package com.terning.core.type + +import androidx.annotation.StringRes +import com.terning.core.R + +enum class Grade( + val grade: String, + @StringRes val text: Int, +) { + FRESHMAN("freshman", R.string.change_filter_grade_1), + SOPHOMORE("sophomore", R.string.change_filter_grade_2), + JUNIOR("junior", R.string.change_filter_grade_3), + SENIOR("senior", R.string.change_filter_grade_4), +} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/type/WorkingPeriod.kt b/core/src/main/java/com/terning/core/type/WorkingPeriod.kt new file mode 100644 index 000000000..114e21da9 --- /dev/null +++ b/core/src/main/java/com/terning/core/type/WorkingPeriod.kt @@ -0,0 +1,13 @@ +package com.terning.core.type + +import androidx.annotation.StringRes +import com.terning.core.R + +enum class WorkingPeriod( + val workingPeriod: String, + @StringRes val text: Int, +) { + FIRST("1 ~ 3개월", R.string.change_filter_period_1), + SECOND("4 ~ 6개월", R.string.change_filter_period_2), + THIRD("7개월 이상", R.string.change_filter_period_3), +} \ No newline at end of file diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index a8a7b28f4..41ea08e64 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -67,4 +67,18 @@ 사용 가능한 이름이에요 이름은 12자리 이내로 설정해 주세요 + + 필터링 재설정 + 재학 상태 + 저장하기 + 1학년 + 2학년 + 3학년 + 4학년 + 희망 근무 기간 + 1개월 ~ 3개월 + 4개월 ~ 6개월 + 7개월 이상 + 근무 시작 시기 + \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/type/Grade.kt b/domain/src/main/java/com/terning/domain/type/Grade.kt deleted file mode 100644 index bb4bae2f5..000000000 --- a/domain/src/main/java/com/terning/domain/type/Grade.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.terning.domain.type - -enum class Grade(val grade: String) { - FRESHMAN("freshman"), - SOPHOMORE("sophomore"), - JUNIOR("junior"), - SENIOR("senior"), -} \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt b/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt deleted file mode 100644 index 85cf7fa31..000000000 --- a/domain/src/main/java/com/terning/domain/type/WorkingPeriod.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.terning.domain.type - -enum class WorkingPeriod(val workingPeriod: String) { - FIRST("1 ~ 3개월"), - SECOND("4 ~ 6개월"), - THIRD("7개월 이상"), -} \ No newline at end of file From 5327a86237d330b7f436e6f2957b50c1ef1a34f7 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 6 Sep 2024 20:17:06 +0900 Subject: [PATCH 18/36] =?UTF-8?q?[MOD/#204]=20=EA=B3=A7=20=EB=A7=88?= =?UTF-8?q?=EA=B0=90=EB=90=98=EB=8A=94=20=EA=B3=B5=EA=B3=A0=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=ED=86=B5=EC=8B=A0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/data/datasource/HomeDataSource.kt | 4 +-- .../data/datasourceimpl/HomeDataSourceImpl.kt | 6 ++-- ...to.kt => HomeUpcomingInternResponseDto.kt} | 7 ++--- ...nMapper.kt => HomeUpcomingInternMapper.kt} | 10 +++---- .../data/repositoryimpl/HomeRepositoryImpl.kt | 10 +++---- .../com/terning/data/service/HomeService.kt | 6 ++-- ...meTodayIntern.kt => HomeUpcomingIntern.kt} | 4 +-- .../domain/repository/HomeRepository.kt | 4 +-- .../terning/feature/home/home/HomeRoute.kt | 16 +++++------ .../terning/feature/home/home/HomeState.kt | 4 +-- .../feature/home/home/HomeViewModel.kt | 16 +++++------ .../component/HomeFilteringBottomSheet.kt | 4 +-- .../home/component/HomeFilteringScreen.kt | 8 +++--- .../home/home/component/HomeTodayIntern.kt | 8 +++--- .../home/component/HomeTodayInternDialog.kt | 28 +++++++++---------- .../home/component/HomeTodayInternItem.kt | 12 ++++---- 16 files changed, 73 insertions(+), 74 deletions(-) rename data/src/main/java/com/terning/data/dto/response/{HomeTodayInternResponseDto.kt => HomeUpcomingInternResponseDto.kt} (85%) rename data/src/main/java/com/terning/data/mapper/home/{HomeTodayInternMapper.kt => HomeUpcomingInternMapper.kt} (57%) rename domain/src/main/java/com/terning/domain/entity/home/{HomeTodayIntern.kt => HomeUpcomingIntern.kt} (81%) diff --git a/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt b/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt index 97b10b6d3..8fc4cee55 100644 --- a/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt +++ b/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt @@ -5,10 +5,10 @@ import com.terning.data.dto.NonDataBaseResponse import com.terning.data.dto.request.ChangeFilterRequestDto import com.terning.data.dto.response.HomeFilteringInfoResponseDto import com.terning.data.dto.response.HomeRecommendInternResponseDto -import com.terning.data.dto.response.HomeTodayInternResponseDto +import com.terning.data.dto.response.HomeUpcomingInternResponseDto interface HomeDataSource { - suspend fun getTodayIntern(): BaseResponse> + suspend fun getUpcomingIntern(): BaseResponse> suspend fun getRecommendIntern( sortBy: String, diff --git a/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt index 9c5416942..08089e610 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt @@ -6,15 +6,15 @@ import com.terning.data.dto.NonDataBaseResponse import com.terning.data.dto.request.ChangeFilterRequestDto import com.terning.data.dto.response.HomeFilteringInfoResponseDto import com.terning.data.dto.response.HomeRecommendInternResponseDto -import com.terning.data.dto.response.HomeTodayInternResponseDto +import com.terning.data.dto.response.HomeUpcomingInternResponseDto import com.terning.data.service.HomeService import javax.inject.Inject class HomeDataSourceImpl @Inject constructor( private val homeService: HomeService, ) : HomeDataSource { - override suspend fun getTodayIntern(): BaseResponse> = - homeService.getHomeTodayIntern() + override suspend fun getUpcomingIntern(): BaseResponse> = + homeService.getHomeUpcomingIntern() override suspend fun getRecommendIntern( sortBy: String, diff --git a/data/src/main/java/com/terning/data/dto/response/HomeTodayInternResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/HomeUpcomingInternResponseDto.kt similarity index 85% rename from data/src/main/java/com/terning/data/dto/response/HomeTodayInternResponseDto.kt rename to data/src/main/java/com/terning/data/dto/response/HomeUpcomingInternResponseDto.kt index 33283ae00..25ed289d1 100644 --- a/data/src/main/java/com/terning/data/dto/response/HomeTodayInternResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/HomeUpcomingInternResponseDto.kt @@ -4,9 +4,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class HomeTodayInternResponseDto( - @SerialName("scrapId") - val scrapId: Long, +data class HomeUpcomingInternResponseDto( @SerialName("internshipAnnouncementId") val internshipAnnouncementId: Long, @SerialName("companyImage") @@ -19,9 +17,10 @@ data class HomeTodayInternResponseDto( val deadline: String, @SerialName("workingPeriod") val workingPeriod: String, + @SerialName("isScrapped") + val isScrapped: Boolean, @SerialName("color") val color: String, @SerialName("startYearMonth") val startYearMonth: String, - ) \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/mapper/home/HomeTodayInternMapper.kt b/data/src/main/java/com/terning/data/mapper/home/HomeUpcomingInternMapper.kt similarity index 57% rename from data/src/main/java/com/terning/data/mapper/home/HomeTodayInternMapper.kt rename to data/src/main/java/com/terning/data/mapper/home/HomeUpcomingInternMapper.kt index 762354301..3521339f9 100644 --- a/data/src/main/java/com/terning/data/mapper/home/HomeTodayInternMapper.kt +++ b/data/src/main/java/com/terning/data/mapper/home/HomeUpcomingInternMapper.kt @@ -1,17 +1,17 @@ package com.terning.data.mapper.home -import com.terning.data.dto.response.HomeTodayInternResponseDto -import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.data.dto.response.HomeUpcomingInternResponseDto +import com.terning.domain.entity.home.HomeUpcomingIntern -fun HomeTodayInternResponseDto.toHomeTodayInternList(): HomeTodayIntern = - HomeTodayIntern( - scrapId = this.scrapId, +fun HomeUpcomingInternResponseDto.toHomeUpcomingInternList(): HomeUpcomingIntern = + HomeUpcomingIntern( internshipAnnouncementId = this.internshipAnnouncementId, companyImage = this.companyImage, title = this.title, dDay = this.dDay, deadline = this.deadline, workingPeriod = this.workingPeriod, + isScrapped = this.isScrapped, startYearMonth = this.startYearMonth, color = this.color, ) \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt index 25dc6cc11..8e345b12e 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt @@ -4,10 +4,10 @@ import com.terning.data.datasource.HomeDataSource import com.terning.data.dto.request.toChangeFilterRequestDto import com.terning.data.mapper.home.toHomeFilteringInfo import com.terning.data.mapper.home.toHomeRecommendInternList -import com.terning.data.mapper.home.toHomeTodayInternList +import com.terning.data.mapper.home.toHomeUpcomingInternList import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern -import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.domain.entity.request.ChangeFilteringRequestModel import com.terning.domain.repository.HomeRepository import javax.inject.Inject @@ -15,10 +15,10 @@ import javax.inject.Inject class HomeRepositoryImpl @Inject constructor( private val homeDataSource: HomeDataSource, ) : HomeRepository { - override suspend fun getHomeTodayInternList(): Result> = + override suspend fun getHomeUpcomingInternList(): Result> = runCatching { - homeDataSource.getTodayIntern().result.map { homeTodayInternResponseDto -> - homeTodayInternResponseDto.toHomeTodayInternList() + homeDataSource.getUpcomingIntern().result.map { homeTodayInternResponseDto -> + homeTodayInternResponseDto.toHomeUpcomingInternList() } } diff --git a/data/src/main/java/com/terning/data/service/HomeService.kt b/data/src/main/java/com/terning/data/service/HomeService.kt index 16265cd36..e57d1f617 100644 --- a/data/src/main/java/com/terning/data/service/HomeService.kt +++ b/data/src/main/java/com/terning/data/service/HomeService.kt @@ -5,15 +5,15 @@ import com.terning.data.dto.NonDataBaseResponse import com.terning.data.dto.request.ChangeFilterRequestDto import com.terning.data.dto.response.HomeFilteringInfoResponseDto import com.terning.data.dto.response.HomeRecommendInternResponseDto -import com.terning.data.dto.response.HomeTodayInternResponseDto +import com.terning.data.dto.response.HomeUpcomingInternResponseDto import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.PUT import retrofit2.http.Query interface HomeService { - @GET("api/v1/home/today") - suspend fun getHomeTodayIntern(): BaseResponse> + @GET("api/v1/home/upcoming") + suspend fun getHomeUpcomingIntern(): BaseResponse> @GET("api/v1/home") suspend fun getRecommendIntern( diff --git a/domain/src/main/java/com/terning/domain/entity/home/HomeTodayIntern.kt b/domain/src/main/java/com/terning/domain/entity/home/HomeUpcomingIntern.kt similarity index 81% rename from domain/src/main/java/com/terning/domain/entity/home/HomeTodayIntern.kt rename to domain/src/main/java/com/terning/domain/entity/home/HomeUpcomingIntern.kt index 742773035..806849c34 100644 --- a/domain/src/main/java/com/terning/domain/entity/home/HomeTodayIntern.kt +++ b/domain/src/main/java/com/terning/domain/entity/home/HomeUpcomingIntern.kt @@ -1,13 +1,13 @@ package com.terning.domain.entity.home -data class HomeTodayIntern( - val scrapId: Long, +data class HomeUpcomingIntern( val internshipAnnouncementId: Long, val companyImage: String, val title: String, val dDay: String, val deadline: String, val workingPeriod: String, + val isScrapped: Boolean, val color: String, val startYearMonth: String, ) diff --git a/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt b/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt index c21daa27a..c9923f8f2 100644 --- a/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt +++ b/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt @@ -2,11 +2,11 @@ package com.terning.domain.repository import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern -import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.domain.entity.request.ChangeFilteringRequestModel interface HomeRepository { - suspend fun getHomeTodayInternList(): Result> + suspend fun getHomeUpcomingInternList(): Result> suspend fun getRecommendIntern( sortBy: String, diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 79ecb9c96..433bd87a2 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -57,9 +57,9 @@ import com.terning.core.extension.toast import com.terning.core.state.UiState import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern -import com.terning.domain.entity.home.HomeTodayIntern -import com.terning.domain.type.Grade -import com.terning.domain.type.WorkingPeriod +import com.terning.domain.entity.home.HomeUpcomingIntern +import com.terning.core.type.Grade +import com.terning.core.type.WorkingPeriod import com.terning.feature.R import com.terning.feature.home.home.component.HomeFilteringBottomSheet import com.terning.feature.home.home.component.HomeFilteringEmptyIntern @@ -210,7 +210,7 @@ fun HomeScreen( ) { ShowMainTitleWithName(homeUserName) ShowTodayIntern( - homeTodayInternState = homeState.homeTodayInternState, + homeUpcomingInternState = homeState.homeUpcomingInternState, homeDialogState = homeDialogState, navigateToIntern = { navigateToIntern(it) } ) @@ -414,17 +414,17 @@ private fun ShowMainTitleWithName(userName: String) { @Composable private fun ShowTodayIntern( - homeTodayInternState: UiState>, + homeUpcomingInternState: UiState>, homeDialogState: HomeDialogState, navigateToIntern: (Long) -> Unit, ) { - when (homeTodayInternState) { + when (homeUpcomingInternState) { is UiState.Success -> { - if (homeTodayInternState.data.isEmpty()) { + if (homeUpcomingInternState.data.isEmpty()) { HomeTodayEmptyWithImg() } else { HomeTodayIntern( - internList = homeTodayInternState.data, + internList = homeUpcomingInternState.data, homeDialogState = homeDialogState, navigateToIntern = navigateToIntern ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt b/feature/src/main/java/com/terning/feature/home/home/HomeState.kt index fdee536c3..c1f3b6434 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeState.kt @@ -3,13 +3,13 @@ package com.terning.feature.home.home import com.terning.core.state.UiState import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern -import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.home.home.model.SortBy data class HomeState( val sortBy: SortBy = SortBy.EARLIEST, val homeUserNameState: UiState = UiState.Loading, val homeFilteringInfoState: UiState = UiState.Loading, - val homeTodayInternState: UiState> = UiState.Loading, + val homeUpcomingInternState: UiState> = UiState.Loading, val homeRecommendInternState: UiState> = UiState.Loading, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt index 4e1c9dbb8..07f5b7a77 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt @@ -69,13 +69,13 @@ class HomeViewModel @Inject constructor( private fun getHomeTodayInternList() { viewModelScope.launch { - homeRepository.getHomeTodayInternList().onSuccess { internList -> + homeRepository.getHomeUpcomingInternList().onSuccess { internList -> _homeState.value = _homeState.value.copy( - homeTodayInternState = UiState.Success(internList) + homeUpcomingInternState = UiState.Success(internList) ) }.onFailure { exception: Throwable -> _homeState.value = _homeState.value.copy( - homeTodayInternState = UiState.Failure(exception.toString()) + homeUpcomingInternState = UiState.Failure(exception.toString()) ) _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.server_failure)) } @@ -89,11 +89,11 @@ class HomeViewModel @Inject constructor( homeFilteringInfoState = UiState.Success(filteringInfo) ) getHomeTodayInternList() - getRecommendInternsData( - sortBy = _homeState.value.sortBy.ordinal, - startYear = filteringInfo.startYear, - startMonth = filteringInfo.startMonth, - ) +// getRecommendInternsData( +// sortBy = _homeState.value.sortBy.ordinal, +// startYear = filteringInfo.startYear, +// startMonth = filteringInfo.startMonth, +// ) }.onFailure { exception: Throwable -> _homeState.value = _homeState.value.copy( homeFilteringInfoState = UiState.Failure(exception.toString()) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt index a8feddf6c..8c99d729e 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt @@ -27,8 +27,8 @@ import com.terning.core.designsystem.component.datepicker.DatePickerUI import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme -import com.terning.domain.type.Grade -import com.terning.domain.type.WorkingPeriod +import com.terning.core.type.Grade +import com.terning.core.type.WorkingPeriod import com.terning.feature.R import java.time.LocalDate diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index eece80c26..4e69e4d6d 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -27,9 +27,9 @@ 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.extension.noRippleClickable +import com.terning.core.type.Grade +import com.terning.core.type.WorkingPeriod import com.terning.domain.entity.home.HomeFilteringInfo -import com.terning.domain.type.Grade -import com.terning.domain.type.WorkingPeriod import com.terning.feature.R @Composable @@ -79,13 +79,13 @@ fun HomeFilteringScreen( verticalAlignment = Alignment.CenterVertically, ) { HomeFilteringInfoText( - text = Grade.entries[grade ?: 0].grade, + text = stringResource(id = Grade.entries[grade ?: 0].text), modifier = Modifier .padding(end = 6.dp), ) HomeFilteringInfoDivider() HomeFilteringInfoText( - text = WorkingPeriod.entries[workingPeriod ?: 0].workingPeriod, + text = stringResource(WorkingPeriod.entries[workingPeriod ?: 0].text), modifier = Modifier .padding(horizontal = 6.dp), ) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt index dc88b0019..eaf3fe9e3 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt @@ -16,14 +16,14 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.extension.noRippleClickable -import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.R import com.terning.feature.home.home.HomeViewModel import com.terning.feature.home.home.model.HomeDialogState @Composable fun HomeTodayIntern( - internList: List, + internList: List, homeDialogState: HomeDialogState, navigateToIntern: (Long) -> Unit, homeViewModel: HomeViewModel = hiltViewModel() @@ -39,7 +39,7 @@ fun HomeTodayIntern( ) { items(internList.size) { index -> HomeTodayInternItem( - homeTodayIntern = internList[index], + homeUpcomingIntern = internList[index], modifier = Modifier .noRippleClickable { homeViewModel.updateScrapDialogVisible(true) @@ -75,7 +75,7 @@ fun HomeTodayIntern( navigateToIntern(internshipAnnouncementId) homeViewModel.updateScrapDialogVisible(false) }, - homeTodayIntern = internList[selectedIndex], + homeUpcomingIntern = internList[selectedIndex], ) } }, diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt index cb6808de1..f7e72af2e 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt @@ -53,7 +53,7 @@ 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.extension.noRippleClickable -import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.home.home.HomeViewModel import com.terning.feature.intern.component.InternInfoRow @@ -62,7 +62,7 @@ import com.terning.feature.intern.component.InternInfoRow fun HomeTodayInternDialog( internInfoList: List>, navigateTo: () -> Unit, - homeTodayIntern: HomeTodayIntern, + homeUpcomingIntern: HomeUpcomingIntern, viewModel: HomeViewModel = hiltViewModel(), ) { val state by viewModel.homeDialogState.collectAsStateWithLifecycle() @@ -87,7 +87,7 @@ fun HomeTodayInternDialog( ) { AsyncImage( model = ImageRequest.Builder(LocalContext.current) - .data(homeTodayIntern.companyImage) + .data(homeUpcomingIntern.companyImage) .build(), contentDescription = stringResource(R.string.image_content_descriptin), modifier = Modifier @@ -103,7 +103,7 @@ fun HomeTodayInternDialog( ) Text( - text = homeTodayIntern.title, + text = homeUpcomingIntern.title, textAlign = TextAlign.Center, style = TerningTheme.typography.title4, color = Grey500, @@ -184,7 +184,7 @@ fun HomeTodayInternDialog( contentAlignment = Alignment.Center ) { ColorPalette( - initialColor = Color(android.graphics.Color.parseColor(homeTodayIntern.color)), + initialColor = Color(android.graphics.Color.parseColor(homeUpcomingIntern.color)), onColorSelected = { newColor -> viewModel.updateSelectColor(newColor) } @@ -192,7 +192,7 @@ fun HomeTodayInternDialog( } } else { Text( - text = homeTodayIntern.dDay, + text = homeUpcomingIntern.dDay, style = TerningTheme.typography.body5, color = TerningMain, modifier = Modifier.padding(bottom = 9.dp) @@ -226,17 +226,17 @@ fun HomeTodayInternDialog( if (state.isPaletteOpen) { viewModel.updatePaletteOpen(false) viewModel.updateColorChange(false) - viewModel.patchScrap( - scrapId = homeTodayIntern.scrapId, - colorIndex = selectedColorIndex, - ) +// viewModel.patchScrap( +// scrapId = homeUpcomingIntern.scrapId, +// colorIndex = selectedColorIndex, +// ) } else { if (state.isColorChange) { viewModel.updateColorChange(false) - viewModel.patchScrap( - scrapId = homeTodayIntern.scrapId, - colorIndex = selectedColorIndex, - ) +// viewModel.patchScrap( +// scrapId = homeUpcomingIntern.scrapId, +// colorIndex = selectedColorIndex, +// ) } viewModel.updateScrapDialogVisible(false) navigateTo() diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt index 717100a80..8da593c0a 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt @@ -34,19 +34,19 @@ import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningSub3 import com.terning.core.designsystem.theme.TerningTheme -import com.terning.domain.entity.home.HomeTodayIntern +import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.R @Composable fun HomeTodayInternItem( - homeTodayIntern: HomeTodayIntern, + homeUpcomingIntern: HomeUpcomingIntern, modifier: Modifier = Modifier ) { ScrapBox( modifier = Modifier .width(246.dp), cornerRadius = 5.dp, - scrapColor = Color(android.graphics.Color.parseColor(homeTodayIntern.color)), + scrapColor = Color(android.graphics.Color.parseColor(homeUpcomingIntern.color)), borderWidth = 1.dp, borderColor = Grey150, content = { @@ -56,7 +56,7 @@ fun HomeTodayInternItem( verticalArrangement = Arrangement.SpaceBetween, ) { Text( - text = homeTodayIntern.title, + text = homeUpcomingIntern.title, modifier = modifier .padding( start = 12.dp, @@ -83,7 +83,7 @@ fun HomeTodayInternItem( ) { AsyncImage( model = ImageRequest.Builder(LocalContext.current) - .data(homeTodayIntern.companyImage) + .data(homeUpcomingIntern.companyImage) .build(), contentDescription = stringResource(id = R.string.home_company_image), contentScale = ContentScale.Crop, @@ -115,7 +115,7 @@ fun HomeTodayInternItem( verticalAlignment = Alignment.CenterVertically ) { Text( - text = homeTodayIntern.dDay, + text = homeUpcomingIntern.dDay, style = TerningTheme.typography.body4, color = TerningMain, ) From 8a58059f2dd24efd2ba963277131adb81adf7608 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 7 Sep 2024 13:56:29 +0900 Subject: [PATCH 19/36] =?UTF-8?q?[CHORE/#204]=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/bottomsheet}/HomeFilteringBottomSheet.kt | 5 ++--- .../designsystem/component/bottomsheet/SortingBottomSheet.kt | 1 + .../core/designsystem/component/button/SortingButton.kt | 2 +- .../{designsystem/component/bottomsheet => type}/SortBy.kt | 2 +- .../src/main/java/com/terning/feature/home/home/HomeRoute.kt | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename {feature/src/main/java/com/terning/feature/home/home/component => core/src/main/java/com/terning/core/designsystem/component/bottomsheet}/HomeFilteringBottomSheet.kt (97%) rename core/src/main/java/com/terning/core/{designsystem/component/bottomsheet => type}/SortBy.kt (83%) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt rename to core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt index 8c99d729e..a2f05f156 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home.component +package com.terning.core.designsystem.component.bottomsheet import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -20,7 +20,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.component.bottomsheet.TerningBasicBottomSheet +import com.terning.core.R import com.terning.core.designsystem.component.button.ChangeFilterButton import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.component.datepicker.DatePickerUI @@ -29,7 +29,6 @@ import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.type.Grade import com.terning.core.type.WorkingPeriod -import com.terning.feature.R import java.time.LocalDate const val MIN_INDEX = 0 diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt index 49ae29b21..e228c2d73 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt @@ -26,6 +26,7 @@ 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.extension.noRippleClickable +import com.terning.core.type.SortBy import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt index 22eb7c6c5..f0ef1c846 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt @@ -10,7 +10,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.terning.core.R -import com.terning.core.designsystem.component.bottomsheet.SortBy +import com.terning.core.type.SortBy import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortBy.kt b/core/src/main/java/com/terning/core/type/SortBy.kt similarity index 83% rename from core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortBy.kt rename to core/src/main/java/com/terning/core/type/SortBy.kt index 3d6ce0916..0c47861c3 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortBy.kt +++ b/core/src/main/java/com/terning/core/type/SortBy.kt @@ -1,4 +1,4 @@ -package com.terning.core.designsystem.component.bottomsheet +package com.terning.core.type import androidx.annotation.StringRes import com.terning.core.R diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 433bd87a2..acb88117f 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -61,7 +61,7 @@ import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.core.type.Grade import com.terning.core.type.WorkingPeriod import com.terning.feature.R -import com.terning.feature.home.home.component.HomeFilteringBottomSheet +import com.terning.core.designsystem.component.bottomsheet.HomeFilteringBottomSheet import com.terning.feature.home.home.component.HomeFilteringEmptyIntern import com.terning.feature.home.home.component.HomeFilteringScreen import com.terning.feature.home.home.component.HomeRecommendEmptyIntern From 33d3dd3bce4a6e997750c50b2da05bff1fba3a14 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sat, 7 Sep 2024 14:58:10 +0900 Subject: [PATCH 20/36] =?UTF-8?q?[REFACTOR/#204]=20=EB=A7=9E=EC=B6=A4=20?= =?UTF-8?q?=EA=B3=B5=EA=B3=A0=20API=20=EC=88=98=EC=A0=95=EC=82=AC=ED=95=AD?= =?UTF-8?q?=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/SortingBottomSheet.kt | 2 +- .../component/button/SortingButton.kt | 2 +- .../main/java/com/terning/core/type/SortBy.kt | 17 +- .../terning/data/datasource/HomeDataSource.kt | 2 +- .../data/datasourceimpl/HomeDataSourceImpl.kt | 2 +- .../HomeRecommendInternResponseDto.kt | 46 +++-- .../mapper/home/HomeRecommendInternMapper.kt | 12 +- .../data/repositoryimpl/HomeRepositoryImpl.kt | 6 +- .../com/terning/data/service/HomeService.kt | 2 +- .../domain/entity/home/HomeRecommendIntern.kt | 25 ++- .../domain/repository/HomeRepository.kt | 2 +- .../terning/feature/home/home/HomeRoute.kt | 190 +++++++++--------- .../terning/feature/home/home/HomeState.kt | 4 +- .../feature/home/home/HomeViewModel.kt | 58 +++--- .../terning/feature/home/home/model/SortBy.kt | 9 - 15 files changed, 190 insertions(+), 189 deletions(-) delete mode 100644 feature/src/main/java/com/terning/feature/home/home/model/SortBy.kt diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt index e228c2d73..806fefee3 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt @@ -65,7 +65,7 @@ fun SortingBottomSheet( ) { items(sortByCount) { sortIndex -> Text( - text = stringResource(id = SortBy.entries[sortIndex].type), + text = stringResource(id = SortBy.entries[sortIndex].sortBy), style = TerningTheme.typography.button3, color = if (currentSortBy == sortIndex) TerningMain else Grey400, textAlign = TextAlign.Start, diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt index f0ef1c846..ba860afe8 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt @@ -27,7 +27,7 @@ fun SortingButton( ) { Text( text = stringResource( - id = SortBy.entries[sortBy].type + id = SortBy.entries[sortBy].sortBy ), style = TerningTheme.typography.button3, color = Black, diff --git a/core/src/main/java/com/terning/core/type/SortBy.kt b/core/src/main/java/com/terning/core/type/SortBy.kt index 0c47861c3..d0a8411ec 100644 --- a/core/src/main/java/com/terning/core/type/SortBy.kt +++ b/core/src/main/java/com/terning/core/type/SortBy.kt @@ -3,10 +3,13 @@ package com.terning.core.type import androidx.annotation.StringRes import com.terning.core.R -enum class SortBy(@StringRes val type: Int) { - EARLIEST(R.string.sort_by_earliest), - SHORTEST(R.string.sort_by_shortest), - LONGEST(R.string.sort_by_longest), - SCRAP(R.string.sort_by_scrap), - VIEW_COUNT(R.string.sort_by_view_count), -} \ No newline at end of file +enum class SortBy( + @StringRes val sortBy: Int, + val type: String, +) { + EARLIEST(R.string.sort_by_earliest, "deadlineSoon"), + SHORTEST(R.string.sort_by_shortest, "shortestDuration"), + LONGEST(R.string.sort_by_longest, "longestDuration"), + SCRAP(R.string.sort_by_scrap, "mostScrapped"), + VIEW_COUNT(R.string.sort_by_view_count, "mostViewed"), +} diff --git a/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt b/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt index 8fc4cee55..61c101e42 100644 --- a/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt +++ b/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt @@ -14,7 +14,7 @@ interface HomeDataSource { sortBy: String, startYear: Int, startMonth: Int - ): BaseResponse> + ): BaseResponse suspend fun getFilteringInfo(): BaseResponse diff --git a/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt index 08089e610..7e7a0bc12 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt @@ -20,7 +20,7 @@ class HomeDataSourceImpl @Inject constructor( sortBy: String, startYear: Int, startMonth: Int - ): BaseResponse> = + ): BaseResponse = homeService.getRecommendIntern( sortBy = sortBy, startYear = startYear, diff --git a/data/src/main/java/com/terning/data/dto/response/HomeRecommendInternResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/HomeRecommendInternResponseDto.kt index c8f8e8671..6e28c8be2 100644 --- a/data/src/main/java/com/terning/data/dto/response/HomeRecommendInternResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/HomeRecommendInternResponseDto.kt @@ -5,22 +5,30 @@ import kotlinx.serialization.Serializable @Serializable data class HomeRecommendInternResponseDto( - @SerialName("scrapId") - val scrapId: Long?, - @SerialName("intershipAnnouncementId") - val internshipAnnouncementId: Long, - @SerialName("title") - val title: String, - @SerialName("dDay") - val dDay: String, - @SerialName("deadline") - val deadline: String, - @SerialName("workingPeriod") - val workingPeriod: String, - @SerialName("startYearMonth") - val startYearMonth: String, - @SerialName("companyImage") - val companyImage: String, - @SerialName("isScrapped") - val isScrapped: Boolean, -) + @SerialName("totalCount") + val totalCount: Int, + @SerialName("result") + val result: List +) { + @Serializable + data class Result( + @SerialName("intershipAnnouncementId") + val internshipAnnouncementId: Long, + @SerialName("title") + val title: String, + @SerialName("dDay") + val dDay: String, + @SerialName("deadline") + val deadline: String, + @SerialName("workingPeriod") + val workingPeriod: String, + @SerialName("startYearMonth") + val startYearMonth: String, + @SerialName("companyImage") + val companyImage: String, + @SerialName("isScrapped") + val isScrapped: Boolean, + @SerialName("color") + val color: String?, + ) +} diff --git a/data/src/main/java/com/terning/data/mapper/home/HomeRecommendInternMapper.kt b/data/src/main/java/com/terning/data/mapper/home/HomeRecommendInternMapper.kt index 6e505189c..96a45724d 100644 --- a/data/src/main/java/com/terning/data/mapper/home/HomeRecommendInternMapper.kt +++ b/data/src/main/java/com/terning/data/mapper/home/HomeRecommendInternMapper.kt @@ -5,7 +5,14 @@ import com.terning.domain.entity.home.HomeRecommendIntern fun HomeRecommendInternResponseDto.toHomeRecommendInternList(): HomeRecommendIntern = HomeRecommendIntern( - scrapId = this.scrapId, + totalCount = this.totalCount, + homeRecommendInternDetail = this.result.map { + it.toHomeRecommendInternDetail() + } + ) + +fun HomeRecommendInternResponseDto.Result.toHomeRecommendInternDetail(): HomeRecommendIntern.HomeRecommendInternDetail = + HomeRecommendIntern.HomeRecommendInternDetail( internshipAnnouncementId = this.internshipAnnouncementId, title = this.title, dDay = this.dDay, @@ -14,4 +21,5 @@ fun HomeRecommendInternResponseDto.toHomeRecommendInternList(): HomeRecommendInt startYearMonth = this.startYearMonth, companyImage = this.companyImage, isScrapped = this.isScrapped, - ) + color = this.color, + ) \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt index 8e345b12e..f8247399f 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt @@ -26,15 +26,13 @@ class HomeRepositoryImpl @Inject constructor( sortBy: String, startYear: Int, startMonth: Int - ): Result> = + ): Result = runCatching { homeDataSource.getRecommendIntern( sortBy = sortBy, startYear = startYear, startMonth = startMonth - ).result.map { homeRecommendInternResponseDto -> - homeRecommendInternResponseDto.toHomeRecommendInternList() - } + ).result.toHomeRecommendInternList() } override suspend fun getFilteringInfo(): Result = diff --git a/data/src/main/java/com/terning/data/service/HomeService.kt b/data/src/main/java/com/terning/data/service/HomeService.kt index e57d1f617..c87dc2dce 100644 --- a/data/src/main/java/com/terning/data/service/HomeService.kt +++ b/data/src/main/java/com/terning/data/service/HomeService.kt @@ -20,7 +20,7 @@ interface HomeService { @Query("sortBy") sortBy: String, @Query("startYear") startYear: Int, @Query("startMonth") startMonth: Int, - ): BaseResponse> + ): BaseResponse @GET("api/v1/filters") suspend fun getFilteringInfo(): BaseResponse diff --git a/domain/src/main/java/com/terning/domain/entity/home/HomeRecommendIntern.kt b/domain/src/main/java/com/terning/domain/entity/home/HomeRecommendIntern.kt index e8e4150d9..60e4fc2df 100644 --- a/domain/src/main/java/com/terning/domain/entity/home/HomeRecommendIntern.kt +++ b/domain/src/main/java/com/terning/domain/entity/home/HomeRecommendIntern.kt @@ -1,13 +1,18 @@ package com.terning.domain.entity.home data class HomeRecommendIntern( - val scrapId: Long?, - val internshipAnnouncementId: Long, - val title: String, - val dDay: String, - val deadline: String, - val workingPeriod: String, - val startYearMonth: String, - val companyImage: String, - val isScrapped: Boolean, -) + val totalCount: Int, + val homeRecommendInternDetail: List +) { + data class HomeRecommendInternDetail( + val internshipAnnouncementId: Long, + val companyImage: String, + val dDay: String, + val title: String, + val workingPeriod: String, + val isScrapped: Boolean, + val color: String?, + val deadline: String, + val startYearMonth: String, + ) +} diff --git a/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt b/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt index c9923f8f2..e78187054 100644 --- a/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt +++ b/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt @@ -12,7 +12,7 @@ interface HomeRepository { sortBy: String, startYear: Int, startMonth: Int - ): Result> + ): Result suspend fun getFilteringInfo(): Result diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index acb88117f..a56e1b489 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -33,21 +33,9 @@ import androidx.navigation.NavHostController import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.terning.core.designsystem.component.bottomsheet.SortingBottomSheet import com.terning.core.designsystem.component.button.SortingButton -import com.terning.core.designsystem.component.dialog.ScrapCancelDialogContent -import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.component.item.InternItemWithShadow import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.CalBlue1 -import com.terning.core.designsystem.theme.CalBlue2 -import com.terning.core.designsystem.theme.CalGreen1 -import com.terning.core.designsystem.theme.CalGreen2 -import com.terning.core.designsystem.theme.CalOrange1 -import com.terning.core.designsystem.theme.CalOrange2 -import com.terning.core.designsystem.theme.CalPink -import com.terning.core.designsystem.theme.CalPurple -import com.terning.core.designsystem.theme.CalRed -import com.terning.core.designsystem.theme.CalYellow import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme @@ -65,7 +53,6 @@ import com.terning.core.designsystem.component.bottomsheet.HomeFilteringBottomSh import com.terning.feature.home.home.component.HomeFilteringEmptyIntern import com.terning.feature.home.home.component.HomeFilteringScreen import com.terning.feature.home.home.component.HomeRecommendEmptyIntern -import com.terning.feature.home.home.component.HomeRecommendInternDialog import com.terning.feature.home.home.component.HomeTodayEmptyWithImg import com.terning.feature.home.home.component.HomeTodayIntern import com.terning.feature.home.home.model.HomeDialogState @@ -138,10 +125,15 @@ fun HomeScreen( } val homeRecommendInternList = when (homeState.homeRecommendInternState) { - is UiState.Success -> (homeState.homeRecommendInternState as UiState.Success>).data + is UiState.Success -> (homeState.homeRecommendInternState as UiState.Success).data.homeRecommendInternDetail else -> listOf() } + val homeRecommendInternTotal = when (homeState.homeRecommendInternState) { + is UiState.Success -> (homeState.homeRecommendInternState as UiState.Success).data.totalCount + else -> 0 + } + val currentSortBy: MutableState = remember { mutableIntStateOf(0) } var sortingSheetState by remember { mutableStateOf(false) } var changeFilteringSheetState by remember { mutableStateOf(false) } @@ -209,7 +201,7 @@ fun HomeScreen( .padding(bottom = 16.dp) ) { ShowMainTitleWithName(homeUserName) - ShowTodayIntern( + ShowUpcomingIntern( homeUpcomingInternState = homeState.homeUpcomingInternState, homeDialogState = homeDialogState, navigateToIntern = { navigateToIntern(it) } @@ -243,7 +235,7 @@ fun HomeScreen( .padding(end = 3.dp), ) Text( - text = "0", + text = homeRecommendInternTotal.toString(), style = TerningTheme.typography.button3, color = TerningMain, ) @@ -289,93 +281,93 @@ fun HomeScreen( HomeRecommendEmptyIntern() } } - - if (homeDialogState.isScrapDialogVisible && !homeDialogState.isToday) { - TerningBasicDialog( - onDismissRequest = { - viewModel.updateScrapDialogVisible(false) - viewModel.updatePaletteOpen(false) - }, - content = { - if (homeRecommendInternList[scrapId].scrapId != null) { - ScrapCancelDialogContent( - onClickScrapCancel = { - viewModel.updateScrapDialogVisible(false) - viewModel.deleteScrap( - homeRecommendInternList[scrapId].scrapId ?: -1, - ) - if (homeDialogState.isScrappedState) { - viewModel.getRecommendInternsData( - currentSortBy.value, - homeFilteringInfo.startYear, - homeFilteringInfo.startMonth, - ) - viewModel.updateScrapped(false) - } - } - ) - } else { - val colorList = listOf( - CalRed, - CalOrange1, - CalOrange2, - CalYellow, - CalGreen1, - CalGreen2, - CalBlue1, - CalBlue2, - CalPurple, - CalPink, - ) - - val selectedColorIndex = - colorList.indexOf(homeDialogState.selectedColor).takeIf { it >= 0 } ?: 0 - - with(homeRecommendInternList[scrapId]) { - HomeRecommendInternDialog( - internInfoList = listOf( - stringResource(id = R.string.intern_info_d_day) to deadline, - stringResource(id = R.string.intern_info_working) to workingPeriod, - stringResource(id = R.string.intern_info_start_date) to startYearMonth, - ), - clickAction = { - if (homeDialogState.isPaletteOpen) { - viewModel.updatePaletteOpen(false) - viewModel.updateColorChange(false) - viewModel.updateScrapDialogVisible(false) - } else { - if (homeDialogState.isColorChange) { - viewModel.updateColorChange(false) - } - viewModel.updateScrapDialogVisible(false) - } - viewModel.postScrap( - homeRecommendInternList[scrapId].internshipAnnouncementId, - selectedColorIndex, - ) - viewModel.updateScrapDialogVisible(false) - if (homeDialogState.isScrappedState) { - viewModel.getRecommendInternsData( - currentSortBy.value, - homeFilteringInfo.startYear, - homeFilteringInfo.startMonth, - ) - viewModel.updateScrapped(false) - } - }, - homeRecommendIntern = this, - ) - } - } - } - ) - } +// +// if (homeDialogState.isScrapDialogVisible && !homeDialogState.isToday) { +// TerningBasicDialog( +// onDismissRequest = { +// viewModel.updateScrapDialogVisible(false) +// viewModel.updatePaletteOpen(false) +// }, +// content = { +// if (homeRecommendInternList[scrapId].scrapId != null) { +// ScrapCancelDialogContent( +// onClickScrapCancel = { +// viewModel.updateScrapDialogVisible(false) +// viewModel.deleteScrap( +// homeRecommendInternList[scrapId].scrapId ?: -1, +// ) +// if (homeDialogState.isScrappedState) { +// viewModel.getRecommendInternsData( +// currentSortBy.value, +// homeFilteringInfo.startYear, +// homeFilteringInfo.startMonth, +// ) +// viewModel.updateScrapped(false) +// } +// } +// ) +// } else { +// val colorList = listOf( +// CalRed, +// CalOrange1, +// CalOrange2, +// CalYellow, +// CalGreen1, +// CalGreen2, +// CalBlue1, +// CalBlue2, +// CalPurple, +// CalPink, +// ) +// +// val selectedColorIndex = +// colorList.indexOf(homeDialogState.selectedColor).takeIf { it >= 0 } ?: 0 +// +// with(homeRecommendInternList[scrapId]) { +// HomeRecommendInternDialog( +// internInfoList = listOf( +// stringResource(id = R.string.intern_info_d_day) to deadline, +// stringResource(id = R.string.intern_info_working) to workingPeriod, +// stringResource(id = R.string.intern_info_start_date) to startYearMonth, +// ), +// clickAction = { +// if (homeDialogState.isPaletteOpen) { +// viewModel.updatePaletteOpen(false) +// viewModel.updateColorChange(false) +// viewModel.updateScrapDialogVisible(false) +// } else { +// if (homeDialogState.isColorChange) { +// viewModel.updateColorChange(false) +// } +// viewModel.updateScrapDialogVisible(false) +// } +// viewModel.postScrap( +// homeRecommendInternList[scrapId].internshipAnnouncementId, +// selectedColorIndex, +// ) +// viewModel.updateScrapDialogVisible(false) +// if (homeDialogState.isScrappedState) { +// viewModel.getRecommendInternsData( +// currentSortBy.value, +// homeFilteringInfo.startYear, +// homeFilteringInfo.startMonth, +// ) +// viewModel.updateScrapped(false) +// } +// }, +// homeRecommendIntern = this, +// ) +// } +// } +// } +// ) +// } } @Composable private fun RecommendInternItem( - intern: HomeRecommendIntern, + intern: HomeRecommendIntern.HomeRecommendInternDetail, navigateToIntern: (Long) -> Unit, onScrapButtonClicked: (Long) -> Unit, ) { @@ -413,7 +405,7 @@ private fun ShowMainTitleWithName(userName: String) { } @Composable -private fun ShowTodayIntern( +private fun ShowUpcomingIntern( homeUpcomingInternState: UiState>, homeDialogState: HomeDialogState, navigateToIntern: (Long) -> Unit, diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt b/feature/src/main/java/com/terning/feature/home/home/HomeState.kt index c1f3b6434..ece71c0cb 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeState.kt @@ -1,15 +1,15 @@ package com.terning.feature.home.home import com.terning.core.state.UiState +import com.terning.core.type.SortBy import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern import com.terning.domain.entity.home.HomeUpcomingIntern -import com.terning.feature.home.home.model.SortBy data class HomeState( val sortBy: SortBy = SortBy.EARLIEST, val homeUserNameState: UiState = UiState.Loading, val homeFilteringInfoState: UiState = UiState.Loading, val homeUpcomingInternState: UiState> = UiState.Loading, - val homeRecommendInternState: UiState> = UiState.Loading, + val homeRecommendInternState: UiState = UiState.Loading, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt index 07f5b7a77..67d8820cb 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt @@ -4,7 +4,10 @@ import androidx.compose.ui.graphics.Color import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.core.designsystem.theme.CalRed +import com.terning.core.extension.currentMonth +import com.terning.core.extension.currentYear import com.terning.core.state.UiState +import com.terning.core.type.SortBy import com.terning.domain.entity.CalendarScrapRequest import com.terning.domain.entity.request.ChangeFilteringRequestModel import com.terning.domain.repository.HomeRepository @@ -12,7 +15,6 @@ import com.terning.domain.repository.MyPageRepository import com.terning.domain.repository.ScrapRepository import com.terning.feature.R import com.terning.feature.home.home.model.HomeDialogState -import com.terning.feature.home.home.model.SortBy import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow @@ -29,9 +31,6 @@ class HomeViewModel @Inject constructor( private val myPageRepository: MyPageRepository, private val scrapRepository: ScrapRepository, ) : ViewModel() { - val currentYear = Calendar.getInstance().get(Calendar.YEAR) - val currentMonth = Calendar.getInstance().get(Calendar.MONTH) - private val _homeState: MutableStateFlow = MutableStateFlow(HomeState()) val homeState get() = _homeState.asStateFlow() @@ -50,24 +49,23 @@ class HomeViewModel @Inject constructor( fun getRecommendInternsData(sortBy: Int, startYear: Int?, startMonth: Int?) { viewModelScope.launch { homeRepository.getRecommendIntern( - SortBy.entries[sortBy].sortBy, - startYear ?: currentYear, - startMonth ?: currentMonth, - ) - .onSuccess { internList -> - _homeState.value = _homeState.value.copy( - homeRecommendInternState = UiState.Success(internList) - ) - }.onFailure { exception: Throwable -> - _homeState.value = _homeState.value.copy( - homeRecommendInternState = UiState.Failure(exception.toString()) - ) - _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.server_failure)) - } + sortBy = SortBy.entries[sortBy].type, + startYear ?: Calendar.getInstance().currentYear, + startMonth ?: Calendar.getInstance().currentMonth, + ).onSuccess { internList -> + _homeState.value = _homeState.value.copy( + homeRecommendInternState = UiState.Success(internList) + ) + }.onFailure { exception: Throwable -> + _homeState.value = _homeState.value.copy( + homeRecommendInternState = UiState.Failure(exception.toString()) + ) + _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.server_failure)) + } } } - private fun getHomeTodayInternList() { + private fun getHomeUpcomingInternList() { viewModelScope.launch { homeRepository.getHomeUpcomingInternList().onSuccess { internList -> _homeState.value = _homeState.value.copy( @@ -88,12 +86,12 @@ class HomeViewModel @Inject constructor( _homeState.value = _homeState.value.copy( homeFilteringInfoState = UiState.Success(filteringInfo) ) - getHomeTodayInternList() -// getRecommendInternsData( -// sortBy = _homeState.value.sortBy.ordinal, -// startYear = filteringInfo.startYear, -// startMonth = filteringInfo.startMonth, -// ) + getHomeUpcomingInternList() + getRecommendInternsData( + sortBy = _homeState.value.sortBy.ordinal, + startYear = filteringInfo.startYear, + startMonth = filteringInfo.startMonth, + ) }.onFailure { exception: Throwable -> _homeState.value = _homeState.value.copy( homeFilteringInfoState = UiState.Failure(exception.toString()) @@ -107,9 +105,7 @@ class HomeViewModel @Inject constructor( viewModelScope.launch { homeRepository.putFilteringInfo( ChangeFilteringRequestModel(grade, workingPeriod, year, month) - ).onSuccess { - _homeSideEffect.emit(HomeSideEffect.NavigateToHome) - } + ) } } @@ -141,7 +137,7 @@ class HomeViewModel @Inject constructor( updateScrapDialogVisible(visible = false) updateScrapped(scrapped = true) updateSelectColor(CalRed) - getHomeTodayInternList() + getHomeUpcomingInternList() getFilteringInfo() _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.intern_scrap_add_toast_message)) }.onFailure { @@ -157,7 +153,7 @@ class HomeViewModel @Inject constructor( ).onSuccess { updateScrapDialogVisible(visible = false) updateScrapped(scrapped = true) - getHomeTodayInternList() + getHomeUpcomingInternList() getFilteringInfo() _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.intern_scrap_delete_toast_message)) }.onFailure { @@ -180,7 +176,7 @@ class HomeViewModel @Inject constructor( updateScrapDialogVisible(visible = false) updateScrapped(scrapped = true) updateSelectColor(CalRed) - getHomeTodayInternList() + getHomeUpcomingInternList() }.onFailure { _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.server_failure)) } diff --git a/feature/src/main/java/com/terning/feature/home/home/model/SortBy.kt b/feature/src/main/java/com/terning/feature/home/home/model/SortBy.kt deleted file mode 100644 index b820cd6ca..000000000 --- a/feature/src/main/java/com/terning/feature/home/home/model/SortBy.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.terning.feature.home.home.model - -enum class SortBy(val sortBy: String) { - EARLIEST("deadlineSoon"), - SHORTEST("shortestDuration"), - LONGEST("longestDuration"), - SCRAP("mostScrapped"), - VIEW_COUNT("mostViewed"), -} \ No newline at end of file From 76521ad313c8968e4af13082bf5345dacdd05cf9 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 8 Sep 2024 15:29:28 +0900 Subject: [PATCH 21/36] =?UTF-8?q?[CHORE/#204]=20=EA=B7=BC=EB=AC=B4=20?= =?UTF-8?q?=EA=B8=B0=EA=B0=84=20enum=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/main/java/com/terning/core/type/WorkingPeriod.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/terning/core/type/WorkingPeriod.kt b/core/src/main/java/com/terning/core/type/WorkingPeriod.kt index 114e21da9..fcaf96943 100644 --- a/core/src/main/java/com/terning/core/type/WorkingPeriod.kt +++ b/core/src/main/java/com/terning/core/type/WorkingPeriod.kt @@ -7,7 +7,7 @@ enum class WorkingPeriod( val workingPeriod: String, @StringRes val text: Int, ) { - FIRST("1 ~ 3개월", R.string.change_filter_period_1), - SECOND("4 ~ 6개월", R.string.change_filter_period_2), - THIRD("7개월 이상", R.string.change_filter_period_3), + SHORT("short", R.string.change_filter_period_1), + MIDDLE("middle", R.string.change_filter_period_2), + LONG("long", R.string.change_filter_period_3), } \ No newline at end of file From b3f3efbac8ad5cd6d3cef5e115c08067518e791c Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 8 Sep 2024 16:55:25 +0900 Subject: [PATCH 22/36] =?UTF-8?q?[MOD/#204]=20enum=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/core/type/Grade.kt | 16 +++++++++++++--- .../java/com/terning/core/type/WorkingPeriod.kt | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/terning/core/type/Grade.kt b/core/src/main/java/com/terning/core/type/Grade.kt index bcf4c8a54..99fef5432 100644 --- a/core/src/main/java/com/terning/core/type/Grade.kt +++ b/core/src/main/java/com/terning/core/type/Grade.kt @@ -4,11 +4,21 @@ import androidx.annotation.StringRes import com.terning.core.R enum class Grade( - val grade: String, - @StringRes val text: Int, + val stringValue: String, + @StringRes val stringResId: Int, ) { FRESHMAN("freshman", R.string.change_filter_grade_1), SOPHOMORE("sophomore", R.string.change_filter_grade_2), JUNIOR("junior", R.string.change_filter_grade_3), - SENIOR("senior", R.string.change_filter_grade_4), + SENIOR("senior", R.string.change_filter_grade_4); + + companion object { + fun fromString(value: String?): Grade = when (value) { + "freshman" -> FRESHMAN + "sophomore" -> SOPHOMORE + "junior" -> JUNIOR + "senior" -> SENIOR + else -> FRESHMAN + } + } } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/type/WorkingPeriod.kt b/core/src/main/java/com/terning/core/type/WorkingPeriod.kt index fcaf96943..d7a7328c8 100644 --- a/core/src/main/java/com/terning/core/type/WorkingPeriod.kt +++ b/core/src/main/java/com/terning/core/type/WorkingPeriod.kt @@ -4,10 +4,19 @@ import androidx.annotation.StringRes import com.terning.core.R enum class WorkingPeriod( - val workingPeriod: String, - @StringRes val text: Int, + val stringValue: String, + @StringRes val stringResId: Int, ) { SHORT("short", R.string.change_filter_period_1), MIDDLE("middle", R.string.change_filter_period_2), - LONG("long", R.string.change_filter_period_3), + LONG("long", R.string.change_filter_period_3); + + companion object { + fun fromString(value: String?): WorkingPeriod = when (value) { + "short" -> SHORT + "middle" -> MIDDLE + "long" -> LONG + else -> SHORT + } + } } \ No newline at end of file From a58d6b0279bb8b24bb7648433ea55c04065867c5 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 8 Sep 2024 17:42:51 +0900 Subject: [PATCH 23/36] =?UTF-8?q?[REFACTOR/#204]=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=A7=81=20=EC=9E=AC=EC=84=A4=EC=A0=95=20API=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/HomeFilteringBottomSheet.kt | 57 +++++++++++-------- .../data/datasourceimpl/HomeDataSourceImpl.kt | 4 +- .../dto/request/ChangeFilterRequestDto.kt | 4 +- .../response/HomeFilteringInfoResponseDto.kt | 4 +- .../domain/entity/home/HomeFilteringInfo.kt | 4 +- .../request/ChangeFilteringRequestModel.kt | 4 +- .../terning/feature/home/home/HomeRoute.kt | 51 ++++++++--------- .../feature/home/home/HomeViewModel.kt | 2 +- .../component/HomeFilteringEmptyIntern.kt | 41 ------------- .../home/component/HomeFilteringScreen.kt | 4 +- .../component/HomeRecommendEmptyIntern.kt | 18 +++++- .../home/component/HomeTodayEmptyIntern.kt | 6 +- .../home/component/HomeTodayEmptyWithImg.kt | 4 +- feature/src/main/res/values/strings.xml | 12 ++-- 14 files changed, 95 insertions(+), 120 deletions(-) delete mode 100644 feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringEmptyIntern.kt diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt index a2f05f156..6369f0666 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -15,6 +15,7 @@ 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 @@ -27,13 +28,11 @@ import com.terning.core.designsystem.component.datepicker.DatePickerUI 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.extension.currentMonth +import com.terning.core.extension.currentYear import com.terning.core.type.Grade import com.terning.core.type.WorkingPeriod -import java.time.LocalDate - -const val MIN_INDEX = 0 -const val MAX_WORKING_INDEX = 2 -const val MAX_GRADE_INDEX = 3 +import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -44,17 +43,22 @@ fun HomeFilteringBottomSheet( defaultStartYear: Int?, defaultStartMonth: Int?, onDismiss: () -> Unit, - onChangeButtonClick: (Int, Int, Int, Int) -> Unit, + onChangeButtonClick: (String, String, Int, Int) -> Unit, ) { - val currentYear = LocalDate.now().year - val currentMonth = LocalDate.now().monthValue - val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) - var currentGrade by remember { mutableIntStateOf(defaultGrade?.ordinal ?: -1) } - var currentPeriod by remember { mutableIntStateOf(defaultWorkingPeriod?.ordinal ?: -1) } - var currentStartYear by remember { mutableIntStateOf(defaultStartYear ?: currentYear) } - var currentStartMonth by remember { mutableIntStateOf(defaultStartMonth ?: currentMonth) } + 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 + ) + } TerningBasicBottomSheet( content = { @@ -91,7 +95,7 @@ fun HomeFilteringBottomSheet( R.string.change_filter_grade_4, ), onButtonClick = { index -> - currentGrade = index + currentGrade = Grade.entries[index] } ) @@ -109,7 +113,7 @@ fun HomeFilteringBottomSheet( R.string.change_filter_period_3, ), onButtonClick = { index -> - currentPeriod = index + currentPeriod = WorkingPeriod.entries[index] } ) @@ -120,8 +124,9 @@ fun HomeFilteringBottomSheet( ) DatePickerUI( - chosenYear = defaultStartYear ?: currentYear, - chosenMonth = defaultStartMonth?.minus(1) ?: currentMonth, + chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, + chosenMonth = defaultStartMonth?.minus(1) + ?: Calendar.getInstance().currentMonth, onYearChosen = { currentStartYear = it }, onMonthChosen = { currentStartMonth = it }, ) @@ -134,14 +139,18 @@ fun HomeFilteringBottomSheet( modifier = Modifier .padding(top = 51.dp), onButtonClick = { - onChangeButtonClick( - currentGrade, - currentPeriod, - currentStartYear, - currentStartMonth, - ) + currentGrade?.let { grade -> + currentPeriod?.let { workingPeriod -> + onChangeButtonClick( + grade.stringValue, + workingPeriod.stringValue, + currentStartYear, + currentStartMonth, + ) + } + } }, - isEnabled = currentGrade in MIN_INDEX..MAX_GRADE_INDEX && currentPeriod in MIN_INDEX..MAX_WORKING_INDEX + isEnabled = currentGrade != null && currentPeriod != null ) } diff --git a/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt index 7e7a0bc12..9e859e56f 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt @@ -30,6 +30,6 @@ class HomeDataSourceImpl @Inject constructor( override suspend fun getFilteringInfo(): BaseResponse = homeService.getFilteringInfo() - override suspend fun putFilteringInfo(request: ChangeFilterRequestDto): NonDataBaseResponse = - homeService.putFilteringInfo(request) + override suspend fun putFilteringInfo(changeFilterRequestDto: ChangeFilterRequestDto): NonDataBaseResponse = + homeService.putFilteringInfo(changeFilterRequestDto) } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/dto/request/ChangeFilterRequestDto.kt b/data/src/main/java/com/terning/data/dto/request/ChangeFilterRequestDto.kt index b126a02c2..770af1abf 100644 --- a/data/src/main/java/com/terning/data/dto/request/ChangeFilterRequestDto.kt +++ b/data/src/main/java/com/terning/data/dto/request/ChangeFilterRequestDto.kt @@ -7,9 +7,9 @@ import kotlinx.serialization.Serializable @Serializable data class ChangeFilterRequestDto( @SerialName("grade") - val grade: Int, + val grade: String, @SerialName("workingPeriod") - val workingPeriod: Int, + val workingPeriod: String, @SerialName("startYear") val startYear: Int, @SerialName("startMonth") diff --git a/data/src/main/java/com/terning/data/dto/response/HomeFilteringInfoResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/HomeFilteringInfoResponseDto.kt index 0b0a43308..6ea43e383 100644 --- a/data/src/main/java/com/terning/data/dto/response/HomeFilteringInfoResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/HomeFilteringInfoResponseDto.kt @@ -6,9 +6,9 @@ import kotlinx.serialization.Serializable @Serializable data class HomeFilteringInfoResponseDto( @SerialName("grade") - val grade: Int?, + val grade: String?, @SerialName("workingPeriod") - val workingPeriod: Int?, + val workingPeriod: String?, @SerialName("startYear") val startYear: Int?, @SerialName("startMonth") diff --git a/domain/src/main/java/com/terning/domain/entity/home/HomeFilteringInfo.kt b/domain/src/main/java/com/terning/domain/entity/home/HomeFilteringInfo.kt index 657fce14d..4334dfdb6 100644 --- a/domain/src/main/java/com/terning/domain/entity/home/HomeFilteringInfo.kt +++ b/domain/src/main/java/com/terning/domain/entity/home/HomeFilteringInfo.kt @@ -1,8 +1,8 @@ package com.terning.domain.entity.home data class HomeFilteringInfo( - val grade: Int?, - val workingPeriod: Int?, + val grade: String?, + val workingPeriod: String?, val startYear: Int?, val startMonth: Int?, ) diff --git a/domain/src/main/java/com/terning/domain/entity/request/ChangeFilteringRequestModel.kt b/domain/src/main/java/com/terning/domain/entity/request/ChangeFilteringRequestModel.kt index 7e155fa5f..b908fb3f9 100644 --- a/domain/src/main/java/com/terning/domain/entity/request/ChangeFilteringRequestModel.kt +++ b/domain/src/main/java/com/terning/domain/entity/request/ChangeFilteringRequestModel.kt @@ -1,8 +1,8 @@ package com.terning.domain.entity.request data class ChangeFilteringRequestModel( - val grade: Int, - val workingPeriod: Int, + val grade: String, + val workingPeriod: String, val startYear: Int, val startMonth: Int, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index a56e1b489..230015e23 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn @@ -31,6 +30,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle import androidx.navigation.NavHostController import com.google.accompanist.systemuicontroller.rememberSystemUiController +import com.terning.core.designsystem.component.bottomsheet.HomeFilteringBottomSheet import com.terning.core.designsystem.component.bottomsheet.SortingBottomSheet import com.terning.core.designsystem.component.button.SortingButton import com.terning.core.designsystem.component.image.TerningImage @@ -43,14 +43,12 @@ import com.terning.core.designsystem.theme.White import com.terning.core.extension.noRippleClickable import com.terning.core.extension.toast import com.terning.core.state.UiState +import com.terning.core.type.Grade +import com.terning.core.type.WorkingPeriod import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern import com.terning.domain.entity.home.HomeUpcomingIntern -import com.terning.core.type.Grade -import com.terning.core.type.WorkingPeriod import com.terning.feature.R -import com.terning.core.designsystem.component.bottomsheet.HomeFilteringBottomSheet -import com.terning.feature.home.home.component.HomeFilteringEmptyIntern import com.terning.feature.home.home.component.HomeFilteringScreen import com.terning.feature.home.home.component.HomeRecommendEmptyIntern import com.terning.feature.home.home.component.HomeTodayEmptyWithImg @@ -156,8 +154,10 @@ fun HomeScreen( if (changeFilteringSheetState) { HomeFilteringBottomSheet( - defaultGrade = homeFilteringInfo.grade?.let { Grade.entries[it] }, - defaultWorkingPeriod = homeFilteringInfo.workingPeriod?.let { WorkingPeriod.entries[it] }, + defaultGrade = homeFilteringInfo.grade?.let { Grade.fromString(it) }, + defaultWorkingPeriod = homeFilteringInfo.workingPeriod?.let { + WorkingPeriod.fromString(it) + }, defaultStartYear = homeFilteringInfo.startYear, defaultStartMonth = homeFilteringInfo.startMonth, onDismiss = { changeFilteringSheetState = false }, @@ -269,17 +269,25 @@ fun HomeScreen( } ) } + } else { + 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 + ) + } } } - if (homeState.homeFilteringInfoState is UiState.Success && homeFilteringInfo.grade == null) { - HomeFilteringEmptyIntern( - modifier = Modifier - .padding(horizontal = 24.dp) - .fillMaxSize() - ) - } else if (homeRecommendInternList.isEmpty()) { - HomeRecommendEmptyIntern() - } +// if (homeState.homeFilteringInfoState is UiState.Success && homeFilteringInfo.grade == null) { +// HomeFilteringEmptyIntern( +// modifier = Modifier +// .padding(horizontal = 24.dp) +// .fillMaxSize() +// ) +// } else if (homeRecommendInternList.isEmpty()) { +// HomeRecommendEmptyIntern() +// } } // // if (homeDialogState.isScrapDialogVisible && !homeDialogState.isToday) { @@ -392,7 +400,7 @@ private fun RecommendInternItem( private fun ShowMainTitleWithName(userName: String) { Text( text = stringResource( - id = R.string.home_today_title, + id = R.string.home_upcoming_title, if (userName.length in NAME_START_LENGTH..NAME_END_LENGTH) "\n" + userName else userName ), @@ -430,15 +438,6 @@ private fun ShowUpcomingIntern( @Composable private fun ShowRecommendTitle() { - Text( - text = stringResource(id = R.string.home_recommend_sub_title), - style = TerningTheme.typography.detail2, - color = Black, - modifier = Modifier - .padding(top = 9.dp) - .padding(horizontal = 24.dp), - ) - Text( text = stringResource(id = R.string.home_recommend_main_title), style = TerningTheme.typography.title1, diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt index 67d8820cb..1b5280937 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt @@ -101,7 +101,7 @@ class HomeViewModel @Inject constructor( } } - fun putFilteringInfo(grade: Int, workingPeriod: Int, year: Int, month: Int) { + fun putFilteringInfo(grade: String, workingPeriod: String, year: Int, month: Int) { viewModelScope.launch { homeRepository.putFilteringInfo( ChangeFilteringRequestModel(grade, workingPeriod, year, month) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringEmptyIntern.kt deleted file mode 100644 index b1ffeeda7..000000000 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringEmptyIntern.kt +++ /dev/null @@ -1,41 +0,0 @@ -package com.terning.feature.home.home.component - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.style.TextAlign -import com.terning.core.designsystem.component.image.TerningImage -import com.terning.core.designsystem.theme.Grey500 -import com.terning.core.designsystem.theme.TerningTheme -import com.terning.feature.R - -@Composable -fun HomeFilteringEmptyIntern( - modifier: Modifier = Modifier, -) { - Column( - modifier = modifier, - verticalArrangement = Arrangement.Center - ) { - - TerningImage( - painter = R.drawable.ic_home_empty_filtering, - modifier = Modifier - .align(Alignment.CenterHorizontally) - ) - Text( - text = stringResource(id = R.string.home_recommend_no_filtering), - modifier = Modifier - .fillMaxWidth() - .align(Alignment.CenterHorizontally), - style = TerningTheme.typography.detail2, - color = Grey500, - textAlign = TextAlign.Center, - ) - } -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index 4e69e4d6d..37b70dd9e 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -79,13 +79,13 @@ fun HomeFilteringScreen( verticalAlignment = Alignment.CenterVertically, ) { HomeFilteringInfoText( - text = stringResource(id = Grade.entries[grade ?: 0].text), + text = stringResource(id = Grade.fromString(grade).stringResId), modifier = Modifier .padding(end = 6.dp), ) HomeFilteringInfoDivider() HomeFilteringInfoText( - text = stringResource(WorkingPeriod.entries[workingPeriod ?: 0].text), + text = stringResource(WorkingPeriod.fromString(workingPeriod).stringResId), modifier = Modifier .padding(horizontal = 6.dp), ) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendEmptyIntern.kt index fa080f323..e05dad5ed 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendEmptyIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendEmptyIntern.kt @@ -1,5 +1,6 @@ package com.terning.feature.home.home.component +import androidx.annotation.StringRes import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -12,13 +13,16 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R @Composable fun HomeRecommendEmptyIntern( + @StringRes text: Int, modifier: Modifier = Modifier, ) { Column( @@ -27,19 +31,27 @@ fun HomeRecommendEmptyIntern( verticalArrangement = Arrangement.Center, ) { Image( - painter = painterResource(id = R.drawable.ic_empty_logo), + painter = painterResource(id = R.drawable.ic_home_empty_filtering), contentDescription = stringResource(id = R.string.home_recommend_no_intern_description), modifier = modifier .align(Alignment.CenterHorizontally) ) Text( - text = stringResource(id = R.string.home_recommend_no_intern), + text = stringResource(id = text), style = TerningTheme.typography.body4, color = Grey400, textAlign = TextAlign.Center, modifier = modifier - .padding(top = 8.dp) + .padding(top = 4.dp) .align(Alignment.CenterHorizontally) ) } +} + +@Preview(showBackground = true) +@Composable +fun HomeRecommendInternPreview() { + TerningPointTheme { + HomeRecommendEmptyIntern(R.string.home_recommend_no_intern) + } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyIntern.kt index f714c3abe..e2aa8169b 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyIntern.kt @@ -51,7 +51,7 @@ fun HomeTodayEmptyIntern( horizontalAlignment = Alignment.CenterHorizontally, ) { Text( - text = stringResource(id = R.string.home_today_no_closed), + text = stringResource(id = R.string.home_upcoming_empty), modifier = modifier .padding(top = 27.dp), textAlign = TextAlign.Center, @@ -69,7 +69,7 @@ fun HomeTodayEmptyIntern( ), ) { Text( - text = stringResource(id = R.string.home_today_check_schedule), + text = stringResource(id = R.string.home_upcoming_check_schedule), style = TerningTheme.typography.button4, color = Grey400, modifier = modifier @@ -79,7 +79,7 @@ fun HomeTodayEmptyIntern( } } else { Text( - text = stringResource(id = R.string.home_today_no_scrap), + text = stringResource(id = R.string.home_upcoming_no_scrap), modifier = modifier .padding(vertical = 44.dp) .fillMaxWidth() diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyWithImg.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyWithImg.kt index 2d681f98d..7290d30ae 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyWithImg.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyWithImg.kt @@ -49,8 +49,8 @@ fun HomeTodayEmptyWithImg( .padding(top = 24.dp) ) Text( - text = stringResource(id = R.string.home_scrap_empty), - modifier = modifier + text = stringResource(id = R.string.home_upcoming_no_scrap), + modifier = Modifier .padding(top = 8.dp, bottom = 25.dp) .fillMaxWidth() .wrapContentWidth(Alignment.CenterHorizontally), diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 344efd62b..60ae01709 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -70,14 +70,12 @@ 관심 공고가 캘린더에서 사라졌어요! - 오늘 마감되는 %s님의 관심 공고 - 아직 스크랩된 인턴 공고가 없어요!\n관심 공고를 스크랩하면 마감 당일에 알려드릴게요 - 오늘 마감인 공고가 없어요\n캘린더에서 가까운 공고 일정을 확인해 보세요 - 공고 마감 일정 확인하기 + 곧 마감되는 %s님의 관심 공고 + 아직 스크랩된 인턴 공고가 없어요! + 오늘 마감인 공고가 없어요\n캘린더에서 가까운 공고 일정을 확인해 보세요 + 공고 마감 일정 확인하기 - D- 근무기간 - 마음에 드는 공고를 스크랩하고 캘린더에서 모아보세요 내 계획에 딱 맞는 대학생 인턴 공고 필터링 학년 @@ -88,8 +86,6 @@ 지금 공고 필터링을 설정하고\n내 계획에 딱 맞는 대학생 인턴 공고를 추천받아보세요! - - - 오늘 마감인 공고가 없어요 개의 공고가 있어요 From 8a72727877b322693936bcbc1271e38f33320d2b Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 8 Sep 2024 18:10:21 +0900 Subject: [PATCH 24/36] =?UTF-8?q?[REFACTOR/#204]=20=EA=B3=A7=20=EB=A7=88?= =?UTF-8?q?=EA=B0=90=20=EC=A0=95=EB=B3=B4=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/home/HomeRoute.kt | 10 +- .../home/home/component/HomeTodayIntern.kt | 84 ------- .../home/component/HomeTodayInternItem.kt | 127 ----------- ...yWithImg.kt => HomeUpcomingEmptyFilter.kt} | 2 +- ...tyIntern.kt => HomeUpcomingEmptyIntern.kt} | 2 +- .../component/HomeUpcomingInternScreen.kt | 207 ++++++++++++++++++ 6 files changed, 214 insertions(+), 218 deletions(-) delete mode 100644 feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt delete mode 100644 feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt rename feature/src/main/java/com/terning/feature/home/home/component/{HomeTodayEmptyWithImg.kt => HomeUpcomingEmptyFilter.kt} (98%) rename feature/src/main/java/com/terning/feature/home/home/component/{HomeTodayEmptyIntern.kt => HomeUpcomingEmptyIntern.kt} (99%) create mode 100644 feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 230015e23..074860f93 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -51,8 +51,8 @@ import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.R import com.terning.feature.home.home.component.HomeFilteringScreen import com.terning.feature.home.home.component.HomeRecommendEmptyIntern -import com.terning.feature.home.home.component.HomeTodayEmptyWithImg -import com.terning.feature.home.home.component.HomeTodayIntern +import com.terning.feature.home.home.component.HomeUpcomingEmptyFilter +import com.terning.feature.home.home.component.HomeUpcomingInternScreen import com.terning.feature.home.home.model.HomeDialogState import com.terning.feature.intern.navigation.navigateIntern @@ -421,9 +421,9 @@ private fun ShowUpcomingIntern( when (homeUpcomingInternState) { is UiState.Success -> { if (homeUpcomingInternState.data.isEmpty()) { - HomeTodayEmptyWithImg() + HomeUpcomingEmptyFilter() } else { - HomeTodayIntern( + HomeUpcomingInternScreen( internList = homeUpcomingInternState.data, homeDialogState = homeDialogState, navigateToIntern = navigateToIntern @@ -431,7 +431,7 @@ private fun ShowUpcomingIntern( } } - is UiState.Loading -> HomeTodayEmptyWithImg() + is UiState.Loading -> HomeUpcomingEmptyFilter() else -> {} } } diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt deleted file mode 100644 index eaf3fe9e3..000000000 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayIntern.kt +++ /dev/null @@ -1,84 +0,0 @@ -package com.terning.feature.home.home.component - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.lazy.LazyRow -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel -import com.terning.core.designsystem.component.dialog.TerningBasicDialog -import com.terning.core.extension.noRippleClickable -import com.terning.domain.entity.home.HomeUpcomingIntern -import com.terning.feature.R -import com.terning.feature.home.home.HomeViewModel -import com.terning.feature.home.home.model.HomeDialogState - -@Composable -fun HomeTodayIntern( - internList: List, - homeDialogState: HomeDialogState, - navigateToIntern: (Long) -> Unit, - homeViewModel: HomeViewModel = hiltViewModel() -) { - var selectedIndex by remember { - mutableStateOf(0) - } - LazyRow( - horizontalArrangement = Arrangement.spacedBy(12.dp), - contentPadding = PaddingValues(horizontal = 24.dp), - modifier = Modifier - .fillMaxWidth(), - ) { - items(internList.size) { index -> - HomeTodayInternItem( - homeUpcomingIntern = internList[index], - modifier = Modifier - .noRippleClickable { - homeViewModel.updateScrapDialogVisible(true) - homeViewModel.updateIsToday(true) - homeViewModel.updateSelectColor( - Color( - android.graphics.Color.parseColor( - internList[index].color - ) - ) - ) - selectedIndex = index - } - ) - } - } - - if (homeDialogState.isScrapDialogVisible && homeDialogState.isToday) { - TerningBasicDialog( - onDismissRequest = { - homeViewModel.updateScrapDialogVisible(false) - homeViewModel.updatePaletteOpen(false) - }, - content = { - with(internList[selectedIndex]) { - HomeTodayInternDialog( - internInfoList = listOf( - stringResource(id = R.string.intern_info_d_day) to deadline, - stringResource(id = R.string.intern_info_working) to workingPeriod, - stringResource(id = R.string.intern_info_start_date) to startYearMonth, - ), - navigateTo = { - navigateToIntern(internshipAnnouncementId) - homeViewModel.updateScrapDialogVisible(false) - }, - homeUpcomingIntern = internList[selectedIndex], - ) - } - }, - ) - } -} diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt deleted file mode 100644 index 8da593c0a..000000000 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternItem.kt +++ /dev/null @@ -1,127 +0,0 @@ -package com.terning.feature.home.home.component - -import androidx.compose.foundation.BorderStroke -import androidx.compose.foundation.background -import androidx.compose.foundation.border -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.aspectRatio -import androidx.compose.foundation.layout.fillMaxHeight -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage -import coil.request.ImageRequest -import com.terning.core.designsystem.component.item.ScrapBox -import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.Grey150 -import com.terning.core.designsystem.theme.Grey500 -import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningSub3 -import com.terning.core.designsystem.theme.TerningTheme -import com.terning.domain.entity.home.HomeUpcomingIntern -import com.terning.feature.R - -@Composable -fun HomeTodayInternItem( - homeUpcomingIntern: HomeUpcomingIntern, - modifier: Modifier = Modifier -) { - ScrapBox( - modifier = Modifier - .width(246.dp), - cornerRadius = 5.dp, - scrapColor = Color(android.graphics.Color.parseColor(homeUpcomingIntern.color)), - borderWidth = 1.dp, - borderColor = Grey150, - content = { - Column( - modifier = modifier - .fillMaxHeight(), - verticalArrangement = Arrangement.SpaceBetween, - ) { - Text( - text = homeUpcomingIntern.title, - modifier = modifier - .padding( - start = 12.dp, - end = 12.dp, - top = 16.dp - ), - style = TerningTheme.typography.button3, - color = Black, - maxLines = 3, - minLines = 3, - ) - - Row( - modifier = Modifier - .padding( - start = 12.dp, - end = 12.dp, - bottom = 12.dp, - top = 8.dp - ) - .fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween - ) { - AsyncImage( - model = ImageRequest.Builder(LocalContext.current) - .data(homeUpcomingIntern.companyImage) - .build(), - contentDescription = stringResource(id = R.string.home_company_image), - contentScale = ContentScale.Crop, - modifier = Modifier - .height(32.dp) - .aspectRatio(1f) - .border(BorderStroke(1.dp, Grey150), CircleShape) - .clip(CircleShape) - ) - - Text( - text = "유한킴벌리", - style = TerningTheme.typography.button5, - color = Grey500, - maxLines = 1, - modifier = Modifier - .padding(start = 6.dp, end = 15.dp) - .weight(1f) - ) - - Row( - modifier = Modifier - .size(width = 40.dp, height = 20.dp) - .background( - color = TerningSub3, - shape = RoundedCornerShape(size = 5.dp) - ), - horizontalArrangement = Arrangement.Center, - verticalAlignment = Alignment.CenterVertically - ) { - Text( - text = homeUpcomingIntern.dDay, - style = TerningTheme.typography.body4, - color = TerningMain, - ) - } - } - } - } - ) -} diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyWithImg.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyFilter.kt similarity index 98% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyWithImg.kt rename to feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyFilter.kt index 7290d30ae..11de75c49 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyWithImg.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyFilter.kt @@ -23,7 +23,7 @@ import com.terning.core.extension.customShadow import com.terning.feature.R @Composable -fun HomeTodayEmptyWithImg( +fun HomeUpcomingEmptyFilter( modifier: Modifier = Modifier, ) { Column( diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt similarity index 99% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyIntern.kt rename to feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt index e2aa8169b..e01c29cb4 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayEmptyIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt @@ -25,7 +25,7 @@ import com.terning.core.extension.customShadow import com.terning.feature.R @Composable -fun HomeTodayEmptyIntern( +fun HomeUpcomingEmptyIntern( isButtonExist: Boolean, modifier: Modifier = Modifier, ) { diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt new file mode 100644 index 000000000..4499c8c26 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt @@ -0,0 +1,207 @@ +package com.terning.feature.home.home.component + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +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.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import coil.compose.AsyncImage +import coil.request.ImageRequest +import com.terning.core.designsystem.component.dialog.TerningBasicDialog +import com.terning.core.designsystem.component.item.ScrapBox +import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey150 +import com.terning.core.designsystem.theme.Grey500 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningSub3 +import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.extension.noRippleClickable +import com.terning.domain.entity.home.HomeUpcomingIntern +import com.terning.feature.R +import com.terning.feature.home.home.HomeViewModel +import com.terning.feature.home.home.model.HomeDialogState + +@Composable +fun HomeUpcomingInternScreen( + internList: List, + homeDialogState: HomeDialogState, + navigateToIntern: (Long) -> Unit, + homeViewModel: HomeViewModel = hiltViewModel() +) { + var selectedIndex by remember { + mutableStateOf(0) + } + LazyRow( + horizontalArrangement = Arrangement.spacedBy(12.dp), + contentPadding = PaddingValues(horizontal = 24.dp), + modifier = Modifier + .fillMaxWidth(), + ) { + items(internList.size) { index -> + val homeUpcomingIntern = internList[index] + + ScrapBox( + modifier = Modifier + .width(246.dp), + cornerRadius = 5.dp, + scrapColor = Color(android.graphics.Color.parseColor(homeUpcomingIntern.color)), + borderWidth = 1.dp, + borderColor = Grey150, + content = { + Column( + modifier = Modifier + .fillMaxHeight() + .noRippleClickable { + homeViewModel.updateScrapDialogVisible(true) + homeViewModel.updateIsToday(true) + homeViewModel.updateSelectColor( + Color( + android.graphics.Color.parseColor( + internList[index].color + ) + ) + ) + selectedIndex = index + }, + verticalArrangement = Arrangement.SpaceBetween, + ) { + Text( + text = homeUpcomingIntern.title, + modifier = Modifier + .padding( + start = 12.dp, + end = 12.dp, + top = 16.dp + ), + style = TerningTheme.typography.button3, + color = Black, + maxLines = 3, + minLines = 3, + ) + + Row( + modifier = Modifier + .padding( + start = 12.dp, + end = 12.dp, + bottom = 12.dp, + top = 8.dp + ) + .fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween + ) { + AsyncImage( + model = ImageRequest.Builder(LocalContext.current) + .data(homeUpcomingIntern.companyImage) + .build(), + contentDescription = stringResource(id = R.string.home_company_image), + contentScale = ContentScale.Crop, + modifier = Modifier + .height(32.dp) + .aspectRatio(1f) + .border(BorderStroke(1.dp, Grey150), CircleShape) + .clip(CircleShape) + ) + + Text( + text = "유한킴벌리", + style = TerningTheme.typography.button5, + color = Grey500, + maxLines = 1, + modifier = Modifier + .padding(start = 6.dp, end = 15.dp) + .weight(1f) + ) + + Row( + modifier = Modifier + .size(width = 40.dp, height = 20.dp) + .background( + color = TerningSub3, + shape = RoundedCornerShape(size = 5.dp) + ), + horizontalArrangement = Arrangement.Center, + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = homeUpcomingIntern.dDay, + style = TerningTheme.typography.body4, + color = TerningMain, + ) + } + } + } + } + ) +// HomeTodayInternItem( +// homeUpcomingIntern = internList[index], +// modifier = Modifier +// .noRippleClickable { +// homeViewModel.updateScrapDialogVisible(true) +// homeViewModel.updateIsToday(true) +// homeViewModel.updateSelectColor( +// Color( +// android.graphics.Color.parseColor( +// internList[index].color +// ) +// ) +// ) +// selectedIndex = index +// } +// ) + } + } + + if (homeDialogState.isScrapDialogVisible && homeDialogState.isToday) { + TerningBasicDialog( + onDismissRequest = { + homeViewModel.updateScrapDialogVisible(false) + homeViewModel.updatePaletteOpen(false) + }, + content = { + with(internList[selectedIndex]) { + HomeTodayInternDialog( + internInfoList = listOf( + stringResource(id = R.string.intern_info_d_day) to deadline, + stringResource(id = R.string.intern_info_working) to workingPeriod, + stringResource(id = R.string.intern_info_start_date) to startYearMonth, + ), + navigateTo = { + navigateToIntern(internshipAnnouncementId) + homeViewModel.updateScrapDialogVisible(false) + }, + homeUpcomingIntern = internList[selectedIndex], + ) + } + }, + ) + } +} From 0907e8aaffe62c334b7397a3591de31c885c124a Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 8 Sep 2024 18:16:25 +0900 Subject: [PATCH 25/36] =?UTF-8?q?[CHORE/#204]=20test=20style=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/home/component/HomeFilteringScreen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index 37b70dd9e..5f6861721 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -97,7 +97,7 @@ fun HomeFilteringScreen( ) } } else { - Text( + HomeFilteringInfoText( text = "설정된 필터링 정보가 없어요", modifier = Modifier .align(Alignment.CenterVertically), From aaadc133be91a891aa375fb93ddab265cb64cea3 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 8 Sep 2024 21:07:15 +0900 Subject: [PATCH 26/36] =?UTF-8?q?[REFACTOR/#204]=20=EA=B3=A7=20=EB=A7=88?= =?UTF-8?q?=EA=B0=90=20=EA=B3=B5=EA=B3=A0=20=EB=A1=9C=EC=A7=81=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 --- .../terning/feature/home/home/HomeRoute.kt | 5 +- .../terning/feature/home/home/HomeState.kt | 2 +- .../feature/home/home/HomeViewModel.kt | 14 ++-- .../home/component/HomeUpcomingEmptyIntern.kt | 65 +++++++------------ 4 files changed, 37 insertions(+), 49 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 074860f93..486660ccc 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -52,6 +52,7 @@ import com.terning.feature.R import com.terning.feature.home.home.component.HomeFilteringScreen import com.terning.feature.home.home.component.HomeRecommendEmptyIntern import com.terning.feature.home.home.component.HomeUpcomingEmptyFilter +import com.terning.feature.home.home.component.HomeUpcomingEmptyIntern import com.terning.feature.home.home.component.HomeUpcomingInternScreen import com.terning.feature.home.home.model.HomeDialogState import com.terning.feature.intern.navigation.navigateIntern @@ -421,7 +422,7 @@ private fun ShowUpcomingIntern( when (homeUpcomingInternState) { is UiState.Success -> { if (homeUpcomingInternState.data.isEmpty()) { - HomeUpcomingEmptyFilter() + HomeUpcomingEmptyIntern() } else { HomeUpcomingInternScreen( internList = homeUpcomingInternState.data, @@ -430,8 +431,8 @@ private fun ShowUpcomingIntern( ) } } - is UiState.Loading -> HomeUpcomingEmptyFilter() + is UiState.Empty -> HomeUpcomingEmptyFilter() else -> {} } } diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt b/feature/src/main/java/com/terning/feature/home/home/HomeState.kt index ece71c0cb..357cafa30 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeState.kt @@ -10,6 +10,6 @@ data class HomeState( val sortBy: SortBy = SortBy.EARLIEST, val homeUserNameState: UiState = UiState.Loading, val homeFilteringInfoState: UiState = UiState.Loading, - val homeUpcomingInternState: UiState> = UiState.Loading, + val homeUpcomingInternState: UiState> = UiState.Empty, val homeRecommendInternState: UiState = UiState.Loading, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt index 1b5280937..7f57dade5 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt @@ -86,12 +86,14 @@ class HomeViewModel @Inject constructor( _homeState.value = _homeState.value.copy( homeFilteringInfoState = UiState.Success(filteringInfo) ) - getHomeUpcomingInternList() - getRecommendInternsData( - sortBy = _homeState.value.sortBy.ordinal, - startYear = filteringInfo.startYear, - startMonth = filteringInfo.startMonth, - ) + if(filteringInfo.grade != null) { + getHomeUpcomingInternList() + getRecommendInternsData( + sortBy = _homeState.value.sortBy.ordinal, + startYear = filteringInfo.startYear, + startMonth = filteringInfo.startMonth, + ) + } }.onFailure { exception: Throwable -> _homeState.value = _homeState.value.copy( homeFilteringInfoState = UiState.Failure(exception.toString()) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt index e01c29cb4..0cca018db 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults @@ -26,7 +25,6 @@ import com.terning.feature.R @Composable fun HomeUpcomingEmptyIntern( - isButtonExist: Boolean, modifier: Modifier = Modifier, ) { Column( @@ -44,50 +42,37 @@ fun HomeUpcomingEmptyIntern( shape = RoundedCornerShape(5.dp) ) ) { - if (isButtonExist) { - Column( + Column( + modifier = modifier + .fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = stringResource(id = R.string.home_upcoming_empty), modifier = modifier - .fillMaxWidth(), - horizontalAlignment = Alignment.CenterHorizontally, + .padding(top = 27.dp), + textAlign = TextAlign.Center, + style = TerningTheme.typography.detail3, + color = Grey500, + ) + Card( + colors = CardDefaults.cardColors(White), + modifier = modifier + .padding(top = 7.dp, bottom = 27.dp) + .border( + width = 1.dp, + color = Grey400, + shape = RoundedCornerShape(12.dp), + ), ) { Text( - text = stringResource(id = R.string.home_upcoming_empty), + text = stringResource(id = R.string.home_upcoming_check_schedule), + style = TerningTheme.typography.button4, + color = Grey400, modifier = modifier - .padding(top = 27.dp), - textAlign = TextAlign.Center, - style = TerningTheme.typography.detail3, - color = Grey500, + .padding(vertical = 8.dp, horizontal = 10.dp) ) - Card( - colors = CardDefaults.cardColors(White), - modifier = modifier - .padding(top = 7.dp, bottom = 27.dp) - .border( - width = 1.dp, - color = Grey400, - shape = RoundedCornerShape(12.dp), - ), - ) { - Text( - text = stringResource(id = R.string.home_upcoming_check_schedule), - style = TerningTheme.typography.button4, - color = Grey400, - modifier = modifier - .padding(vertical = 8.dp, horizontal = 10.dp) - ) - } } - } else { - Text( - text = stringResource(id = R.string.home_upcoming_no_scrap), - modifier = modifier - .padding(vertical = 44.dp) - .fillMaxWidth() - .wrapContentWidth(Alignment.CenterHorizontally), - textAlign = TextAlign.Center, - style = TerningTheme.typography.detail2, - color = Grey500, - ) } } } \ No newline at end of file From 6a023600339655d1206962d4d2dc34d93c9a763a Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Sun, 8 Sep 2024 21:09:41 +0900 Subject: [PATCH 27/36] =?UTF-8?q?[CHORE/#204]=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 --- .../main/java/com/terning/feature/home/home/HomeRoute.kt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 486660ccc..0b3e40090 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -280,15 +280,6 @@ fun HomeScreen( } } } -// if (homeState.homeFilteringInfoState is UiState.Success && homeFilteringInfo.grade == null) { -// HomeFilteringEmptyIntern( -// modifier = Modifier -// .padding(horizontal = 24.dp) -// .fillMaxSize() -// ) -// } else if (homeRecommendInternList.isEmpty()) { -// HomeRecommendEmptyIntern() -// } } // // if (homeDialogState.isScrapDialogVisible && !homeDialogState.isToday) { From 58b74250741fd6740264122ad153fae5c3ab1d00 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Mon, 9 Sep 2024 20:11:15 +0900 Subject: [PATCH 28/36] =?UTF-8?q?[CHORE/#204]=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=A7=81=20=EC=9D=B8=EB=8D=B1=EC=8A=A4=20int=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/bottomsheet/HomeFilteringBottomSheet.kt | 6 +++--- .../com/terning/data/dto/request/ChangeFilterRequestDto.kt | 4 ++-- .../data/dto/response/HomeFilteringInfoResponseDto.kt | 4 ++-- .../com/terning/domain/entity/home/HomeFilteringInfo.kt | 4 ++-- .../domain/entity/request/ChangeFilteringRequestModel.kt | 4 ++-- .../main/java/com/terning/feature/home/home/HomeRoute.kt | 4 ++-- .../java/com/terning/feature/home/home/HomeViewModel.kt | 2 +- .../feature/home/home/component/HomeFilteringScreen.kt | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt index 6369f0666..6ee588e7a 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -43,7 +43,7 @@ fun HomeFilteringBottomSheet( defaultStartYear: Int?, defaultStartMonth: Int?, onDismiss: () -> Unit, - onChangeButtonClick: (String, String, Int, Int) -> Unit, + onChangeButtonClick: (Int, Int, Int, Int) -> Unit, ) { val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) @@ -142,8 +142,8 @@ fun HomeFilteringBottomSheet( currentGrade?.let { grade -> currentPeriod?.let { workingPeriod -> onChangeButtonClick( - grade.stringValue, - workingPeriod.stringValue, + grade.ordinal, + workingPeriod.ordinal, currentStartYear, currentStartMonth, ) diff --git a/data/src/main/java/com/terning/data/dto/request/ChangeFilterRequestDto.kt b/data/src/main/java/com/terning/data/dto/request/ChangeFilterRequestDto.kt index 770af1abf..b126a02c2 100644 --- a/data/src/main/java/com/terning/data/dto/request/ChangeFilterRequestDto.kt +++ b/data/src/main/java/com/terning/data/dto/request/ChangeFilterRequestDto.kt @@ -7,9 +7,9 @@ import kotlinx.serialization.Serializable @Serializable data class ChangeFilterRequestDto( @SerialName("grade") - val grade: String, + val grade: Int, @SerialName("workingPeriod") - val workingPeriod: String, + val workingPeriod: Int, @SerialName("startYear") val startYear: Int, @SerialName("startMonth") diff --git a/data/src/main/java/com/terning/data/dto/response/HomeFilteringInfoResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/HomeFilteringInfoResponseDto.kt index 6ea43e383..0b0a43308 100644 --- a/data/src/main/java/com/terning/data/dto/response/HomeFilteringInfoResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/HomeFilteringInfoResponseDto.kt @@ -6,9 +6,9 @@ import kotlinx.serialization.Serializable @Serializable data class HomeFilteringInfoResponseDto( @SerialName("grade") - val grade: String?, + val grade: Int?, @SerialName("workingPeriod") - val workingPeriod: String?, + val workingPeriod: Int?, @SerialName("startYear") val startYear: Int?, @SerialName("startMonth") diff --git a/domain/src/main/java/com/terning/domain/entity/home/HomeFilteringInfo.kt b/domain/src/main/java/com/terning/domain/entity/home/HomeFilteringInfo.kt index 4334dfdb6..657fce14d 100644 --- a/domain/src/main/java/com/terning/domain/entity/home/HomeFilteringInfo.kt +++ b/domain/src/main/java/com/terning/domain/entity/home/HomeFilteringInfo.kt @@ -1,8 +1,8 @@ package com.terning.domain.entity.home data class HomeFilteringInfo( - val grade: String?, - val workingPeriod: String?, + val grade: Int?, + val workingPeriod: Int?, val startYear: Int?, val startMonth: Int?, ) diff --git a/domain/src/main/java/com/terning/domain/entity/request/ChangeFilteringRequestModel.kt b/domain/src/main/java/com/terning/domain/entity/request/ChangeFilteringRequestModel.kt index b908fb3f9..7e155fa5f 100644 --- a/domain/src/main/java/com/terning/domain/entity/request/ChangeFilteringRequestModel.kt +++ b/domain/src/main/java/com/terning/domain/entity/request/ChangeFilteringRequestModel.kt @@ -1,8 +1,8 @@ package com.terning.domain.entity.request data class ChangeFilteringRequestModel( - val grade: String, - val workingPeriod: String, + val grade: Int, + val workingPeriod: Int, val startYear: Int, val startMonth: Int, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 0b3e40090..e8a00511e 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -155,9 +155,9 @@ fun HomeScreen( if (changeFilteringSheetState) { HomeFilteringBottomSheet( - defaultGrade = homeFilteringInfo.grade?.let { Grade.fromString(it) }, + defaultGrade = homeFilteringInfo.grade?.let { Grade.entries[it] }, defaultWorkingPeriod = homeFilteringInfo.workingPeriod?.let { - WorkingPeriod.fromString(it) + WorkingPeriod.entries[it] }, defaultStartYear = homeFilteringInfo.startYear, defaultStartMonth = homeFilteringInfo.startMonth, diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt index 7f57dade5..7bf3667fb 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt @@ -103,7 +103,7 @@ class HomeViewModel @Inject constructor( } } - fun putFilteringInfo(grade: String, workingPeriod: String, year: Int, month: Int) { + fun putFilteringInfo(grade: Int, workingPeriod: Int, year: Int, month: Int) { viewModelScope.launch { homeRepository.putFilteringInfo( ChangeFilteringRequestModel(grade, workingPeriod, year, month) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index 5f6861721..ea8677483 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -79,13 +79,13 @@ fun HomeFilteringScreen( verticalAlignment = Alignment.CenterVertically, ) { HomeFilteringInfoText( - text = stringResource(id = Grade.fromString(grade).stringResId), + text = stringResource(id = Grade.entries[grade!!].stringResId), modifier = Modifier .padding(end = 6.dp), ) HomeFilteringInfoDivider() HomeFilteringInfoText( - text = stringResource(WorkingPeriod.fromString(workingPeriod).stringResId), + text = stringResource(WorkingPeriod.entries[workingPeriod!!].stringResId), modifier = Modifier .padding(horizontal = 6.dp), ) From 1cfe864086e2ae8b82083381e6399ee035e31771 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Mon, 9 Sep 2024 22:22:30 +0900 Subject: [PATCH 29/36] =?UTF-8?q?[FEAT/#204]=20=EB=A7=9E=EC=B6=A4=20?= =?UTF-8?q?=EA=B3=B5=EA=B3=A0=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/home/HomeRoute.kt | 166 ++++++++---------- .../terning/feature/home/home/HomeState.kt | 3 + .../feature/home/home/HomeViewModel.kt | 130 ++++---------- 3 files changed, 110 insertions(+), 189 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index e8a00511e..244cbc338 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -36,10 +36,13 @@ 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.theme.Black +import com.terning.core.designsystem.theme.CalRed 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.extension.currentMonth +import com.terning.core.extension.currentYear import com.terning.core.extension.noRippleClickable import com.terning.core.extension.toast import com.terning.core.state.UiState @@ -49,6 +52,8 @@ import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.R +import com.terning.feature.dialog.cancel.ScrapCancelDialog +import com.terning.feature.dialog.detail.ScrapDialog import com.terning.feature.home.home.component.HomeFilteringScreen import com.terning.feature.home.home.component.HomeRecommendEmptyIntern import com.terning.feature.home.home.component.HomeUpcomingEmptyFilter @@ -56,6 +61,7 @@ import com.terning.feature.home.home.component.HomeUpcomingEmptyIntern import com.terning.feature.home.home.component.HomeUpcomingInternScreen import com.terning.feature.home.home.model.HomeDialogState import com.terning.feature.intern.navigation.navigateIntern +import java.util.Calendar const val NAME_START_LENGTH = 7 const val NAME_END_LENGTH = 12 @@ -79,8 +85,6 @@ fun HomeRoute( val lifecycleOwner = LocalLifecycleOwner.current val context = LocalContext.current - val homeDialogState by viewModel.homeDialogState.collectAsStateWithLifecycle() - LaunchedEffect(key1 = true) { viewModel.getFilteringInfo() } @@ -97,7 +101,6 @@ fun HomeRoute( HomeScreen( paddingValues = paddingValues, - homeDialogState = homeDialogState, navigateToIntern = { navController.navigateIntern(announcementId = it) }, viewModel = viewModel, ) @@ -107,7 +110,6 @@ fun HomeRoute( @Composable fun HomeScreen( paddingValues: PaddingValues, - homeDialogState: HomeDialogState, navigateToIntern: (Long) -> Unit, viewModel: HomeViewModel, ) { @@ -136,7 +138,6 @@ fun HomeScreen( val currentSortBy: MutableState = remember { mutableIntStateOf(0) } var sortingSheetState by remember { mutableStateOf(false) } var changeFilteringSheetState by remember { mutableStateOf(false) } - var scrapId by remember { mutableIntStateOf(-1) } if (sortingSheetState) { SortingBottomSheet( @@ -175,6 +176,23 @@ fun HomeScreen( } } + LaunchedEffect( + homeState.homeRecommendDialogVisibility, + homeState.homeUpcomingDialogVisibility + ) { + with(homeState) { + if (!homeRecommendDialogVisibility && !homeUpcomingDialogVisibility) { + viewModel.getRecommendInternsData( + sortBy = sortBy.ordinal, + startYear = homeFilteringInfo.startYear ?: Calendar.getInstance().currentYear, + startMonth = homeFilteringInfo.startMonth + ?: Calendar.getInstance().currentMonth, + ) + viewModel.getHomeUpcomingInternList() + } + } + } + Column( horizontalAlignment = Alignment.Start, modifier = Modifier @@ -204,7 +222,7 @@ fun HomeScreen( ShowMainTitleWithName(homeUserName) ShowUpcomingIntern( homeUpcomingInternState = homeState.homeUpcomingInternState, - homeDialogState = homeDialogState, + homeState = homeState, navigateToIntern = { navigateToIntern(it) } ) } @@ -264,11 +282,55 @@ fun HomeScreen( navigateToIntern = navigateToIntern, intern = homeRecommendInternList[index], onScrapButtonClicked = { - viewModel.updateScrapDialogVisible(true) - viewModel.updateIsToday(false) - scrapId = index + viewModel.updateRecommendDialogVisibility(true) + with(homeRecommendInternList[index]) { + viewModel.updateHomeInternModel( + internshipAnnouncementId = internshipAnnouncementId, + companyImage = companyImage, + title = title, + dDay = dDay, + deadline = deadline, + workingPeriod = workingPeriod, + isScrapped = isScrapped, + color = color, + startYearMonth = startYearMonth, + ) + } } ) + + if (homeState.homeRecommendDialogVisibility) { + with(homeState.homeInternModel) { + if (this != null) { + if (isScrapped) { + ScrapCancelDialog( + internshipAnnouncementId = internshipAnnouncementId, + onDismissRequest = { + viewModel.updateRecommendDialogVisibility(false) + } + ) + } else { + ScrapDialog( + title = title, + scrapColor = CalRed, + deadline = deadline, + startYearMonth = startYearMonth, + workingPeriod = workingPeriod, + internshipAnnouncementId = internshipAnnouncementId, + companyImage = companyImage, + isScrapped = isScrapped, + onDismissRequest = { + viewModel.updateRecommendDialogVisibility( + false + ) + }, + onClickChangeColor = { /*TODO*/ }, + onClickNavigateButton = navigateToIntern + ) + } + } + } + } } } else { item { @@ -281,87 +343,6 @@ fun HomeScreen( } } } -// -// if (homeDialogState.isScrapDialogVisible && !homeDialogState.isToday) { -// TerningBasicDialog( -// onDismissRequest = { -// viewModel.updateScrapDialogVisible(false) -// viewModel.updatePaletteOpen(false) -// }, -// content = { -// if (homeRecommendInternList[scrapId].scrapId != null) { -// ScrapCancelDialogContent( -// onClickScrapCancel = { -// viewModel.updateScrapDialogVisible(false) -// viewModel.deleteScrap( -// homeRecommendInternList[scrapId].scrapId ?: -1, -// ) -// if (homeDialogState.isScrappedState) { -// viewModel.getRecommendInternsData( -// currentSortBy.value, -// homeFilteringInfo.startYear, -// homeFilteringInfo.startMonth, -// ) -// viewModel.updateScrapped(false) -// } -// } -// ) -// } else { -// val colorList = listOf( -// CalRed, -// CalOrange1, -// CalOrange2, -// CalYellow, -// CalGreen1, -// CalGreen2, -// CalBlue1, -// CalBlue2, -// CalPurple, -// CalPink, -// ) -// -// val selectedColorIndex = -// colorList.indexOf(homeDialogState.selectedColor).takeIf { it >= 0 } ?: 0 -// -// with(homeRecommendInternList[scrapId]) { -// HomeRecommendInternDialog( -// internInfoList = listOf( -// stringResource(id = R.string.intern_info_d_day) to deadline, -// stringResource(id = R.string.intern_info_working) to workingPeriod, -// stringResource(id = R.string.intern_info_start_date) to startYearMonth, -// ), -// clickAction = { -// if (homeDialogState.isPaletteOpen) { -// viewModel.updatePaletteOpen(false) -// viewModel.updateColorChange(false) -// viewModel.updateScrapDialogVisible(false) -// } else { -// if (homeDialogState.isColorChange) { -// viewModel.updateColorChange(false) -// } -// viewModel.updateScrapDialogVisible(false) -// } -// viewModel.postScrap( -// homeRecommendInternList[scrapId].internshipAnnouncementId, -// selectedColorIndex, -// ) -// viewModel.updateScrapDialogVisible(false) -// if (homeDialogState.isScrappedState) { -// viewModel.getRecommendInternsData( -// currentSortBy.value, -// homeFilteringInfo.startYear, -// homeFilteringInfo.startMonth, -// ) -// viewModel.updateScrapped(false) -// } -// }, -// homeRecommendIntern = this, -// ) -// } -// } -// } -// ) -// } } @@ -407,7 +388,7 @@ private fun ShowMainTitleWithName(userName: String) { @Composable private fun ShowUpcomingIntern( homeUpcomingInternState: UiState>, - homeDialogState: HomeDialogState, + homeState: HomeState, navigateToIntern: (Long) -> Unit, ) { when (homeUpcomingInternState) { @@ -417,11 +398,12 @@ private fun ShowUpcomingIntern( } else { HomeUpcomingInternScreen( internList = homeUpcomingInternState.data, - homeDialogState = homeDialogState, + homeState = homeState, navigateToIntern = navigateToIntern ) } } + is UiState.Loading -> HomeUpcomingEmptyFilter() is UiState.Empty -> HomeUpcomingEmptyFilter() else -> {} diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt b/feature/src/main/java/com/terning/feature/home/home/HomeState.kt index 357cafa30..4b7cde0fb 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeState.kt @@ -12,4 +12,7 @@ data class HomeState( val homeFilteringInfoState: UiState = UiState.Loading, val homeUpcomingInternState: UiState> = UiState.Empty, val homeRecommendInternState: UiState = UiState.Loading, + val homeUpcomingDialogVisibility: Boolean = false, + val homeRecommendDialogVisibility: Boolean = false, + val homeInternModel: HomeUpcomingIntern? = null, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt index 6ed4cb328..b12d647b6 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt @@ -1,20 +1,16 @@ package com.terning.feature.home.home -import androidx.compose.ui.graphics.Color import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.terning.core.designsystem.theme.CalRed import com.terning.core.extension.currentMonth import com.terning.core.extension.currentYear import com.terning.core.state.UiState -import com.terning.domain.entity.calendar.CalendarScrapRequest import com.terning.core.type.SortBy +import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.domain.entity.request.ChangeFilteringRequestModel import com.terning.domain.repository.HomeRepository import com.terning.domain.repository.MyPageRepository -import com.terning.domain.repository.ScrapRepository import com.terning.feature.R -import com.terning.feature.home.home.model.HomeDialogState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow @@ -29,7 +25,6 @@ import javax.inject.Inject class HomeViewModel @Inject constructor( private val homeRepository: HomeRepository, private val myPageRepository: MyPageRepository, - private val scrapRepository: ScrapRepository, ) : ViewModel() { private val _homeState: MutableStateFlow = MutableStateFlow(HomeState()) val homeState get() = _homeState.asStateFlow() @@ -37,10 +32,6 @@ class HomeViewModel @Inject constructor( private val _homeSideEffect = MutableSharedFlow() val homeSideEffect get() = _homeSideEffect.asSharedFlow() - private val _homeDialogState: MutableStateFlow = - MutableStateFlow(HomeDialogState()) - val homeDialogState get() = _homeDialogState.asStateFlow() - init { getProfile() getFilteringInfo() @@ -65,7 +56,7 @@ class HomeViewModel @Inject constructor( } } - private fun getHomeUpcomingInternList() { + fun getHomeUpcomingInternList() { viewModelScope.launch { homeRepository.getHomeUpcomingInternList().onSuccess { internList -> _homeState.value = _homeState.value.copy( @@ -86,7 +77,7 @@ class HomeViewModel @Inject constructor( _homeState.value = _homeState.value.copy( homeFilteringInfoState = UiState.Success(filteringInfo) ) - if(filteringInfo.grade != null) { + if (filteringInfo.grade != null) { getHomeUpcomingInternList() getRecommendInternsData( sortBy = _homeState.value.sortBy.ordinal, @@ -125,99 +116,44 @@ class HomeViewModel @Inject constructor( } } - fun postScrap( - internshipAnnouncementId: Long, - colorIndex: Int, - ) { - viewModelScope.launch { - scrapRepository.postScrap( - CalendarScrapRequest( - id = internshipAnnouncementId, - color = colorIndex, - ) - ).onSuccess { - updateScrapDialogVisible(visible = false) - updateScrapped(scrapped = true) - updateSelectColor(CalRed) - getHomeUpcomingInternList() - getFilteringInfo() - _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.intern_scrap_add_toast_message)) - }.onFailure { - _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.server_failure)) - } + fun updateUpcomingDialogVisibility(visibility: Boolean) { + _homeState.update { + it.copy(homeUpcomingDialogVisibility = visibility) } } - fun deleteScrap(scrapId: Long) { - viewModelScope.launch { - scrapRepository.deleteScrap( - CalendarScrapRequest(id = scrapId) - ).onSuccess { - updateScrapDialogVisible(visible = false) - updateScrapped(scrapped = true) - getHomeUpcomingInternList() - getFilteringInfo() - _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.intern_scrap_delete_toast_message)) - }.onFailure { - _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.server_failure)) - } + fun updateRecommendDialogVisibility(visibility: Boolean) { + _homeState.update { + it.copy(homeRecommendDialogVisibility = visibility) } } - fun patchScrap( - scrapId: Long, - colorIndex: Int, + fun updateHomeInternModel( + internshipAnnouncementId: Long, + companyImage: String, + title: String, + dDay: String, + deadline: String, + workingPeriod: String, + isScrapped: Boolean, + color: String?, + startYearMonth: String, ) { - viewModelScope.launch { - scrapRepository.patchScrap( - CalendarScrapRequest( - id = scrapId, - color = colorIndex, + _homeState.update { + it.copy( + homeInternModel = + HomeUpcomingIntern( + internshipAnnouncementId = internshipAnnouncementId, + companyImage = companyImage, + title = title, + dDay = dDay, + deadline = deadline, + workingPeriod = workingPeriod, + isScrapped = isScrapped, + color = color ?: "", + startYearMonth = startYearMonth, ) - ).onSuccess { - updateScrapDialogVisible(visible = false) - updateScrapped(scrapped = true) - updateSelectColor(CalRed) - getHomeUpcomingInternList() - }.onFailure { - _homeSideEffect.emit(HomeSideEffect.ShowToast(R.string.server_failure)) - } - } - } - - fun updateSelectColor(newColor: Color) { - _homeDialogState.update { - it.copy(selectedColor = newColor) - } - } - - fun updateScrapDialogVisible(visible: Boolean) { - _homeDialogState.update { - it.copy(isScrapDialogVisible = visible) - } - } - - fun updateScrapped(scrapped: Boolean) { - _homeDialogState.update { - it.copy(isScrappedState = scrapped) - } - } - - fun updatePaletteOpen(open: Boolean) { - _homeDialogState.update { - it.copy(isPaletteOpen = open) - } - } - - fun updateColorChange(change: Boolean) { - _homeDialogState.update { - it.copy(isColorChange = change) - } - } - - fun updateIsToday(change: Boolean) { - _homeDialogState.update { - it.copy(isToday = change) + ) } } } \ No newline at end of file From e849735dc9cc8341e0d7b8fefd3fbb9b5e28f335 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Mon, 9 Sep 2024 22:45:29 +0900 Subject: [PATCH 30/36] =?UTF-8?q?[FEAT/#204]=20=EA=B3=A7=20=EB=A7=88?= =?UTF-8?q?=EA=B0=90=20=EA=B3=B5=EA=B3=A0=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20?= =?UTF-8?q?=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=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 --- .../bottomsheet/HomeFilteringBottomSheet.kt | 2 +- .../terning/feature/home/home/HomeRoute.kt | 4 +- .../component/HomeUpcomingInternScreen.kt | 83 +++++++------------ 3 files changed, 32 insertions(+), 57 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt index 6ee588e7a..8815fa5b2 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt @@ -126,7 +126,7 @@ fun HomeFilteringBottomSheet( DatePickerUI( chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, chosenMonth = defaultStartMonth?.minus(1) - ?: Calendar.getInstance().currentMonth, + ?: Calendar.getInstance().currentMonth.minus(1), onYearChosen = { currentStartYear = it }, onMonthChosen = { currentStartMonth = it }, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index 244cbc338..d6a74483a 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -59,7 +59,6 @@ import com.terning.feature.home.home.component.HomeRecommendEmptyIntern import com.terning.feature.home.home.component.HomeUpcomingEmptyFilter import com.terning.feature.home.home.component.HomeUpcomingEmptyIntern import com.terning.feature.home.home.component.HomeUpcomingInternScreen -import com.terning.feature.home.home.model.HomeDialogState import com.terning.feature.intern.navigation.navigateIntern import java.util.Calendar @@ -188,7 +187,6 @@ fun HomeScreen( startMonth = homeFilteringInfo.startMonth ?: Calendar.getInstance().currentMonth, ) - viewModel.getHomeUpcomingInternList() } } } @@ -307,6 +305,7 @@ fun HomeScreen( internshipAnnouncementId = internshipAnnouncementId, onDismissRequest = { viewModel.updateRecommendDialogVisibility(false) + viewModel.getHomeUpcomingInternList() } ) } else { @@ -323,6 +322,7 @@ fun HomeScreen( viewModel.updateRecommendDialogVisibility( false ) + viewModel.getHomeUpcomingInternList() }, onClickChangeColor = { /*TODO*/ }, onClickNavigateButton = navigateToIntern diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt index 4499c8c26..a0bdbf50c 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt @@ -34,7 +34,6 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import coil.compose.AsyncImage import coil.request.ImageRequest -import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.item.ScrapBox import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey150 @@ -45,19 +44,21 @@ import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.R +import com.terning.feature.dialog.detail.ScrapDialog +import com.terning.feature.home.home.HomeState import com.terning.feature.home.home.HomeViewModel -import com.terning.feature.home.home.model.HomeDialogState @Composable fun HomeUpcomingInternScreen( internList: List, - homeDialogState: HomeDialogState, + homeState: HomeState, navigateToIntern: (Long) -> Unit, homeViewModel: HomeViewModel = hiltViewModel() ) { - var selectedIndex by remember { - mutableStateOf(0) + var selectedInternItem: HomeUpcomingIntern? by remember { + mutableStateOf(null) } + LazyRow( horizontalArrangement = Arrangement.spacedBy(12.dp), contentPadding = PaddingValues(horizontal = 24.dp), @@ -79,16 +80,8 @@ fun HomeUpcomingInternScreen( modifier = Modifier .fillMaxHeight() .noRippleClickable { - homeViewModel.updateScrapDialogVisible(true) - homeViewModel.updateIsToday(true) - homeViewModel.updateSelectColor( - Color( - android.graphics.Color.parseColor( - internList[index].color - ) - ) - ) - selectedIndex = index + selectedInternItem = homeUpcomingIntern + homeViewModel.updateUpcomingDialogVisibility(true) }, verticalArrangement = Arrangement.SpaceBetween, ) { @@ -161,47 +154,29 @@ fun HomeUpcomingInternScreen( } } ) -// HomeTodayInternItem( -// homeUpcomingIntern = internList[index], -// modifier = Modifier -// .noRippleClickable { -// homeViewModel.updateScrapDialogVisible(true) -// homeViewModel.updateIsToday(true) -// homeViewModel.updateSelectColor( -// Color( -// android.graphics.Color.parseColor( -// internList[index].color -// ) -// ) -// ) -// selectedIndex = index -// } -// ) } } - if (homeDialogState.isScrapDialogVisible && homeDialogState.isToday) { - TerningBasicDialog( - onDismissRequest = { - homeViewModel.updateScrapDialogVisible(false) - homeViewModel.updatePaletteOpen(false) - }, - content = { - with(internList[selectedIndex]) { - HomeTodayInternDialog( - internInfoList = listOf( - stringResource(id = R.string.intern_info_d_day) to deadline, - stringResource(id = R.string.intern_info_working) to workingPeriod, - stringResource(id = R.string.intern_info_start_date) to startYearMonth, - ), - navigateTo = { - navigateToIntern(internshipAnnouncementId) - homeViewModel.updateScrapDialogVisible(false) - }, - homeUpcomingIntern = internList[selectedIndex], - ) - } - }, - ) + if (homeState.homeUpcomingDialogVisibility) { + val upcomingIntern = selectedInternItem + with(upcomingIntern) { + if (this != null) { + ScrapDialog( + title = title, + scrapColor = Color(android.graphics.Color.parseColor(color)), + deadline = deadline, + startYearMonth = startYearMonth, + workingPeriod = workingPeriod, + internshipAnnouncementId = internshipAnnouncementId, + companyImage = companyImage, + isScrapped = isScrapped, + onDismissRequest = { + homeViewModel.updateUpcomingDialogVisibility(false) + }, + onClickChangeColor = { }, + onClickNavigateButton = { navigateToIntern(internshipAnnouncementId) } + ) + } + } } } From a4b1cab4658f337da24c3c69896d6ad55d70066e Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Mon, 9 Sep 2024 22:45:47 +0900 Subject: [PATCH 31/36] =?UTF-8?q?[DELETE/#204]=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=99=88=20=EB=B7=B0=20=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeRecommendInternDialog.kt | 221 ---------------- .../home/component/HomeTodayInternDialog.kt | 249 ------------------ 2 files changed, 470 deletions(-) delete mode 100644 feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendInternDialog.kt delete mode 100644 feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendInternDialog.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendInternDialog.kt deleted file mode 100644 index 776cf9081..000000000 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendInternDialog.kt +++ /dev/null @@ -1,221 +0,0 @@ -package com.terning.feature.home.home.component - -import androidx.compose.foundation.background -import androidx.compose.foundation.border -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -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.size -import androidx.compose.foundation.layout.wrapContentSize -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Icon -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel -import androidx.lifecycle.compose.collectAsStateWithLifecycle -import coil.compose.AsyncImage -import coil.request.ImageRequest -import com.terning.core.R -import com.terning.core.designsystem.component.button.RoundButton -import com.terning.core.designsystem.component.item.ColorPalette -import com.terning.core.designsystem.theme.CalRed -import com.terning.core.designsystem.theme.Grey200 -import com.terning.core.designsystem.theme.Grey350 -import com.terning.core.designsystem.theme.Grey500 -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.extension.noRippleClickable -import com.terning.domain.entity.home.HomeRecommendIntern -import com.terning.feature.home.home.HomeViewModel -import com.terning.feature.intern.component.InternInfoRow - - -@Composable -fun HomeRecommendInternDialog( - internInfoList: List>, - clickAction: () -> Unit, - onColorSelected:(Color) -> Unit = {}, - homeRecommendIntern: HomeRecommendIntern, - viewModel: HomeViewModel = hiltViewModel(), -) { - val state by viewModel.homeDialogState.collectAsStateWithLifecycle() - - Box( - modifier = Modifier - .wrapContentSize() - .padding(top = 32.dp), - contentAlignment = Alignment.TopCenter - ) { - Column( - modifier = Modifier - .wrapContentSize() - .padding(horizontal = 11.dp), - horizontalAlignment = Alignment.CenterHorizontally - ) { - AsyncImage( - model = ImageRequest.Builder(LocalContext.current) - .data(homeRecommendIntern.companyImage) - .build(), - contentDescription = stringResource(R.string.image_content_descriptin), - modifier = Modifier - .size(80.dp) - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(size = 15.dp) - ) - .clip(RoundedCornerShape(size = 15.dp)), - contentScale = ContentScale.Fit, - alignment = Alignment.Center - ) - - Text( - text = homeRecommendIntern.title, - textAlign = TextAlign.Center, - style = TerningTheme.typography.title4, - color = Grey500, - modifier = Modifier.padding(top = 20.dp), - maxLines = 3, - overflow = TextOverflow.Ellipsis - ) - Text( - text = stringResource( - id = R.string.dialog_content_scrap_sub_title - ), - style = TerningTheme.typography.body5, - color = Grey350, - modifier = Modifier.padding( - top = 4.dp - ) - ) - Spacer(modifier = Modifier.height(26.dp)) - Column( - horizontalAlignment = Alignment.Start, - verticalArrangement = Arrangement.Top, - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 13.dp) - ) { - Row( - modifier = Modifier - .background( - color = state.selectedColor, - shape = RoundedCornerShape(14.dp) - ) - .noRippleClickable { - viewModel.updatePaletteOpen(!state.isPaletteOpen) - }, - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Start - ) { - Text( - text = stringResource(id = R.string.dialog_content_color_button), - style = TerningTheme.typography.body5, - color = White, - modifier = Modifier.padding( - start = 13.dp, - top = 5.dp, - bottom = 5.dp - ) - ) - Icon( - painter = painterResource( - id = if (state.isPaletteOpen) R.drawable.ic_up_22 - else R.drawable.ic_down_22 - ), - contentDescription = stringResource( - id = R.string.dialog_content_color_button - ), - tint = White, - modifier = Modifier.padding( - end = 7.dp - ) - ) - } - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier.padding( - top = 11.dp, - bottom = 8.dp - ) - ) - if (state.isPaletteOpen) { - Box( - modifier = Modifier - .fillMaxWidth() - .padding( - top = 12.dp, - bottom = 23.dp, - ), - contentAlignment = Alignment.Center - ) { - ColorPalette( - initialColor = CalRed, - onColorSelected = { newColor -> - viewModel.updateSelectColor(newColor) - onColorSelected(newColor) - } - ) - } - } else { - Text( - text = homeRecommendIntern.dDay, - style = TerningTheme.typography.body5, - color = TerningMain, - modifier = Modifier.padding(bottom = 9.dp) - ) - Column( - modifier = Modifier.padding(bottom = 29.dp), - verticalArrangement = Arrangement.spacedBy( - 5.dp, - Alignment.CenterVertically - ), - horizontalAlignment = Alignment.Start, - ) { - internInfoList.forEach { - InternInfoRow( - title = it.first, - value = it.second - ) - } - } - } - } - Box( - modifier = Modifier.fillMaxWidth(), - contentAlignment = Alignment.BottomCenter - ) { - RoundButton( - style = TerningTheme.typography.button3, - paddingVertical = 12.dp, - cornerRadius = 8.dp, - text = R.string.dialog_scrap_button, - onButtonClick = { - clickAction() - }, - modifier = Modifier.padding(bottom = 8.dp) - ) - } - } - } -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt deleted file mode 100644 index f7e72af2e..000000000 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeTodayInternDialog.kt +++ /dev/null @@ -1,249 +0,0 @@ -package com.terning.feature.home.home.component - -import androidx.compose.foundation.background -import androidx.compose.foundation.border -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -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.size -import androidx.compose.foundation.layout.wrapContentSize -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Icon -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel -import androidx.lifecycle.compose.collectAsStateWithLifecycle -import coil.compose.AsyncImage -import coil.request.ImageRequest -import com.terning.core.R -import com.terning.core.designsystem.component.button.RoundButton -import com.terning.core.designsystem.component.item.ColorPalette -import com.terning.core.designsystem.theme.CalBlue1 -import com.terning.core.designsystem.theme.CalBlue2 -import com.terning.core.designsystem.theme.CalGreen1 -import com.terning.core.designsystem.theme.CalGreen2 -import com.terning.core.designsystem.theme.CalOrange1 -import com.terning.core.designsystem.theme.CalOrange2 -import com.terning.core.designsystem.theme.CalPink -import com.terning.core.designsystem.theme.CalPurple -import com.terning.core.designsystem.theme.CalRed -import com.terning.core.designsystem.theme.CalYellow -import com.terning.core.designsystem.theme.Grey200 -import com.terning.core.designsystem.theme.Grey350 -import com.terning.core.designsystem.theme.Grey500 -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.extension.noRippleClickable -import com.terning.domain.entity.home.HomeUpcomingIntern -import com.terning.feature.home.home.HomeViewModel -import com.terning.feature.intern.component.InternInfoRow - - -@Composable -fun HomeTodayInternDialog( - internInfoList: List>, - navigateTo: () -> Unit, - homeUpcomingIntern: HomeUpcomingIntern, - viewModel: HomeViewModel = hiltViewModel(), -) { - val state by viewModel.homeDialogState.collectAsStateWithLifecycle() - - val colorList = listOf( - CalRed, - CalOrange1, - CalOrange2, - CalYellow, - CalGreen1, - CalGreen2, - CalBlue1, - CalBlue2, - CalPurple, - CalPink, - ) - Column( - modifier = Modifier - .wrapContentSize() - .padding(start = 11.dp, end = 11.dp, top = 32.dp), - horizontalAlignment = Alignment.CenterHorizontally - ) { - AsyncImage( - model = ImageRequest.Builder(LocalContext.current) - .data(homeUpcomingIntern.companyImage) - .build(), - contentDescription = stringResource(R.string.image_content_descriptin), - modifier = Modifier - .size(80.dp) - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(size = 15.dp) - ) - .clip(RoundedCornerShape(size = 15.dp)), - contentScale = ContentScale.Fit, - alignment = Alignment.Center - ) - - Text( - text = homeUpcomingIntern.title, - textAlign = TextAlign.Center, - style = TerningTheme.typography.title4, - color = Grey500, - modifier = Modifier.padding(top = 20.dp), - maxLines = 3, - overflow = TextOverflow.Ellipsis - ) - Text( - text = stringResource( - id = R.string.dialog_today_deadline - ), - style = TerningTheme.typography.body5, - color = Grey350, - modifier = Modifier.padding( - top = 4.dp - ) - ) - Spacer(modifier = Modifier.height(26.dp)) - Column( - horizontalAlignment = Alignment.Start, - verticalArrangement = Arrangement.Top, - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 13.dp) - ) { - Row( - modifier = Modifier - .background( - color = state.selectedColor, - shape = RoundedCornerShape(14.dp) - ) - .noRippleClickable { - viewModel.updatePaletteOpen(!state.isPaletteOpen) - }, - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Start - ) { - Text( - text = stringResource(id = R.string.dialog_content_color_button), - style = TerningTheme.typography.body5, - color = White, - modifier = Modifier.padding( - start = 13.dp, - top = 5.dp, - bottom = 5.dp - ) - ) - Icon( - painter = painterResource( - id = if (state.isPaletteOpen) R.drawable.ic_up_22 - else R.drawable.ic_down_22 - ), - contentDescription = stringResource( - id = R.string.dialog_content_color_button - ), - tint = White, - modifier = Modifier.padding( - end = 7.dp - ) - ) - } - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier.padding( - top = 11.dp, - bottom = 8.dp - ) - ) - if (state.isPaletteOpen) { - Box( - modifier = Modifier - .fillMaxWidth() - .padding( - top = 12.dp, - bottom = 23.dp, - ), - contentAlignment = Alignment.Center - ) { - ColorPalette( - initialColor = Color(android.graphics.Color.parseColor(homeUpcomingIntern.color)), - onColorSelected = { newColor -> - viewModel.updateSelectColor(newColor) - } - ) - } - } else { - Text( - text = homeUpcomingIntern.dDay, - style = TerningTheme.typography.body5, - color = TerningMain, - modifier = Modifier.padding(bottom = 9.dp) - ) - Column( - modifier = Modifier.padding(bottom = 29.dp), - verticalArrangement = Arrangement.spacedBy( - 5.dp, - Alignment.CenterVertically - ), - horizontalAlignment = Alignment.Start, - ) { - internInfoList.forEach { - InternInfoRow( - title = it.first, - value = it.second - ) - } - } - } - } - val selectedColorIndex = - colorList.indexOf(state.selectedColor).takeIf { it >= 0 } ?: 0 - - RoundButton( - style = TerningTheme.typography.button3, - paddingVertical = 12.dp, - cornerRadius = 8.dp, - text = if (state.isPaletteOpen) R.string.dialog_content_calendar_color_change else R.string.dialog_scrap_move_to_intern, - onButtonClick = { - if (state.isPaletteOpen) { - viewModel.updatePaletteOpen(false) - viewModel.updateColorChange(false) -// viewModel.patchScrap( -// scrapId = homeUpcomingIntern.scrapId, -// colorIndex = selectedColorIndex, -// ) - } else { - if (state.isColorChange) { - viewModel.updateColorChange(false) -// viewModel.patchScrap( -// scrapId = homeUpcomingIntern.scrapId, -// colorIndex = selectedColorIndex, -// ) - } - viewModel.updateScrapDialogVisible(false) - navigateTo() - } - }, - modifier = Modifier.padding(bottom = 8.dp) - ) - } -} - From f3ba7bcb1244d01eee86ca0b5bf9eca2b09e7123 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Tue, 10 Sep 2024 02:47:24 +0900 Subject: [PATCH 32/36] =?UTF-8?q?[MOD/#204]=20=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=ED=94=BC=EC=BB=A4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/feature/home/home/HomeRoute.kt | 2 +- .../home/home/component}/HomeFilteringBottomSheet.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) rename {core/src/main/java/com/terning/core/designsystem/component/bottomsheet => feature/src/main/java/com/terning/feature/home/home/component}/HomeFilteringBottomSheet.kt (96%) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index d6a74483a..fe6f18695 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -30,7 +30,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle import androidx.navigation.NavHostController import com.google.accompanist.systemuicontroller.rememberSystemUiController -import com.terning.core.designsystem.component.bottomsheet.HomeFilteringBottomSheet +import com.terning.feature.home.home.component.HomeFilteringBottomSheet import com.terning.core.designsystem.component.bottomsheet.SortingBottomSheet import com.terning.core.designsystem.component.button.SortingButton import com.terning.core.designsystem.component.image.TerningImage diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt similarity index 96% rename from core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt rename to feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt index 8815fa5b2..096c0952e 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/HomeFilteringBottomSheet.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt @@ -1,4 +1,4 @@ -package com.terning.core.designsystem.component.bottomsheet +package com.terning.feature.home.home.component import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -22,9 +22,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.terning.core.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.component.datepicker.DatePickerUI import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme @@ -32,6 +32,7 @@ import com.terning.core.extension.currentMonth import com.terning.core.extension.currentYear import com.terning.core.type.Grade import com.terning.core.type.WorkingPeriod +import com.terning.feature.filtering.filteringthree.component.YearMonthPicker import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @@ -123,14 +124,13 @@ fun HomeFilteringBottomSheet( .padding(top = 32.dp, bottom = 49.dp) ) - DatePickerUI( + YearMonthPicker( chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, chosenMonth = defaultStartMonth?.minus(1) ?: Calendar.getInstance().currentMonth.minus(1), onYearChosen = { currentStartYear = it }, - onMonthChosen = { currentStartMonth = it }, + onMonthChosen = { currentStartMonth = it } ) - RoundButton( style = TerningTheme.typography.button0, paddingVertical = 19.dp, From 27adb74d1590144315d70146546d5c9a9d8723e2 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Tue, 10 Sep 2024 02:53:23 +0900 Subject: [PATCH 33/36] =?UTF-8?q?[CHORE/#204]=20string=20=EC=B6=94?= =?UTF-8?q?=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/home/component/HomeFilteringScreen.kt | 2 +- feature/src/main/res/values/strings.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt index ea8677483..a3db7832b 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt @@ -98,7 +98,7 @@ fun HomeFilteringScreen( } } else { HomeFilteringInfoText( - text = "설정된 필터링 정보가 없어요", + text = stringResource(id = R.string.home_filtering_empty), modifier = Modifier .align(Alignment.CenterVertically), ) diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 60ae01709..3af17bc8b 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -88,6 +88,7 @@ 개의 공고가 있어요 + 설정된 필터링 정보가 없어요 기업 이미지 From 2c207d999f91271ffc9ce1f24ed9068223f2fbb5 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Tue, 10 Sep 2024 02:56:25 +0900 Subject: [PATCH 34/36] =?UTF-8?q?[CHORE/#204]=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=20=EB=B0=A9=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/core/designsystem/component/button/SortingButton.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt index ba860afe8..162e19b33 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt @@ -23,7 +23,7 @@ fun SortingButton( ) { Row( modifier = modifier - .noRippleClickable { onCLick() }, + .noRippleClickable(onCLick), ) { Text( text = stringResource( From 34f73a8070c92bfb6cf3e66468d23e6b9b6c3ef2 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Tue, 10 Sep 2024 02:58:07 +0900 Subject: [PATCH 35/36] =?UTF-8?q?[CHORE/#204]=20=EC=83=89=EC=83=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/home/home/component/HomeUpcomingEmptyIntern.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt index 0cca018db..601cb21aa 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt @@ -18,6 +18,7 @@ import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.Grey500 +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.extension.customShadow @@ -58,17 +59,17 @@ fun HomeUpcomingEmptyIntern( Card( colors = CardDefaults.cardColors(White), modifier = modifier - .padding(top = 7.dp, bottom = 27.dp) + .padding(top = 8.dp, bottom = 27.dp) .border( width = 1.dp, - color = Grey400, + color = TerningMain, shape = RoundedCornerShape(12.dp), ), ) { Text( text = stringResource(id = R.string.home_upcoming_check_schedule), style = TerningTheme.typography.button4, - color = Grey400, + color = TerningMain, modifier = modifier .padding(vertical = 8.dp, horizontal = 10.dp) ) From ec251578f859c94bc93e7a920279e8f4199ae464 Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Tue, 10 Sep 2024 03:04:43 +0900 Subject: [PATCH 36/36] =?UTF-8?q?[FEAT/#204]=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=BA=98=EB=A6=B0=EB=8D=94=EB=A1=9C=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/feature/home/home/HomeRoute.kt | 11 ++++++++--- .../home/home/component/HomeUpcomingEmptyIntern.kt | 5 ++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index fe6f18695..5cc35bf73 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -30,7 +30,6 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle import androidx.navigation.NavHostController import com.google.accompanist.systemuicontroller.rememberSystemUiController -import com.terning.feature.home.home.component.HomeFilteringBottomSheet import com.terning.core.designsystem.component.bottomsheet.SortingBottomSheet import com.terning.core.designsystem.component.button.SortingButton import com.terning.core.designsystem.component.image.TerningImage @@ -52,8 +51,10 @@ import com.terning.domain.entity.home.HomeFilteringInfo import com.terning.domain.entity.home.HomeRecommendIntern import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.R +import com.terning.feature.calendar.calendar.navigation.navigateCalendar import com.terning.feature.dialog.cancel.ScrapCancelDialog import com.terning.feature.dialog.detail.ScrapDialog +import com.terning.feature.home.home.component.HomeFilteringBottomSheet import com.terning.feature.home.home.component.HomeFilteringScreen import com.terning.feature.home.home.component.HomeRecommendEmptyIntern import com.terning.feature.home.home.component.HomeUpcomingEmptyFilter @@ -101,6 +102,7 @@ fun HomeRoute( HomeScreen( paddingValues = paddingValues, navigateToIntern = { navController.navigateIntern(announcementId = it) }, + navigateToCalendar = { navController.navigateCalendar() }, viewModel = viewModel, ) } @@ -110,6 +112,7 @@ fun HomeRoute( fun HomeScreen( paddingValues: PaddingValues, navigateToIntern: (Long) -> Unit, + navigateToCalendar: () -> Unit, viewModel: HomeViewModel, ) { val homeState by viewModel.homeState.collectAsStateWithLifecycle() @@ -221,7 +224,8 @@ fun HomeScreen( ShowUpcomingIntern( homeUpcomingInternState = homeState.homeUpcomingInternState, homeState = homeState, - navigateToIntern = { navigateToIntern(it) } + navigateToIntern = { navigateToIntern(it) }, + navigateToCalendar = navigateToCalendar, ) } } @@ -390,11 +394,12 @@ private fun ShowUpcomingIntern( homeUpcomingInternState: UiState>, homeState: HomeState, navigateToIntern: (Long) -> Unit, + navigateToCalendar: () -> Unit, ) { when (homeUpcomingInternState) { is UiState.Success -> { if (homeUpcomingInternState.data.isEmpty()) { - HomeUpcomingEmptyIntern() + HomeUpcomingEmptyIntern(navigateToCalendar = navigateToCalendar) } else { HomeUpcomingInternScreen( internList = homeUpcomingInternState.data, diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt index 601cb21aa..863488adc 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt @@ -22,11 +22,13 @@ 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.extension.customShadow +import com.terning.core.extension.noRippleClickable import com.terning.feature.R @Composable fun HomeUpcomingEmptyIntern( modifier: Modifier = Modifier, + navigateToCalendar: () -> Unit, ) { Column( modifier = modifier @@ -64,7 +66,8 @@ fun HomeUpcomingEmptyIntern( width = 1.dp, color = TerningMain, shape = RoundedCornerShape(12.dp), - ), + ) + .noRippleClickable(navigateToCalendar), ) { Text( text = stringResource(id = R.string.home_upcoming_check_schedule),