diff --git a/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapDialogContent.kt b/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapDialogContent.kt deleted file mode 100644 index aa6126363..000000000 --- a/core/src/main/java/com/terning/core/designsystem/component/dialog/ScrapDialogContent.kt +++ /dev/null @@ -1,259 +0,0 @@ -package com.terning.core.designsystem.component.dialog - -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.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 -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.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 -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.R -import com.terning.core.designsystem.component.button.RoundButton -import com.terning.core.designsystem.component.item.ColorPalette -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 -import com.terning.core.designsystem.theme.TerningTheme -import com.terning.core.designsystem.theme.White -import com.terning.core.extension.noRippleClickable - - -@Composable -fun ScrapDialogContent( - onDismissRequest: () -> Unit, - isScrapped: Boolean, - internInfoList: List>, -) { - var isColorChange by remember { mutableStateOf(false) } - var selectedColor by remember { mutableStateOf(CalRed) } - - 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() } - ) - } - } - Box( - modifier = Modifier - .fillMaxWidth() - .padding(top = 32.dp), - contentAlignment = Alignment.TopCenter - ) { - Column( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 11.dp), - horizontalAlignment = Alignment.CenterHorizontally - ) { - Row( - modifier = Modifier - .aspectRatio(1f) - .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 = "[한양대학교 컬렉티브임팩트센터] /코이카 영프로페셔널(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 = 13.dp) - ) { - Row( - modifier = Modifier - .background( - color = if (selectedColor != CalRed) CalBlue2 else CalGreen2, - shape = RoundedCornerShape(14.dp) - ) - .noRippleClickable { - isColorChange = !isColorChange - }, - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Start - ) { - Icon( - painter = painterResource( - id = if (isColorChange) 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( - 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) - ) - } - HorizontalDivider( - thickness = 1.dp, - color = Grey200, - modifier = Modifier.padding( - top = 11.dp, - bottom = 8.dp - ) - ) - if (isColorChange) { - Box( - modifier = Modifier - .fillMaxWidth() - .padding( - top = 12.dp, - bottom = 23.dp, - ), - contentAlignment = Alignment.Center - ) { - ColorPalette( - initialColor = CalRed, - onColorSelected = { selectedColor = 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) - } - } - } - } - RoundButton( - style = TerningTheme.typography.button3, - paddingVertical = 12.dp, - cornerRadius = 8.dp, - text = if (isScrapped) { - if (isColorChange) - R.string.dialog_content_color_button - else R.string.dialog_scrap_button - } else { - R.string.dialog_scrap_button - }, - onButtonClick = { /*TODO*/ }, - modifier = Modifier.padding(bottom = 8.dp) - ) - } - } - } -} - -// 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, - ) - } -} 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..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,21 +38,35 @@ fun TerningBasicDialog( onDismissRequest = { onDismissRequest() }, properties = properties, ) { - content() - } -} - -@Preview(showBackground = true, showSystemUi = true) -@Composable -fun TerningBasicDialogPreview() { - TerningBasicDialog( - onDismissRequest = {}, - content = { - ScrapDialogContent( - onDismissRequest = {}, - isScrapped = false, - internInfoList = listOf() - ) + 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/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 420e123d2..e1ba3f76b 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 5f8bcba53..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 @@ -50,7 +52,16 @@ fun InternRoute( fun InternScreen( modifier: Modifier = Modifier, navController: NavHostController, + viewModel: InternViewModel = hiltViewModel(), ) { + 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개월", + stringResource(id = R.string.intern_info_start_date) to "2024년 8월" + ) + Scaffold( modifier = modifier, topBar = { @@ -61,29 +72,16 @@ fun InternScreen( offsetY = 2.dp ), onBackButtonClick = {}, - actions = 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) + InternBottomBar( + modifier = modifier, + isScrap = state.isScrapped, + onScrapClick = { + viewModel.updateScrapDialogVisible(true) + } + ) } ) { paddingValues -> LazyColumn( @@ -91,6 +89,8 @@ fun InternScreen( .padding(paddingValues) ) { item { + val decimal = DecimalFormat("#,###") + Column( modifier = modifier.padding( top = 24.dp, @@ -130,6 +130,7 @@ fun InternScreen( bottom = 16.dp ) ) + Column( modifier = modifier .border( @@ -169,10 +170,7 @@ fun InternScreen( color = Grey400 ) Text( - text = stringResource( - id = R.string.intern_view_count_detail, - DecimalFormat(DECIMAL_FORMAT) - ), + text = "${decimal.format(100000)}회", style = TerningTheme.typography.button3, color = Grey400, ) @@ -317,6 +315,21 @@ fun InternScreen( } } } + if (state.isScrapDialogVisible) { + TerningBasicDialog( + onDismissRequest = { + viewModel.updateScrapDialogVisible(false) + }, + content = { + when (state.isScrapped) { + true -> ScrapCancelDialogContent() + else -> ScrapDialogContent( + 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 c3ca6337f..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,15 +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.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 com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.Grey350 @@ -28,13 +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 isScrap by remember { mutableStateOf(false) } - 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), @@ -72,15 +75,15 @@ fun InternBottomBar( bottom = 6.dp ) .noRippleClickable { - isScrap = !isScrap - if (isScrap) viewCount += 1 else viewCount -= 1 + 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/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index 34f3b8830..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( @@ -45,7 +45,6 @@ fun InternCompanyInfo(modifier: Modifier) { Row( verticalAlignment = Alignment.CenterVertically, modifier = Modifier - .aspectRatio(1f) .size(60.dp) .border( width = 1.dp, @@ -79,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/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 new file mode 100644 index 000000000..df5576a84 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -0,0 +1,211 @@ +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.Arrangement +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.HorizontalDivider +import androidx.compose.material3.Icon +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.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.component.item.ColorPalette +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.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.feature.intern.InternViewModel + + +@Composable +fun ScrapDialogContent( + internInfoList: List>, + viewModel: InternViewModel = hiltViewModel(), +) { + val state by viewModel.state.collectAsStateWithLifecycle() + + Box( + modifier = Modifier + .fillMaxWidth() + .padding(top = 32.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 = "[한양대학교 컬렉티브임팩트센터] /코이카 영프로페셔널(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 = 13.dp) + ) { + Row( + 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 + ), + 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) + ) + } + HorizontalDivider( + thickness = 1.dp, + color = Grey200, + modifier = Modifier.padding( + top = 11.dp, + bottom = 8.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) + } + } + } + } + RoundButton( + style = TerningTheme.typography.button3, + paddingVertical = 12.dp, + cornerRadius = 8.dp, + text = if (state.isScrapped) { + 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 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 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 642ac0a27..f74336ff4 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -11,9 +11,10 @@ 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.onboarding.signup.navigation.SignUp +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 = SignUp + val startDestination = SignIn 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 4cc94b38f..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 @@ -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,51 @@ 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 + .padding( + top = 16.dp, + bottom = 6.dp + ) + .fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center ) { 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), + text = stringResource(id = R.string.search_process_no_result_text_sub), style = TerningTheme.typography.body1, color = Grey400, + modifier = Modifier.wrapContentWidth() ) } + 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 c2c905668..649af8c14 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -31,14 +31,15 @@ 관심있는 인턴 공고 키워드를 검색해 보세요 요즘 대학생들에게 인기 있는 공고 지금 조회수가 많은 공고들이에요 - 지금 스크랩 수가 많은 공고들이에요 + 지금 스크랩수가 많은 공고들이에요 검색 어떤 공고를\n찾고 계시나요? 검색 결과 검색 결과 없을 때 아이콘 - 와 일치하는 검색 결과가 없어요 + + 해당하는 검색 결과가 없어요