From 1cb7cd0c56a49dd7f84c81f31abb4961b505c358 Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 13 Jul 2024 05:51:40 +0900 Subject: [PATCH 1/9] =?UTF-8?q?[FIX/#64]=20=EC=8B=A4=ED=96=89=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/dialog/TerningBasicDialog.kt | 15 ------------ .../com/terning/feature/intern/InternRoute.kt | 14 +++++------ .../intern/component/InternCompanyInfo.kt | 1 - .../intern/component}/ScrapDialogContent.kt | 24 ++----------------- .../com/terning/feature/main/MainNavigator.kt | 3 ++- 5 files changed, 11 insertions(+), 46 deletions(-) rename {core/src/main/java/com/terning/core/designsystem/component/dialog => feature/src/main/java/com/terning/feature/intern/component}/ScrapDialogContent.kt (94%) diff --git a/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt b/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt index 02cdf1e00..96410be19 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt @@ -22,19 +22,4 @@ fun TerningBasicDialog( ) { content() } -} - -@Preview(showBackground = true, showSystemUi = true) -@Composable -fun TerningBasicDialogPreview() { - TerningBasicDialog( - onDismissRequest = {}, - content = { - ScrapDialogContent( - onDismissRequest = {}, - isScrapped = false, - internInfoList = listOf() - ) - } - ) } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 683a71389..9cd24ce64 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -37,6 +37,8 @@ import com.terning.feature.intern.component.InternInfoRow import com.terning.feature.intern.component.InternPageTitle import java.text.DecimalFormat +val DECIMAL_FORMAT = DecimalFormat("#,###") + @Composable fun InternRoute( navController: NavHostController, @@ -91,6 +93,8 @@ fun InternScreen( .padding(paddingValues) ) { item { + val decimal = DecimalFormat("#,###") + Column( modifier = modifier.padding( top = 24.dp, @@ -169,16 +173,14 @@ fun InternScreen( color = Grey400 ) Text( - text = stringResource( - id = R.string.intern_view_count_detail, - DecimalFormat(DECIMAL_FORMAT) - ), + text = stringResource(id = R.string.intern_view_count_detail), style = TerningTheme.typography.button3, color = Grey400, ) } } + Column( verticalArrangement = Arrangement.Top, ) { @@ -318,6 +320,4 @@ fun InternScreen( } } } -} - -const val DECIMAL_FORMAT = "#,###" \ No newline at end of file +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index 34f3b8830..f8b528224 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt @@ -45,7 +45,6 @@ fun InternCompanyInfo(modifier: Modifier) { Row( verticalAlignment = Alignment.CenterVertically, modifier = Modifier - .aspectRatio(1f) .size(60.dp) .border( width = 1.dp, diff --git a/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapDialogContent.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt similarity index 94% rename from core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapDialogContent.kt rename to feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt index aa6126363..b0763395a 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapDialogContent.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -1,4 +1,4 @@ -package com.terning.core.designsystem.component.dialog +package com.terning.feature.intern.component import androidx.compose.foundation.Image import androidx.compose.foundation.background @@ -236,24 +236,4 @@ fun ScrapDialogContent( } } } -} - -// TODO 삭제 -@Composable -fun InternInfoRow(title: String, value: String) { - Row( - horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.Start), - verticalAlignment = Alignment.Top, - ) { - Text( - text = title, - style = TerningTheme.typography.body2, - color = Grey350, - ) - Text( - text = value, - style = TerningTheme.typography.body3, - color = Grey500, - ) - } -} +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index b538c3e58..eb530d34d 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -11,6 +11,7 @@ import androidx.navigation.compose.rememberNavController import androidx.navigation.navOptions import com.terning.feature.calendar.navigation.navigateCalendar import com.terning.feature.home.home.navigation.navigateHome +import com.terning.feature.intern.navigation.Intern import com.terning.feature.mypage.navigation.navigateMyPage import com.terning.feature.onboarding.signin.navigation.SignIn import com.terning.feature.search.search.navigation.navigateSearch @@ -22,7 +23,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = SignIn + val startDestination = Intern val currentTab: MainTab? @Composable get() = MainTab.find { tab -> From 183b98e72a343d6d2c5e12a8a4bafecc189328b6 Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 13 Jul 2024 05:52:44 +0900 Subject: [PATCH 2/9] =?UTF-8?q?[DELETE/#64]=20decimal=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/intern/InternRoute.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 9cd24ce64..95f746903 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -37,8 +37,6 @@ import com.terning.feature.intern.component.InternInfoRow import com.terning.feature.intern.component.InternPageTitle import java.text.DecimalFormat -val DECIMAL_FORMAT = DecimalFormat("#,###") - @Composable fun InternRoute( navController: NavHostController, @@ -173,7 +171,7 @@ fun InternScreen( color = Grey400 ) Text( - text = stringResource(id = R.string.intern_view_count_detail), + text = "${decimal.format(100000)}회", style = TerningTheme.typography.button3, color = Grey400, ) From 44a52ca2cd3d393797c089b24dc78b832b1b4872 Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 13 Jul 2024 06:06:33 +0900 Subject: [PATCH 3/9] =?UTF-8?q?[FEAT/#64]=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=EC=BD=98=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20?= =?UTF-8?q?=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EB=9D=84?= =?UTF-8?q?=EC=9A=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 39 ++++++++++++++++++- .../intern/component/InternBottomBar.kt | 7 ++-- .../intern/component/ScrapDialogContent.kt | 1 - 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 95f746903..8fda0a5dd 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -15,12 +15,17 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold 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.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController +import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 @@ -35,6 +40,7 @@ import com.terning.feature.intern.component.InternBottomBar import com.terning.feature.intern.component.InternCompanyInfo import com.terning.feature.intern.component.InternInfoRow import com.terning.feature.intern.component.InternPageTitle +import com.terning.feature.intern.component.ScrapDialogContent import java.text.DecimalFormat @Composable @@ -51,6 +57,14 @@ fun InternScreen( modifier: Modifier = Modifier, navController: NavHostController, ) { + var isScrapDialogVisible by remember { mutableStateOf(false) } + var isScrapped by remember { mutableStateOf(false) } + val internInfoList = listOf( + stringResource(id = R.string.intern_info_d_day) to "2024년 7월 23일", + stringResource(id = R.string.intern_info_working) to "2개월", + stringResource(id = R.string.intern_info_start_date) to "2024년 8월" + ) + Scaffold( modifier = modifier, topBar = { @@ -60,7 +74,9 @@ fun InternScreen( color = Grey200, offsetY = 2.dp ), - onBackButtonClick = {}, + onBackButtonClick = { + navController.navigateUp() + }, listOf( {}, { @@ -83,8 +99,13 @@ fun InternScreen( ) }, bottomBar = { - InternBottomBar(modifier = modifier) + InternBottomBar( + modifier = modifier, + isScrap = isScrapped, + onScrapClick = { isScrapDialogVisible = true } + ) } + ) { paddingValues -> LazyColumn( modifier = modifier @@ -317,5 +338,19 @@ fun InternScreen( } } } + if (isScrapDialogVisible) { + TerningBasicDialog( + onDismissRequest = { + isScrapDialogVisible = false + }, + content = { + ScrapDialogContent( + onDismissRequest = { isScrapDialogVisible = false }, + isScrapped = isScrapped, + internInfoList = internInfoList + ) + } + ) + } } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt index c3ca6337f..42a124345 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt @@ -10,7 +10,6 @@ import androidx.compose.material3.Text 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.Alignment @@ -32,8 +31,9 @@ import com.terning.feature.R @Composable fun InternBottomBar( modifier: Modifier, + isScrap: Boolean, + onScrapClick: () -> Unit, ) { - var isScrap by remember { mutableStateOf(false) } var viewCount by remember { mutableIntStateOf(512) } Row( @@ -72,8 +72,7 @@ fun InternBottomBar( bottom = 6.dp ) .noRippleClickable { - isScrap = !isScrap - if (isScrap) viewCount += 1 else viewCount -= 1 + onScrapClick() }, tint = if (isScrap) TerningMain else Grey350 ) diff --git a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt index b0763395a..8d4a00682 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -96,7 +96,6 @@ fun ScrapDialogContent( ) { Row( modifier = Modifier - .aspectRatio(1f) .size(60.dp) .border( width = 1.dp, From 6ef753214bb1df731e61637e565743014edae2cc Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 13 Jul 2024 18:01:18 +0900 Subject: [PATCH 4/9] =?UTF-8?q?[FEAT/#64]=20ViewModel=EB=A1=9C=20Dialog=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 23 +++++------ .../terning/feature/intern/InternViewModel.kt | 38 +++++++++++++++++++ .../intern/component/InternBottomBar.kt | 16 +++++--- .../intern/component/ScrapDialogContent.kt | 35 ++++++++++------- .../feature/intern/model/InternScrapState.kt | 13 +++++++ 5 files changed, 94 insertions(+), 31 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/intern/InternViewModel.kt create mode 100644 feature/src/main/java/com/terning/feature/intern/model/InternScrapState.kt diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 8fda0a5dd..ccf750c0d 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -16,14 +16,13 @@ import androidx.compose.material3.Scaffold 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.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.NavHostController import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar @@ -56,9 +55,10 @@ fun InternRoute( fun InternScreen( modifier: Modifier = Modifier, navController: NavHostController, + viewModel: InternViewModel = hiltViewModel(), ) { - var isScrapDialogVisible by remember { mutableStateOf(false) } - var isScrapped by remember { mutableStateOf(false) } + val state by viewModel.state.collectAsStateWithLifecycle() + val internInfoList = listOf( stringResource(id = R.string.intern_info_d_day) to "2024년 7월 23일", stringResource(id = R.string.intern_info_working) to "2개월", @@ -101,8 +101,8 @@ fun InternScreen( bottomBar = { InternBottomBar( modifier = modifier, - isScrap = isScrapped, - onScrapClick = { isScrapDialogVisible = true } + isScrap = state.isScrapped, + onScrapClick = { viewModel.updateScrapDialogVisible(true) } ) } @@ -338,15 +338,16 @@ fun InternScreen( } } } - if (isScrapDialogVisible) { + if (state.isScrapDialogVisible) { TerningBasicDialog( onDismissRequest = { - isScrapDialogVisible = false + viewModel.updateScrapDialogVisible(false) }, content = { ScrapDialogContent( - onDismissRequest = { isScrapDialogVisible = false }, - isScrapped = isScrapped, + onDismissRequest = { + viewModel.updateScrapDialogVisible(false) + }, internInfoList = internInfoList ) } diff --git a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt new file mode 100644 index 000000000..ce1574f3b --- /dev/null +++ b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt @@ -0,0 +1,38 @@ +package com.terning.feature.intern + +import androidx.compose.ui.graphics.Color +import androidx.lifecycle.ViewModel +import com.terning.feature.intern.model.InternScrapState +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import javax.inject.Inject + +@HiltViewModel +class InternViewModel @Inject constructor() : ViewModel() { + private val _state: MutableStateFlow = + MutableStateFlow(InternScrapState()) + + val state: StateFlow get() = _state + + fun updateScrap(newScrap: Boolean) { + _state.value = _state.value.copy(isScrap = newScrap) + } + + fun updateSelectColor(newColor: Color) { + _state.value = _state.value.copy(selectedColor = newColor) + } + + fun updateScrapDialogVisible(visible: Boolean) { + _state.value = _state.value.copy(isScrapDialogVisible = visible) + } + + fun updateScrapped(scrapped: Boolean) { + _state.value = _state.value.copy(isScrapped = scrapped) + } + + fun updateColorChange(change: Boolean) { + _state.value = _state.value.copy(isColorChange = change) + } + +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt index 42a124345..e3d117c0a 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt @@ -1,6 +1,7 @@ package com.terning.feature.intern.component import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -9,14 +10,13 @@ import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.Grey350 @@ -27,14 +27,16 @@ import com.terning.core.designsystem.theme.White import com.terning.core.extension.customShadow import com.terning.core.extension.noRippleClickable import com.terning.feature.R +import com.terning.feature.intern.InternViewModel @Composable fun InternBottomBar( modifier: Modifier, isScrap: Boolean, onScrapClick: () -> Unit, + viewModel: InternViewModel = hiltViewModel(), ) { - var viewCount by remember { mutableIntStateOf(512) } + val state by viewModel.state.collectAsStateWithLifecycle() Row( modifier = modifier @@ -55,6 +57,7 @@ fun InternBottomBar( ) { Row( verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center ) { Column( modifier = modifier.padding(end = 14.dp), @@ -74,12 +77,13 @@ fun InternBottomBar( .noRippleClickable { onScrapClick() }, - tint = if (isScrap) TerningMain else Grey350 + tint = if (state.isScrapped) TerningMain + else Grey350 ) Text( text = stringResource( id = R.string.intern_view_count_detail, - viewCount + state.viewCount ), style = TerningTheme.typography.detail3, color = Grey400 diff --git a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt index 8d4a00682..8ebce687e 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -7,7 +7,6 @@ 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.aspectRatio import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -18,10 +17,9 @@ import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.MutableState 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.layout.ContentScale @@ -29,6 +27,8 @@ 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 androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.terning.core.R import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.component.item.ColorPalette @@ -43,16 +43,17 @@ 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.intern.InternViewModel @Composable fun ScrapDialogContent( onDismissRequest: () -> Unit, - isScrapped: Boolean, + isScrapped: MutableState = mutableStateOf(false), internInfoList: List>, + viewModel: InternViewModel = hiltViewModel(), ) { - var isColorChange by remember { mutableStateOf(false) } - var selectedColor by remember { mutableStateOf(CalRed) } + val state by viewModel.state.collectAsStateWithLifecycle() Box( modifier = Modifier @@ -144,18 +145,18 @@ fun ScrapDialogContent( Row( modifier = Modifier .background( - color = if (selectedColor != CalRed) CalBlue2 else CalGreen2, + color = if (state.selectedColor != CalRed) CalBlue2 else CalGreen2, shape = RoundedCornerShape(14.dp) ) .noRippleClickable { - isColorChange = !isColorChange + viewModel.updateColorChange(!state.isColorChange) }, verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { Icon( painter = painterResource( - id = if (isColorChange) R.drawable.ic_up_22 + id = if (state.isColorChange) R.drawable.ic_up_22 else R.drawable.ic_down_22 ), contentDescription = stringResource( @@ -183,7 +184,7 @@ fun ScrapDialogContent( bottom = 8.dp ) ) - if (isColorChange) { + if (state.isColorChange) { Box( modifier = Modifier .fillMaxWidth() @@ -195,7 +196,10 @@ fun ScrapDialogContent( ) { ColorPalette( initialColor = CalRed, - onColorSelected = { selectedColor = it }) + onColorSelected = { + viewModel.updateSelectColor(it) + }, + ) } } else { Text( @@ -222,14 +226,17 @@ fun ScrapDialogContent( style = TerningTheme.typography.button3, paddingVertical = 12.dp, cornerRadius = 8.dp, - text = if (isScrapped) { - if (isColorChange) + text = if (isScrapped.value) { + if (state.isColorChange) R.string.dialog_content_color_button else R.string.dialog_scrap_button } else { R.string.dialog_scrap_button }, - onButtonClick = { /*TODO*/ }, + onButtonClick = { + viewModel.updateScrapped(!state.isScrapped) + viewModel.updateScrapDialogVisible(false) + }, modifier = Modifier.padding(bottom = 8.dp) ) } diff --git a/feature/src/main/java/com/terning/feature/intern/model/InternScrapState.kt b/feature/src/main/java/com/terning/feature/intern/model/InternScrapState.kt new file mode 100644 index 000000000..0014aef71 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/intern/model/InternScrapState.kt @@ -0,0 +1,13 @@ +package com.terning.feature.intern.model + +import androidx.compose.ui.graphics.Color +import com.terning.core.designsystem.theme.CalRed + +data class InternScrapState( + val isScrap: Boolean = false, + val isColorChange: Boolean = false, + val selectedColor: Color = CalRed, + val isScrapDialogVisible: Boolean = false, + val isScrapped: Boolean = false, + val viewCount: Int = 0, +) \ No newline at end of file From bb5c396ba03e457f65738b02d17072166fcd33b6 Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 13 Jul 2024 19:03:33 +0900 Subject: [PATCH 5/9] =?UTF-8?q?[FEAT/#64]=20TerningBasicDialog=EC=97=90=20?= =?UTF-8?q?x=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/dialog/TerningBasicDialog.kt | 51 +++- .../com/terning/feature/intern/InternRoute.kt | 11 +- .../intern/component/ScrapDialogContent.kt | 277 ++++++++---------- 3 files changed, 175 insertions(+), 164 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt b/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt index 96410be19..94e230116 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/dialog/TerningBasicDialog.kt @@ -1,9 +1,27 @@ package com.terning.core.designsystem.component.dialog +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.runtime.Composable -import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties +import com.terning.core.R +import com.terning.core.designsystem.component.button.RoundButton +import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White +import com.terning.core.extension.noRippleClickable @Composable fun TerningBasicDialog( @@ -20,6 +38,35 @@ fun TerningBasicDialog( onDismissRequest = { onDismissRequest() }, properties = properties, ) { - content() + Box( + modifier = Modifier + .fillMaxWidth() + .wrapContentHeight() + .padding(30.dp) + .background( + color = White, + shape = RoundedCornerShape(20.dp) + ), + ) { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.End + ) { + IconButton( + onClick = { onDismissRequest() }, + modifier = Modifier + .padding(6.dp) + ) { + Icon( + painter = painterResource(id = R.drawable.ic_dialog_x_32), + contentDescription = null, + tint = Grey300, + modifier = Modifier + .noRippleClickable { onDismissRequest() } + ) + } + } + content() + } } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index ccf750c0d..4d4d10cd5 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -344,13 +344,10 @@ fun InternScreen( viewModel.updateScrapDialogVisible(false) }, content = { - ScrapDialogContent( - onDismissRequest = { - viewModel.updateScrapDialogVisible(false) - }, - internInfoList = internInfoList - ) - } +// ScrapDialogContent( +// internInfoList = internInfoList +// ) + }, ) } } diff --git a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt index 8ebce687e..f40508041 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -10,11 +10,9 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState @@ -36,7 +34,6 @@ import com.terning.core.designsystem.theme.CalBlue2 import com.terning.core.designsystem.theme.CalGreen2 import com.terning.core.designsystem.theme.CalRed import com.terning.core.designsystem.theme.Grey200 -import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey350 import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain @@ -48,7 +45,6 @@ import com.terning.feature.intern.InternViewModel @Composable fun ScrapDialogContent( - onDismissRequest: () -> Unit, isScrapped: MutableState = mutableStateOf(false), internInfoList: List>, viewModel: InternViewModel = hiltViewModel(), @@ -58,188 +54,159 @@ fun ScrapDialogContent( Box( modifier = Modifier .fillMaxWidth() - .wrapContentHeight() - .padding(30.dp) - .background( - color = White, - shape = RoundedCornerShape(20.dp) - ), + .padding(top = 32.dp), + contentAlignment = Alignment.TopCenter ) { - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.End + Column( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 11.dp), + horizontalAlignment = Alignment.CenterHorizontally ) { - IconButton( - onClick = { onDismissRequest() }, + Row( modifier = Modifier - .padding(6.dp) + .size(60.dp) + .border( + width = 1.dp, + color = TerningMain, + shape = RoundedCornerShape(size = 15.dp) + ) ) { - Icon( - painter = painterResource(id = R.drawable.ic_dialog_x_32), - contentDescription = null, - tint = Grey300, + Image( + painter = painterResource( + id = R.drawable.ic_character1 + ), modifier = Modifier - .noRippleClickable { onDismissRequest() } + .fillMaxWidth() + .background( + Grey200, + shape = RoundedCornerShape(size = 15.dp) + ), + contentDescription = null, + contentScale = ContentScale.Fit, + alignment = Alignment.Center ) } - } - Box( - modifier = Modifier - .fillMaxWidth() - .padding(top = 32.dp), - contentAlignment = Alignment.TopCenter - ) { + Text( + text = "[한양대학교 컬렉티브임팩트센터] /코이카 영프로페셔널(YP) 모집합니다", + textAlign = TextAlign.Center, + style = TerningTheme.typography.title4, + color = Grey500, + modifier = Modifier.padding(top = 20.dp) + ) + Text( + text = stringResource(id = R.string.dialog_content_scrap_sub_title), + style = TerningTheme.typography.body5, + color = Grey350, + modifier = Modifier.padding( + top = 4.dp, + bottom = 13.dp + ) + ) Column( + horizontalAlignment = Alignment.Start, + verticalArrangement = Arrangement.Top, modifier = Modifier .fillMaxWidth() - .padding(horizontal = 11.dp), - horizontalAlignment = Alignment.CenterHorizontally + .padding(horizontal = 13.dp) ) { Row( modifier = Modifier - .size(60.dp) - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(size = 15.dp) + .background( + color = if (state.selectedColor != CalRed) CalBlue2 else CalGreen2, + shape = RoundedCornerShape(14.dp) ) + .noRippleClickable { + viewModel.updateColorChange(!state.isColorChange) + }, + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Start ) { - Image( + Icon( painter = painterResource( - id = R.drawable.ic_character1 + id = if (state.isColorChange) R.drawable.ic_up_22 + else R.drawable.ic_down_22 ), - modifier = Modifier - .fillMaxWidth() - .background( - Grey200, - shape = RoundedCornerShape(size = 15.dp) - ), - contentDescription = null, - contentScale = ContentScale.Fit, - alignment = Alignment.Center + contentDescription = stringResource( + id = R.string.dialog_content_color_button + ), + tint = White, + modifier = Modifier.padding( + start = 7.dp, + top = 2.dp, + bottom = 2.dp + ) + ) + Text( + text = stringResource(id = R.string.dialog_content_color_button), + style = TerningTheme.typography.body5, + color = White, + modifier = Modifier.padding(end = 13.dp) ) } - Text( - text = "[한양대학교 컬렉티브임팩트센터] /코이카 영프로페셔널(YP) 모집합니다", - textAlign = TextAlign.Center, - style = TerningTheme.typography.title4, - color = Grey500, - modifier = Modifier.padding(top = 20.dp) - ) - Text( - text = stringResource(id = R.string.dialog_content_scrap_sub_title), - style = TerningTheme.typography.body5, - color = Grey350, + HorizontalDivider( + thickness = 1.dp, + color = Grey200, modifier = Modifier.padding( - top = 4.dp, - bottom = 13.dp + top = 11.dp, + bottom = 8.dp ) ) - Column( - horizontalAlignment = Alignment.Start, - verticalArrangement = Arrangement.Top, - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 13.dp) - ) { - Row( + if (state.isColorChange) { + Box( modifier = Modifier - .background( - color = if (state.selectedColor != CalRed) CalBlue2 else CalGreen2, - shape = RoundedCornerShape(14.dp) - ) - .noRippleClickable { - viewModel.updateColorChange(!state.isColorChange) - }, - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Start - ) { - Icon( - painter = painterResource( - id = if (state.isColorChange) R.drawable.ic_up_22 - else R.drawable.ic_down_22 - ), - contentDescription = stringResource( - id = R.string.dialog_content_color_button + .fillMaxWidth() + .padding( + top = 12.dp, + bottom = 23.dp, ), - tint = White, - modifier = Modifier.padding( - start = 7.dp, - top = 2.dp, - bottom = 2.dp - ) - ) - Text( - text = stringResource(id = R.string.dialog_content_color_button), - style = TerningTheme.typography.body5, - color = White, - modifier = Modifier.padding(end = 13.dp) + contentAlignment = Alignment.Center + ) { + ColorPalette( + initialColor = CalRed, + onColorSelected = { + viewModel.updateSelectColor(it) + }, ) } - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier.padding( - top = 11.dp, - bottom = 8.dp - ) + } else { + Text( + text = stringResource(id = R.string.intern_item_d_day), + style = TerningTheme.typography.body5, + color = TerningMain, + modifier = Modifier.padding(bottom = 9.dp) ) - if (state.isColorChange) { - Box( - modifier = Modifier - .fillMaxWidth() - .padding( - top = 12.dp, - bottom = 23.dp, - ), - contentAlignment = Alignment.Center - ) { - ColorPalette( - initialColor = CalRed, - onColorSelected = { - viewModel.updateSelectColor(it) - }, - ) - } - } else { - Text( - text = stringResource(id = R.string.intern_item_d_day), - 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 { (title, value) -> - InternInfoRow(title, value) - } + Column( + modifier = Modifier.padding(bottom = 29.dp), + verticalArrangement = Arrangement.spacedBy( + 5.dp, + Alignment.CenterVertically + ), + horizontalAlignment = Alignment.Start, + ) { + internInfoList.forEach { (title, value) -> + InternInfoRow(title, value) } } } - RoundButton( - style = TerningTheme.typography.button3, - paddingVertical = 12.dp, - cornerRadius = 8.dp, - text = if (isScrapped.value) { - if (state.isColorChange) - R.string.dialog_content_color_button - else R.string.dialog_scrap_button - } else { - R.string.dialog_scrap_button - }, - onButtonClick = { - viewModel.updateScrapped(!state.isScrapped) - viewModel.updateScrapDialogVisible(false) - }, - modifier = Modifier.padding(bottom = 8.dp) - ) } + RoundButton( + style = TerningTheme.typography.button3, + paddingVertical = 12.dp, + cornerRadius = 8.dp, + text = if (isScrapped.value) { + if (state.isColorChange) + R.string.dialog_content_color_button + else R.string.dialog_scrap_button + } else { + R.string.dialog_scrap_button + }, + onButtonClick = { + viewModel.updateScrapped(!state.isScrapped) + viewModel.updateScrapDialogVisible(false) + }, + modifier = Modifier.padding(bottom = 8.dp) + ) } } } \ No newline at end of file From 4e17704ea8e03a944ce138d773d013ea9cfb15af Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 13 Jul 2024 20:40:11 +0900 Subject: [PATCH 6/9] =?UTF-8?q?[FEAT/#64]=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20?= =?UTF-8?q?=EC=B7=A8=EC=86=8C=20=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/main/res/values/strings.xml | 3 + .../com/terning/feature/intern/InternRoute.kt | 10 +- .../intern/component/ScrapCancelDialog.kt | 106 ++++++++++++++++++ .../intern/component/ScrapDialogContent.kt | 3 +- 4 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/intern/component/ScrapCancelDialog.kt diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index dd2adcd9c..b8e415159 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -40,6 +40,9 @@ 공고를 캘린더에 스크랩하시겠어요? 색상 내 캘린더에 스크랩하기 + 관심 공고가 캘린더에서 사라져요! + 스크랩을 취소하시겠어요? + 스크랩 취소하기 서류 마감 diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 4d4d10cd5..acd2c8e53 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -39,6 +39,7 @@ import com.terning.feature.intern.component.InternBottomBar import com.terning.feature.intern.component.InternCompanyInfo import com.terning.feature.intern.component.InternInfoRow import com.terning.feature.intern.component.InternPageTitle +import com.terning.feature.intern.component.ScrapCancelDialogContent import com.terning.feature.intern.component.ScrapDialogContent import java.text.DecimalFormat @@ -344,9 +345,12 @@ fun InternScreen( viewModel.updateScrapDialogVisible(false) }, content = { -// ScrapDialogContent( -// internInfoList = internInfoList -// ) + when (state.isScrapped) { + true -> ScrapCancelDialogContent() + else -> ScrapDialogContent( + internInfoList = internInfoList + ) + } }, ) } diff --git a/feature/src/main/java/com/terning/feature/intern/component/ScrapCancelDialog.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapCancelDialog.kt new file mode 100644 index 000000000..cf1985347 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapCancelDialog.kt @@ -0,0 +1,106 @@ +package com.terning.feature.intern.component + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +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.layout.ContentScale +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 androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.terning.core.R +import com.terning.core.designsystem.component.button.RoundButton +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.feature.intern.InternViewModel + + +@Composable +fun ScrapCancelDialogContent( + viewModel: InternViewModel = hiltViewModel(), +) { + val state by viewModel.state.collectAsStateWithLifecycle() + + Box( + modifier = Modifier + .fillMaxWidth() + .padding(top = 60.dp), + contentAlignment = Alignment.TopCenter + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 11.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Row( + modifier = Modifier + .size(60.dp) + .border( + width = 1.dp, + color = TerningMain, + shape = RoundedCornerShape(size = 15.dp) + ) + ) { + Image( + painter = painterResource( + id = R.drawable.ic_character1 + ), + modifier = Modifier + .fillMaxWidth() + .background( + Grey200, + shape = RoundedCornerShape(size = 15.dp) + ), + contentDescription = null, + contentScale = ContentScale.Fit, + alignment = Alignment.Center + ) + } + Text( + text = stringResource(id = R.string.dialog_content_scrap_cancel_main_title), + textAlign = TextAlign.Center, + style = TerningTheme.typography.title4, + color = Grey500, + modifier = Modifier.padding(top = 21.dp) + ) + Text( + text = stringResource(id = R.string.dialog_content_scrap_cancel_sub_title), + style = TerningTheme.typography.body5, + color = Grey350, + modifier = Modifier.padding( + top = 5.dp, + bottom = 41.dp + ) + ) + RoundButton( + style = TerningTheme.typography.button3, + paddingVertical = 12.dp, + cornerRadius = 8.dp, + text = R.string.dialog_scrap_cancel_button, + onButtonClick = { + viewModel.updateScrapped(!state.isScrapped) + viewModel.updateScrapDialogVisible(false) + }, + modifier = Modifier.padding(bottom = 8.dp) + ) + } + } +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt index f40508041..df5576a84 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -45,7 +45,6 @@ import com.terning.feature.intern.InternViewModel @Composable fun ScrapDialogContent( - isScrapped: MutableState = mutableStateOf(false), internInfoList: List>, viewModel: InternViewModel = hiltViewModel(), ) { @@ -194,7 +193,7 @@ fun ScrapDialogContent( style = TerningTheme.typography.button3, paddingVertical = 12.dp, cornerRadius = 8.dp, - text = if (isScrapped.value) { + text = if (state.isScrapped) { if (state.isColorChange) R.string.dialog_content_color_button else R.string.dialog_scrap_button From 2dfb2cb44f6c9dd27957d58c71e425d724d54a21 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 14 Jul 2024 00:00:39 +0900 Subject: [PATCH 7/9] =?UTF-8?q?[FEAT/#64]=20=EA=B3=B5=EA=B3=A0=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A7=90=20=EC=A4=84?= =?UTF-8?q?=EC=9E=84=ED=91=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intern/component/InternCompanyInfo.kt | 10 ++-- .../com/terning/feature/main/MainNavigator.kt | 3 +- .../feature/search/search/SearchRoute.kt | 8 ++- .../searchprocess/SearchProcessRoute.kt | 56 +++++++++++++++---- feature/src/main/res/values/strings.xml | 5 +- 5 files changed, 60 insertions(+), 22 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index f8b528224..ed50ea608 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt @@ -5,12 +5,9 @@ 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.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.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -18,6 +15,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey300 @@ -25,6 +23,8 @@ import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R +private const val MAX_LINES = 2 + @Composable fun InternCompanyInfo(modifier: Modifier) { Row( @@ -78,7 +78,9 @@ fun InternCompanyInfo(modifier: Modifier) { text = "모니모니", style = TerningTheme.typography.title4, color = Black, - modifier = modifier.padding(top = 11.dp) + modifier = modifier.padding(top = 11.dp), + maxLines = MAX_LINES, + overflow = TextOverflow.Ellipsis ) Text( text = "스타트업", diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index eb530d34d..361fb6103 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -14,6 +14,7 @@ import com.terning.feature.home.home.navigation.navigateHome import com.terning.feature.intern.navigation.Intern import com.terning.feature.mypage.navigation.navigateMyPage import com.terning.feature.onboarding.signin.navigation.SignIn +import com.terning.feature.search.search.navigation.Search import com.terning.feature.search.search.navigation.navigateSearch class MainNavigator( @@ -23,7 +24,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = Intern + val startDestination = Search val currentTab: MainTab? @Composable get() = MainTab.find { tab -> diff --git a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt index bdda144ec..67e792d95 100644 --- a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -1,6 +1,5 @@ package com.terning.feature.search.search -import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -20,6 +19,7 @@ import com.terning.core.designsystem.component.topappbar.LogoTopAppBar import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey100 import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.extension.noRippleClickable import com.terning.feature.R import com.terning.feature.search.search.component.ImageSlider import com.terning.feature.search.search.component.InternListType @@ -63,7 +63,7 @@ fun SearchScreen( horizontal = 24.dp, vertical = 16.dp ) - .clickable { + .noRippleClickable { navController.navigateSearchProcess() } ) { @@ -80,7 +80,9 @@ fun SearchScreen( images = images ) - Spacer(modifier = Modifier.padding(8.dp)) + Spacer( + modifier = Modifier.padding(8.dp) + ) Text( text = stringResource(id = R.string.search_today_popular), diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt index 3736f0516..bd72fad4b 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt @@ -1,10 +1,13 @@ package com.terning.feature.search.searchprocess import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column 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.layout.wrapContentWidth import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -18,6 +21,7 @@ import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -33,6 +37,8 @@ import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.addFocusCleaner import com.terning.feature.R +private const val MAX_LINES = 1 + @Composable fun SearchProcessRoute( navController: NavHostController, @@ -76,7 +82,7 @@ fun SearchProcessScreen( .fillMaxSize() .padding(paddingValues) .padding(horizontal = 24.dp) - .addFocusCleaner(focusManager) + .addFocusCleaner(focusManager), ) { if (!state.showSearchResults) { Text( @@ -109,31 +115,57 @@ fun SearchProcessScreen( if (state.showSearchResults) { Column( modifier = Modifier - .fillMaxSize() + .fillMaxWidth() .padding(top = 87.dp), - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center ) { Image( - painter = painterResource(id = R.drawable.ic_nosearch), + painter = painterResource( + id = R.drawable.ic_nosearch + ), contentDescription = stringResource( id = R.string.search_process_no_result_icon ) ) Row( - modifier = Modifier.padding(vertical = 16.dp), - verticalAlignment = Alignment.CenterVertically + modifier = Modifier + .fillMaxWidth() + .padding( + top = 16.dp, + bottom = 6.dp + ), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center ) { + Row( + modifier = modifier.wrapContentWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center + ) { + Text( + text = state.query, + style = TerningTheme.typography.body1, + color = TerningMain, + maxLines = MAX_LINES, + overflow = TextOverflow.Ellipsis, + ) + } Text( - text = state.query, - style = TerningTheme.typography.body1, - color = TerningMain, - ) - Text( - text = stringResource(id = R.string.search_process_no_result_text), + text = stringResource(id = R.string.search_process_no_result_text_sub), style = TerningTheme.typography.body1, color = Grey400, + modifier = modifier.weight(1f) ) } + + Text( + text = stringResource( + id = R.string.search_process_no_result_text_main + ), + style = TerningTheme.typography.body1, + color = Grey400, + ) } } } diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 38941fb57..f4fb90a46 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -30,14 +30,15 @@ 요즘 대학생들에게 인기 있는 공고 지금 조회수가 많은 공고들이에요 - 지금 스크랩 수가 많은 공고들이에요 + 지금 스크랩수가 많은 공고들이에요 검색 어떤 공고를\n찾고 계시나요? 검색 결과 검색 결과 없을 때 아이콘 - 와 일치하는 검색 결과가 없어요 + + 해당하는 검색 결과가 없어요 From d7fe08b3189d701a57f97a498d5584df152fa643 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 14 Jul 2024 03:59:03 +0900 Subject: [PATCH 8/9] =?UTF-8?q?[FEAT/#64]=20=ED=83=90=EC=83=89=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=A7=90=20=EC=A4=84=EC=9E=84=ED=91=9C=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 --- .../com/terning/feature/intern/InternRoute.kt | 34 ++++++------------- .../searchprocess/SearchProcessRoute.kt | 28 ++++++--------- 2 files changed, 21 insertions(+), 41 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index b7aa49d68..198943c7a 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -4,37 +4,39 @@ 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.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold 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.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.NavHostController +import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 -import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.customShadow -import com.terning.core.extension.noRippleClickable import com.terning.feature.R import com.terning.feature.intern.component.InternBottomBar import com.terning.feature.intern.component.InternCompanyInfo import com.terning.feature.intern.component.InternInfoRow import com.terning.feature.intern.component.InternPageTitle +import com.terning.feature.intern.component.ScrapCancelDialogContent +import com.terning.feature.intern.component.ScrapDialogContent import java.text.DecimalFormat @Composable @@ -70,32 +72,15 @@ fun InternScreen( offsetY = 2.dp ), onBackButtonClick = {}, - listOf( - {}, - { - IconButton(onClick = {}) { - Icon( - painter = painterResource(id = R.drawable.ic_intern_share_22), - contentDescription = stringResource( - id = R.string.intern_share_icon - ), - modifier = modifier - .noRippleClickable { }, - tint = Grey300 - ) - } - }, - { - Spacer(modifier = modifier.padding(end = 8.dp)) - } - ) ) }, bottomBar = { InternBottomBar( modifier = modifier, isScrap = state.isScrapped, - onScrapClick = { viewModel.updateScrapDialogVisible(true) } + onScrapClick = { + viewModel.updateScrapDialogVisible(true) + } ) } ) { paddingValues -> @@ -145,6 +130,7 @@ fun InternScreen( bottom = 16.dp ) ) + Column( modifier = modifier .border( diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt index f359425cf..4bcedab18 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt @@ -130,35 +130,29 @@ fun SearchProcessScreen( ) Row( modifier = Modifier - .fillMaxWidth() .padding( top = 16.dp, bottom = 6.dp - ), + ) + .fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center ) { - Row( - modifier = modifier.wrapContentWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Center - ) { - Text( - text = state.query, - style = TerningTheme.typography.body1, - color = TerningMain, - maxLines = MAX_LINES, - overflow = TextOverflow.Ellipsis, - ) - } + Text( + text = state.query, + style = TerningTheme.typography.body1, + color = TerningMain, + maxLines = MAX_LINES, + overflow = TextOverflow.Ellipsis, + modifier = Modifier.weight(1f, false) + ) Text( text = stringResource(id = R.string.search_process_no_result_text_sub), style = TerningTheme.typography.body1, color = Grey400, - modifier = modifier.weight(1f) + modifier = Modifier.wrapContentWidth() ) } - Text( text = stringResource( id = R.string.search_process_no_result_text_main From 09fae6cd13af468b9849186a3307a087e464f89c Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 15 Jul 2024 17:53:47 +0900 Subject: [PATCH 9/9] =?UTF-8?q?[FIX/#64]=20=EA=B2=BD=EB=A1=9C=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 --- feature/src/main/java/com/terning/feature/main/MainNavigator.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index 361fb6103..f74336ff4 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -24,7 +24,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = Search + val startDestination = SignIn val currentTab: MainTab? @Composable get() = MainTab.find { tab ->