diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt index 0e8bd9667..f61ee5b81 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt @@ -98,7 +98,7 @@ fun TerningBasicTextField( decorationBox = { innerTextField -> Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(12.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.padding(vertical = 8.dp) ) { leftIcon?.let { diff --git a/core/src/main/java/com/terning/core/designsystem/component/topappbar/LogoTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/component/topappbar/LogoTopAppBar.kt deleted file mode 100644 index 68c144185..000000000 --- a/core/src/main/java/com/terning/core/designsystem/component/topappbar/LogoTopAppBar.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.terning.core.designsystem.component.topappbar - -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.material3.Icon -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalConfiguration -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp -import com.terning.core.R -import com.terning.core.designsystem.theme.TerningMain - -@Composable -fun LogoTopAppBar( - modifier: Modifier = Modifier -) { - val configuration = LocalConfiguration.current - val heightRatio = 780f / configuration.screenHeightDp - val widthRatio = 360f / configuration.screenWidthDp - - TerningBasicTopAppBar( - showBackButton = false, - actions = listOf { - Icon( - painter = painterResource(id = R.drawable.ic_terning_logo_typo), - contentDescription = stringResource(id = R.string.ic_logo), - tint = TerningMain, - modifier = Modifier - .padding(start = 24.dp, end = 16.dp, top = 16.dp) - .size(width = (109 * widthRatio).dp, height = (26 * heightRatio).dp) - ) - }, - modifier = modifier - ) -} diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 2e7984808..ce270cd8e 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -129,8 +129,12 @@ fun MainScreen( ) calendarNavGraph( paddingValues = paddingValues, - navHostController = navigator.navController) - searchNavGraph(navHostController = navigator.navController) + navHostController = navigator.navController + ) + searchNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) signInNavGraph( paddingValues = paddingValues, navHostController = navigator.navController @@ -159,7 +163,10 @@ fun MainScreen( paddingValues = paddingValues, navHostController = navigator.navController ) - searchProcessNavGraph(navHostController = navigator.navController) + searchProcessNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) internNavGraph( paddingValues = paddingValues, navHostController = navigator.navController 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 3d4b3f611..1088e226c 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 @@ -7,8 +7,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -20,10 +18,9 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle +import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.component.textfield.SearchTextField -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.core.state.UiState @@ -36,6 +33,7 @@ import okhttp3.internal.toImmutableList @Composable fun SearchRoute( + modifier: Modifier, navigateToSearchProcess: () -> Unit, navigateToIntern: (Long) -> Unit, viewModel: SearchViewModel = hiltViewModel(), @@ -72,6 +70,7 @@ fun SearchRoute( } SearchScreen( + modifier = modifier, searchViewsList = searchViewsList, searchScrapsList = searchScrapsList, navigateToSearchProcess = navigateToSearchProcess, @@ -94,66 +93,59 @@ fun SearchScreen( R.drawable.img_ad_3, ) - Scaffold( - modifier = modifier, - topBar = { - LogoTopAppBar() - } - ) { paddingValues -> - Column( + Column( + modifier = modifier + .fillMaxSize() + ) { + TerningImage( + painter = com.terning.core.R.drawable.ic_terning_logo_typo, modifier = Modifier - .fillMaxSize() - .padding(paddingValues) - ) { - Box( - modifier = Modifier - .padding( - horizontal = 24.dp, - vertical = 16.dp - ) - .noRippleClickable { - navigateToSearchProcess() - } - ) { - SearchTextField( - hint = stringResource(R.string.search_text_field_hint), - leftIcon = R.drawable.ic_nav_search, - modifier = Modifier.fillMaxWidth(), - enabled = false, - readOnly = true, + .padding(start = 24.dp, top = 16.dp) + ) + + Box( + modifier = Modifier + .padding( + horizontal = 24.dp, + vertical = 16.dp ) - } + .noRippleClickable { + navigateToSearchProcess() + } + ) { + SearchTextField( + hint = stringResource(R.string.search_text_field_hint), + leftIcon = R.drawable.ic_nav_search, + modifier = Modifier.fillMaxWidth(), + enabled = false, + readOnly = true, + ) + } - LazyColumn { - item { - ImageSlider(images = images) + LazyColumn { + item { + ImageSlider(images = images) - Spacer(modifier = Modifier.padding(8.dp)) + Spacer(modifier = Modifier.padding(top = 20.dp)) - Text( - text = stringResource(id = R.string.search_today_popular), - modifier = Modifier.padding(horizontal = 24.dp, vertical = 4.dp), - style = TerningTheme.typography.title1, - color = Black - ) - SearchInternList( - type = InternListType.VIEW, - searchViewsList = searchViewsList, - searchScrapsList = searchScrapsList, - navigateToIntern = navigateToIntern, - ) - HorizontalDivider( - thickness = 4.dp, - modifier = Modifier.padding(vertical = 8.dp), - color = Grey100, - ) - SearchInternList( - type = InternListType.SCRAP, - searchViewsList = searchViewsList, - searchScrapsList = searchScrapsList, - navigateToIntern = navigateToIntern, - ) - } + Text( + text = stringResource(id = R.string.search_today_popular), + modifier = Modifier.padding(horizontal = 24.dp, vertical = 4.dp), + style = TerningTheme.typography.title1, + color = Black + ) + SearchInternList( + type = InternListType.VIEW, + searchViewsList = searchViewsList, + searchScrapsList = searchScrapsList, + navigateToIntern = navigateToIntern, + ) + SearchInternList( + type = InternListType.SCRAP, + searchViewsList = searchViewsList, + searchScrapsList = searchScrapsList, + navigateToIntern = navigateToIntern, + ) } } } diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt index 5a0099763..8c489336c 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt @@ -2,6 +2,7 @@ package com.terning.feature.search.search.component import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyRow import androidx.compose.material3.Text @@ -21,7 +22,9 @@ fun SearchInternList( searchViewsList: List?, navigateToIntern: (Long) -> Unit, ) { - Column(modifier = Modifier.padding(horizontal = 24.dp)) { + Column( + modifier = Modifier.padding(horizontal = 24.dp) + ) { Text( text = stringResource( id = when (type) { @@ -29,12 +32,12 @@ fun SearchInternList( InternListType.SCRAP -> R.string.search_most_scrap_intern } ), - style = TerningTheme.typography.title5, + style = TerningTheme.typography.body3, color = Grey400 ) LazyRow( - modifier = Modifier.padding(vertical = 8.dp), + modifier = Modifier.padding(vertical = 12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp), ) { when (type) { @@ -61,5 +64,6 @@ fun SearchInternList( } } } + Spacer(modifier = Modifier.padding(top = 20.dp)) } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt b/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt index 98a5a730d..5d3c71809 100644 --- a/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt +++ b/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt @@ -2,6 +2,9 @@ package com.terning.feature.search.search.navigation import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.padding +import androidx.compose.ui.Modifier import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -22,6 +25,7 @@ fun NavController.navigateSearch(navOptions: NavOptions? = null) { fun NavGraphBuilder.searchNavGraph( navHostController: NavHostController, + paddingValues: PaddingValues, ) { composable( exitTransition = { @@ -38,6 +42,7 @@ fun NavGraphBuilder.searchNavGraph( } ) { SearchRoute( + modifier = Modifier.padding(paddingValues), navigateToSearchProcess = { navHostController.navigateSearchProcess() }, navigateToIntern = { announcementId -> navHostController.navigateIntern(announcementId) } ) 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 9d6e7f446..a9db28632 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 @@ -11,7 +11,6 @@ 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.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -25,7 +24,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester -import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.painterResource @@ -38,38 +36,31 @@ import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle import androidx.navigation.NavHostController -import com.terning.core.designsystem.component.dialog.ScrapCancelDialogContent +import com.terning.core.designsystem.component.button.SortingButton import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.item.InternItemWithShadow import com.terning.core.designsystem.component.textfield.SearchTextField import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar -import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.CalBlue1 -import com.terning.core.designsystem.theme.CalBlue2 -import com.terning.core.designsystem.theme.CalGreen1 -import com.terning.core.designsystem.theme.CalGreen2 -import com.terning.core.designsystem.theme.CalOrange1 -import com.terning.core.designsystem.theme.CalOrange2 -import com.terning.core.designsystem.theme.CalPink -import com.terning.core.designsystem.theme.CalPurple import com.terning.core.designsystem.theme.CalRed -import com.terning.core.designsystem.theme.CalYellow import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.addFocusCleaner import com.terning.core.extension.noRippleClickable import com.terning.core.extension.toast -import com.terning.domain.entity.home.HomeRecommendIntern +import com.terning.domain.entity.response.InternInfoModel import com.terning.feature.R -import com.terning.feature.home.home.component.HomeRecommendInternDialog +import com.terning.feature.dialog.cancel.ScrapCancelDialog +import com.terning.feature.dialog.detail.ScrapDialog import com.terning.feature.intern.navigation.navigateIntern private const val MAX_LINES = 1 @Composable fun SearchProcessRoute( + modifier: Modifier, navController: NavHostController, viewModel: SearchProcessViewModel = hiltViewModel(), ) { @@ -94,9 +85,20 @@ fun SearchProcessRoute( } SearchProcessScreen( + modifier = modifier, navController = navController, currentSortBy = currentSortBy, viewModel = viewModel, + onDismissCancelDialog = { + viewModel.updateScrapDialogVisible(false) + }, + onDismissScrapDialog = { viewModel.updateScrapDialogVisible(false) }, + onClickCancelButton = { + viewModel.updateScrapDialogVisible(true) + }, + onClickScrapButton = { + viewModel.updateScrapDialogVisible(true) + } ) } @@ -106,12 +108,16 @@ fun SearchProcessScreen( modifier: Modifier = Modifier, navController: NavHostController, viewModel: SearchProcessViewModel = hiltViewModel(), + onDismissCancelDialog: (Boolean) -> Unit, + onDismissScrapDialog: () -> Unit, + onClickCancelButton: (Long) -> Unit, + onClickScrapButton: (InternInfoModel) -> Unit, ) { val state by viewModel.state.collectAsStateWithLifecycle() var sheetState by remember { mutableStateOf(false) } val internSearchResultData by viewModel.internSearchResultData.collectAsStateWithLifecycle() val dialogState by viewModel.dialogState.collectAsStateWithLifecycle() - val selectedInternIndex = remember { mutableStateOf(-1) } + val selectedInternIndex = remember { mutableIntStateOf(-1) } val focusRequester = remember { FocusRequester() } val focusManager = LocalFocusManager.current @@ -129,254 +135,210 @@ fun SearchProcessScreen( ) } - Scaffold( - modifier = modifier, - topBar = { - BackButtonTopAppBar( - title = stringResource( - id = - if (state.showSearchResults) R.string.search_process_result_top_bar_title - else R.string.search_process_top_bar_title - ), - onBackButtonClick = { navController.navigateUp() }, - modifier = Modifier - ) - } - ) { paddingValues -> + Column( + modifier = modifier + .fillMaxSize() + .addFocusCleaner(focusManager), + ) { + BackButtonTopAppBar( + title = stringResource( + id = + if (state.showSearchResults) R.string.search_process_result_top_bar_title + else R.string.search_process_top_bar_title + ), + onBackButtonClick = { navController.navigateUp() }, + modifier = Modifier + ) Column( modifier = Modifier - .fillMaxSize() - .padding(paddingValues) - .addFocusCleaner(focusManager), + .padding(horizontal = 24.dp) ) { - Column( - modifier = modifier - .padding(horizontal = 24.dp) - ) { - if (!state.showSearchResults) { - Text( - text = stringResource(id = R.string.search_process_question_text), - style = TerningTheme.typography.heading2, - color = Black, - modifier = Modifier.padding( - vertical = 16.dp - ) + if (!state.showSearchResults) { + Text( + text = stringResource(id = R.string.search_process_question_text), + style = TerningTheme.typography.heading2, + color = Grey500, + modifier = Modifier.padding( + top = 14.dp, + bottom = 17.dp + ) + ) + } + + SearchTextField( + text = state.text, + onValueChange = { newText -> + viewModel.updateText(newText) + }, + hint = stringResource(R.string.search_text_field_hint), + leftIcon = R.drawable.ic_search_18, + modifier = Modifier + .focusRequester(focusRequester) + .addFocusCleaner(focusManager), + onSearchAction = { + viewModel.getSearchList( + keyword = state.text, + sortBy = SORT_BY, + page = 0, + size = 10 ) + viewModel.updateQuery(state.text) + viewModel.updateShowSearchResults(true) + viewModel.updateExistSearchResults(state.text) } + ) - SearchTextField( - text = state.text, - onValueChange = { newText -> - viewModel.updateText(newText) - }, - hint = stringResource(R.string.search_text_field_hint), - leftIcon = R.drawable.ic_nav_search, + if (state.showSearchResults) { + Column( modifier = Modifier - .padding(top = 8.dp) - .focusRequester(focusRequester) - .addFocusCleaner(focusManager), - onSearchAction = { - viewModel.getSearchList( - keyword = state.text, - sortBy = SORT_BY, - page = 0, - size = 10 - ) - viewModel.updateQuery(state.text) - viewModel.updateShowSearchResults(true) - viewModel.updateExistSearchResults(state.text) - } - ) - - if (state.showSearchResults) { - Column( + .fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center + ) { + Row( + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, modifier = Modifier - .fillMaxWidth(), - horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center + .fillMaxWidth() ) { - if (internSearchResultData.isNotEmpty()) { - LazyColumn( - contentPadding = PaddingValues( - top = 12.dp, - bottom = 20.dp, - ), - verticalArrangement = Arrangement.spacedBy(12.dp) - ) { - items(viewModel.internSearchResultData.value.size) { index -> - InternItemWithShadow( - modifier = modifier.noRippleClickable { - navController.navigateIntern( - announcementId = internSearchResultData[index] - .internshipAnnouncementId - ) - }, - imageUrl = internSearchResultData[index].companyImage, - title = internSearchResultData[index].title, - dateDeadline = internSearchResultData[index].dDay, - workingPeriod = internSearchResultData[index].workingPeriod, - isScrapped = internSearchResultData[index].scrapId != null, - shadowWidth = 2.dp, - shadowRadius = 10.dp, - onScrapButtonClicked = { - viewModel.updateScrapDialogVisible(true) - viewModel.updateScrapped(scrapped = internSearchResultData[index].scrapId != null) - selectedInternIndex.value = index - } - ) - } - } - } else { - Spacer( - modifier = Modifier.padding(top = 87.dp) + Row { + Text( + text = stringResource(id = R.string.search_process_total), + style = TerningTheme.typography.detail1, + color = Grey400, ) - Image( - painter = painterResource( - id = R.drawable.ic_empty_logo - ), - contentDescription = stringResource( - id = R.string.search_process_no_result_icon - ) + Spacer(modifier = Modifier.padding(start = 3.dp)) + Text( + text = internSearchResultData.size.toString(), + style = TerningTheme.typography.button3, + color = TerningMain, ) - Row( - modifier = Modifier - .padding( - top = 16.dp, - bottom = 6.dp - ) - .fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Center - ) { - Text( - text = state.keyword, - 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.wrapContentWidth() + Text( + text = stringResource(id = R.string.search_process_count), + style = TerningTheme.typography.detail1, + color = Grey400, + ) + } + Row { + SortingButton( + sortBy = currentSortBy.value, + onCLick = { sheetState = true }, + ) + } + } + if (internSearchResultData.isNotEmpty()) { + LazyColumn( + contentPadding = PaddingValues( + top = 12.dp, + bottom = 20.dp, + ), + verticalArrangement = Arrangement.spacedBy(12.dp) + ) { + items(viewModel.internSearchResultData.value.size) { index -> + InternItemWithShadow( + modifier = Modifier.noRippleClickable { + navController.navigateIntern( + announcementId = internSearchResultData[index] + .internshipAnnouncementId + ) + }, + imageUrl = internSearchResultData[index].companyImage, + title = internSearchResultData[index].title, + dateDeadline = internSearchResultData[index].dDay, + workingPeriod = internSearchResultData[index].workingPeriod, + isScrapped = internSearchResultData[index].scrapId != null, + shadowWidth = 2.dp, + shadowRadius = 10.dp, + onScrapButtonClicked = { + viewModel.updateScrapDialogVisible(true) + viewModel.updateScrapped( + scrapped = internSearchResultData[index].scrapId != null + ) + selectedInternIndex.intValue = index + } ) } + } + } else { + Spacer( + modifier = Modifier.padding(top = 40.dp) + ) + Image( + painter = painterResource( + id = R.drawable.ic_home_empty_filtering + ), + contentDescription = stringResource( + id = R.string.search_process_no_result_icon + ) + ) + Row( + modifier = Modifier + .padding( + top = 16.dp, + bottom = 6.dp + ) + .fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center + ) { + Text( + text = state.keyword, + style = TerningTheme.typography.title4, + color = TerningMain, + maxLines = MAX_LINES, + overflow = TextOverflow.Ellipsis, + modifier = Modifier.weight(1f, false) + ) Text( - text = stringResource( - id = R.string.search_process_no_result_text_main - ), + 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, + ) } } } - if (!state.showSearchResults) { - Image( - painter = painterResource(id = R.drawable.ic_search_backgroud), - contentDescription = null, - contentScale = ContentScale.FillWidth, - modifier = modifier.fillMaxSize() - ) - } } - } - - if (dialogState.isScrapDialogVisible) { - TerningBasicDialog( - onDismissRequest = { viewModel.updateScrapDialogVisible(false) }, - content = { - val selectedIndex = selectedInternIndex.value - if (selectedIndex != -1) { - val selectedIntern = internSearchResultData[selectedIndex] - if (selectedIntern.scrapId != null) { - ScrapCancelDialogContent( - onClickScrapCancel = { - viewModel.updateScrapDialogVisible(false) - viewModel.deleteScrap( - internSearchResultData[selectedIndex].scrapId ?: -1, - ) - if (dialogState.isScrappedState) { - viewModel.getSearchList( - keyword = state.text, - sortBy = SORT_BY, - page = 0, - size = 10 - ) - viewModel.updateScrapped(false) - } - viewModel.updateSelectColor(CalRed) - } - ) - } else { - val colorList = listOf( - CalRed, - CalOrange1, - CalOrange2, - CalYellow, - CalGreen1, - CalGreen2, - CalBlue1, - CalBlue2, - CalPurple, - CalPink, - ) - - val selectedColorIndex = - colorList.indexOf(dialogState.selectedColor).takeIf { it >= 0 } ?: 0 - with(selectedIntern) { - HomeRecommendInternDialog( - internInfoList = listOf( - stringResource(id = R.string.intern_info_d_day) to deadline, - stringResource(id = R.string.intern_info_working) to workingPeriod, - stringResource(id = R.string.intern_info_start_date) to startYearMonth, - ), - clickAction = { - if (dialogState.isPaletteOpen) { - viewModel.updatePaletteOpen(false) - viewModel.postScrap( - internshipAnnouncementId = internshipAnnouncementId, - selectedColorIndex, - ) - viewModel.updateColorChange(false) - viewModel.updateScrapDialogVisible(false) - } else { - if (dialogState.isColorChange) { - viewModel.postScrap( - internshipAnnouncementId, - selectedColorIndex - ) - viewModel.updateColorChange(false) - } else { - viewModel.postScrap(internshipAnnouncementId, colorList.indexOf(dialogState.selectedColor)) - } - viewModel.updateScrapDialogVisible(false) - } - }, - onColorSelected = { newColor -> - viewModel.updateSelectColor(newColor) - }, - homeRecommendIntern = HomeRecommendIntern( - scrapId = scrapId, - internshipAnnouncementId = internshipAnnouncementId, - companyImage = companyImage, - title = title, - deadline = deadline, - workingPeriod = workingPeriod, - startYearMonth = startYearMonth, - isScrapped = scrapId != null, - dDay = dDay - ), + if (dialogState.isScrapDialogVisible) { + TerningBasicDialog( + onDismissRequest = { viewModel.updateScrapDialogVisible(false) }, + content = { + val selectedIndex = selectedInternIndex.value + if (selectedIndex != -1) { + val selectedIntern = internSearchResultData[selectedIndex] + if (selectedIntern.scrapId != null) { + ScrapCancelDialog( + internshipAnnouncementId = selectedIntern.internshipAnnouncementId, + onDismissRequest = onDismissCancelDialog + ) + } else { + ScrapDialog( + title = selectedIntern.title, + scrapColor = CalRed, + deadline = selectedIntern.deadline, + startYearMonth = selectedIntern.startYearMonth, + workingPeriod = selectedIntern.workingPeriod, + internshipAnnouncementId = selectedIntern.internshipAnnouncementId, + companyImage = selectedIntern.companyImage, + isScrapped = false, + onDismissRequest = onDismissScrapDialog, + onClickChangeColor = { }, + onClickNavigateButton = { } ) } } } - } - ) + ) + } } } diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt index 8f8028280..bb8b7eae3 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt @@ -4,6 +4,7 @@ import androidx.compose.ui.graphics.Color import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.domain.entity.calendar.CalendarScrapRequest +import com.terning.domain.entity.response.InternInfoModel import com.terning.domain.entity.search.SearchResult import com.terning.domain.repository.ScrapRepository import com.terning.domain.repository.SearchRepository @@ -62,51 +63,6 @@ class SearchProcessViewModel @Inject constructor( } } - - fun postScrap( - internshipAnnouncementId: Long, - colorIndex: Int, - ) { - viewModelScope.launch { - scrapRepository.postScrap( - CalendarScrapRequest( - id = internshipAnnouncementId, - color = colorIndex, - ) - ).onSuccess { - updateScrapDialogVisible(visible = false) - getSearchList( - keyword = _state.value.text, - sortBy = SORT_BY, - page = 0, - size = 10 - ) - _sideEffect.emit(SearchProcessSideEffect.Toast(R.string.intern_scrap_add_toast_message)) - }.onFailure { - _sideEffect.emit(SearchProcessSideEffect.Toast(R.string.server_failure)) - } - } - } - - fun deleteScrap(scrapId: Long) { - viewModelScope.launch { - scrapRepository.deleteScrap( - CalendarScrapRequest(id = scrapId) - ).onSuccess { - updateScrapDialogVisible(visible = false) - getSearchList( - keyword = _state.value.text, - sortBy = SORT_BY, - page = 0, - size = 10 - ) - _sideEffect.emit(SearchProcessSideEffect.Toast(R.string.intern_scrap_delete_toast_message)) - }.onFailure { - _sideEffect.emit(SearchProcessSideEffect.Toast(R.string.server_failure)) - } - } - } - fun updateText(newText: String) { _state.value = _state.value.copy(text = newText) } @@ -126,12 +82,6 @@ class SearchProcessViewModel @Inject constructor( _state.value = _state.value.copy(existSearchResults = exist) } - fun updateSelectColor(newColor: Color) { - _dialogState.update { - it.copy(selectedColor = newColor) - } - } - fun updateScrapDialogVisible(visible: Boolean) { _dialogState.update { it.copy(isScrapDialogVisible = visible) @@ -144,18 +94,6 @@ class SearchProcessViewModel @Inject constructor( } } - fun updatePaletteOpen(open: Boolean) { - _dialogState.update { - it.copy(isPaletteOpen = open) - } - } - - fun updateColorChange(change: Boolean) { - _dialogState.update { - it.copy(isColorChange = change) - } - } - companion object { private const val SORT_BY = "deadlineSoon" } diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchDialogState.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchDialogState.kt index 54b86a329..aa78113d9 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchDialogState.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchDialogState.kt @@ -4,8 +4,6 @@ import androidx.compose.ui.graphics.Color import com.terning.core.designsystem.theme.CalRed data class SearchDialogState( - val isColorChange: Boolean = false, - val isPaletteOpen: Boolean = false, val selectedColor: Color = CalRed, val isScrapDialogVisible: Boolean = false, val scrapped: Boolean = false, diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt index c5355f915..e2dda0732 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt @@ -2,6 +2,9 @@ package com.terning.feature.search.searchprocess.navigation import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.padding +import androidx.compose.ui.Modifier import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -20,6 +23,7 @@ fun NavController.navigateSearchProcess(navOptions: NavOptions? = null) { fun NavGraphBuilder.searchProcessNavGraph( navHostController: NavHostController, + paddingValues: PaddingValues ) { composable( exitTransition = { @@ -36,7 +40,8 @@ fun NavGraphBuilder.searchProcessNavGraph( } ) { SearchProcessRoute( - navController = navHostController + modifier = Modifier.padding(paddingValues), + navController = navHostController, ) } } diff --git a/feature/src/main/res/drawable/ic_search_18.xml b/feature/src/main/res/drawable/ic_search_18.xml new file mode 100644 index 000000000..9700e7a17 --- /dev/null +++ b/feature/src/main/res/drawable/ic_search_18.xml @@ -0,0 +1,13 @@ + + + diff --git a/feature/src/main/res/drawable/ic_search_backgroud.xml b/feature/src/main/res/drawable/ic_search_backgroud.xml deleted file mode 100644 index 7369643f9..000000000 --- a/feature/src/main/res/drawable/ic_search_backgroud.xml +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/feature/src/main/res/drawable/ic_search_bg.xml b/feature/src/main/res/drawable/ic_search_bg.xml deleted file mode 100644 index 614b68a24..000000000 --- a/feature/src/main/res/drawable/ic_search_bg.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/feature/src/main/res/drawable/ic_search_empty.xml b/feature/src/main/res/drawable/ic_search_empty.xml new file mode 100644 index 000000000..32218db54 --- /dev/null +++ b/feature/src/main/res/drawable/ic_search_empty.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 3af17bc8b..f07b97a46 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -27,9 +27,9 @@ 관심있는 인턴 공고 키워드를 검색해 보세요 요즘 대학생들에게 인기 있는 공고 - 지금 조회수가 많은 공고들이에요 + 이번 주 가장 많이 조회한 공고예요 공고 이미지 - 지금 스크랩수가 많은 공고들이에요 + 이번 주 가장 많이 스크랩 한 공고예요 검색 @@ -38,6 +38,8 @@ 검색 결과 없을 때 아이콘 해당하는 검색 결과가 없어요 + + 개의 공고가 있어요 @@ -91,6 +93,8 @@ 설정된 필터링 정보가 없어요 기업 이미지 + - + 오늘 마감인 공고가 없어요 터치 3번으로\n원하는 대학생 인턴 공고를 띄워드릴게요