diff --git a/core/designsystem/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt b/core/designsystem/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt index e76831d4..324962c8 100644 --- a/core/designsystem/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt +++ b/core/designsystem/src/main/java/com/terning/core/designsystem/component/button/SortingButton.kt @@ -1,17 +1,22 @@ package com.terning.core.designsystem.component.button -import androidx.compose.foundation.Image +import androidx.compose.foundation.border import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp import com.terning.core.designsystem.R import com.terning.core.designsystem.extension.noRippleClickable -import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey350 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.SortBy @@ -22,31 +27,36 @@ fun SortingButton( onCLick: () -> Unit, ) { Row( + verticalAlignment = Alignment.CenterVertically, modifier = modifier + .border( + width = 1.dp, + color = Grey350, + shape = RoundedCornerShape(5.dp) + ) .noRippleClickable(onCLick), ) { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_down_18), + contentDescription = stringResource(id = R.string.sort_button_description), + tint = Grey350, + modifier = Modifier + .padding( + start = 7.dp, + end = 6.dp, + top = 5.dp, + bottom = 5.dp, + ) + .size(20.dp) + ) Text( text = stringResource( id = SortBy.entries[sortBy].sortBy ), style = TerningTheme.typography.button3, - color = Black, - modifier = Modifier - .padding( - top = 6.dp, - bottom = 6.dp, - ) - ) - Image( - painter = painterResource(id = R.drawable.ic_down_18), - contentDescription = stringResource(id = R.string.sort_button_description), + color = Grey350, modifier = Modifier - .padding( - start = 2.dp, - end = 2.dp, - top = 6.dp, - bottom = 4.dp, - ) + .padding(end = 11.dp) ) } } diff --git a/core/designsystem/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt b/core/designsystem/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt index 96c370bc..73abbd37 100644 --- a/core/designsystem/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt +++ b/core/designsystem/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt @@ -16,7 +16,9 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity @@ -30,7 +32,9 @@ import coil3.compose.AsyncImage import coil3.request.ImageRequest import com.terning.core.designsystem.R import com.terning.core.designsystem.extension.noRippleClickable +import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.Grey350 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningPointTheme @@ -58,6 +62,7 @@ fun InternItem( isScraped: Boolean, modifier: Modifier = Modifier, scrapId: Long = 0, + isApplyClosed: Boolean = false, onScrapButtonClicked: (Long) -> Unit = {}, ) { Row( @@ -77,6 +82,10 @@ fun InternItem( .fillMaxHeight() .aspectRatio(1f) .clip(RoundedCornerShape(5.dp)) + .then( + if (isApplyClosed) Modifier.alpha(0.5f) + else Modifier + ) ) Column( @@ -87,11 +96,16 @@ fun InternItem( Text( text = dateDeadline, style = TerningTheme.typography.detail0, - color = if (dateDeadline == stringResource(id = R.string.intern_apply_closed)) Grey300 else TerningMain, + color = when { + isApplyClosed -> Grey350 + dateDeadline == stringResource(id = R.string.intern_apply_closed) -> Grey300 + else -> TerningMain + }, ) TwoLineHeightText( text = title, style = TerningTheme.typography.title5, + color = if (isApplyClosed) Grey350 else Black, ) @@ -103,13 +117,13 @@ fun InternItem( Text( text = stringResource(R.string.intern_item_working_period), style = TerningTheme.typography.detail3, - color = Grey400 + color = if (isApplyClosed) Grey350 else Grey400, ) Text( text = workingPeriod, style = TerningTheme.typography.detail3, - color = TerningMain, + color = if (isApplyClosed) Grey350 else TerningMain, modifier = Modifier.padding(start = 4.dp) ) @@ -143,6 +157,7 @@ fun InternItem( fun TwoLineHeightText( text: String, style: TextStyle, + color: Color = Black, ) { val twoLineHeight = with(LocalDensity.current) { (style.lineHeight.toDp() * 3) - style.fontSize.toDp() @@ -151,6 +166,7 @@ fun TwoLineHeightText( Text( text = text, style = style, + color = color, maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier diff --git a/core/designsystem/src/main/java/com/terning/core/designsystem/component/item/InternItemWithShadow.kt b/core/designsystem/src/main/java/com/terning/core/designsystem/component/item/InternItemWithShadow.kt index 7641408f..17e7adf6 100644 --- a/core/designsystem/src/main/java/com/terning/core/designsystem/component/item/InternItemWithShadow.kt +++ b/core/designsystem/src/main/java/com/terning/core/designsystem/component/item/InternItemWithShadow.kt @@ -21,6 +21,7 @@ fun InternItemWithShadow( dateDeadline: String, workingPeriod: String, isScrapped: Boolean, + isApplyClosed: Boolean = false, onScrapButtonClicked: (Long) -> Unit = {} ) { Box( @@ -41,6 +42,7 @@ fun InternItemWithShadow( dateDeadline = dateDeadline, workingPeriod = workingPeriod, isScraped = isScrapped, + isApplyClosed = isApplyClosed, onScrapButtonClicked = onScrapButtonClicked ) } diff --git a/data/home/src/main/java/com/terning/data/home/datasource/HomeDataSource.kt b/data/home/src/main/java/com/terning/data/home/datasource/HomeDataSource.kt index 21520cc7..0c255517 100644 --- a/data/home/src/main/java/com/terning/data/home/datasource/HomeDataSource.kt +++ b/data/home/src/main/java/com/terning/data/home/datasource/HomeDataSource.kt @@ -12,8 +12,6 @@ interface HomeDataSource { suspend fun getRecommendIntern( sortBy: String, - startYear: Int, - startMonth: Int ): BaseResponse suspend fun getFilteringInfo(): BaseResponse diff --git a/data/home/src/main/java/com/terning/data/home/datasourceimpl/HomeDataSourceImpl.kt b/data/home/src/main/java/com/terning/data/home/datasourceimpl/HomeDataSourceImpl.kt index cc73df1b..973151a6 100644 --- a/data/home/src/main/java/com/terning/data/home/datasourceimpl/HomeDataSourceImpl.kt +++ b/data/home/src/main/java/com/terning/data/home/datasourceimpl/HomeDataSourceImpl.kt @@ -18,13 +18,9 @@ class HomeDataSourceImpl @Inject constructor( override suspend fun getRecommendIntern( sortBy: String, - startYear: Int, - startMonth: Int ): BaseResponse = homeService.getRecommendIntern( sortBy = sortBy, - startYear = startYear, - startMonth = startMonth ) override suspend fun getFilteringInfo(): BaseResponse = diff --git a/data/home/src/main/java/com/terning/data/home/repositoryimpl/HomeRepositoryImpl.kt b/data/home/src/main/java/com/terning/data/home/repositoryimpl/HomeRepositoryImpl.kt index 8c01ea9c..d0677159 100644 --- a/data/home/src/main/java/com/terning/data/home/repositoryimpl/HomeRepositoryImpl.kt +++ b/data/home/src/main/java/com/terning/data/home/repositoryimpl/HomeRepositoryImpl.kt @@ -22,14 +22,10 @@ class HomeRepositoryImpl @Inject constructor( override suspend fun getRecommendIntern( sortBy: String, - startYear: Int, - startMonth: Int ): Result = runCatching { homeDataSource.getRecommendIntern( sortBy = sortBy, - startYear = startYear, - startMonth = startMonth ).result.toHomeRecommendInternList() } diff --git a/data/home/src/main/java/com/terning/data/home/service/HomeService.kt b/data/home/src/main/java/com/terning/data/home/service/HomeService.kt index 1215a33e..cc54844b 100644 --- a/data/home/src/main/java/com/terning/data/home/service/HomeService.kt +++ b/data/home/src/main/java/com/terning/data/home/service/HomeService.kt @@ -18,8 +18,6 @@ interface HomeService { @GET("api/v1/home") suspend fun getRecommendIntern( @Query("sortBy") sortBy: String, - @Query("startYear") startYear: Int, - @Query("startMonth") startMonth: Int, ): BaseResponse @GET("api/v1/filters") diff --git a/domain/home/src/main/java/com/terning/domain/home/repository/HomeRepository.kt b/domain/home/src/main/java/com/terning/domain/home/repository/HomeRepository.kt index e7b7f432..609212b3 100644 --- a/domain/home/src/main/java/com/terning/domain/home/repository/HomeRepository.kt +++ b/domain/home/src/main/java/com/terning/domain/home/repository/HomeRepository.kt @@ -10,8 +10,6 @@ interface HomeRepository { suspend fun getRecommendIntern( sortBy: String, - startYear: Int, - startMonth: Int ): Result suspend fun getFilteringInfo(): Result diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index 9cb4c1b5..eba443d2 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn @@ -26,7 +27,6 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle -import androidx.navigation.NavHostController import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.terning.core.analytics.EventType import com.terning.core.analytics.LocalTracker @@ -56,14 +56,13 @@ import com.terning.feature.home.component.HomeRecommendEmptyIntern import com.terning.feature.home.component.HomeUpcomingEmptyFilter import com.terning.feature.home.component.HomeUpcomingEmptyIntern import com.terning.feature.home.component.HomeUpcomingInternScreen +import okhttp3.internal.toImmutableList -const val NAME_START_LENGTH = 7 -const val NAME_END_LENGTH = 12 +const val NAME_MAX_LENGTH = 5 @Composable fun HomeRoute( paddingValues: PaddingValues, - navController: NavHostController, viewModel: HomeViewModel = hiltViewModel(), navigateToCalendar: () -> Unit, navigateToIntern: (Long) -> Unit @@ -86,6 +85,8 @@ fun HomeRoute( LaunchedEffect(key1 = true) { viewModel.getProfile() viewModel.getFilteringInfo() + viewModel.getRecommendInternsData(0) + viewModel.getHomeUpcomingInternList() } LaunchedEffect(viewModel.homeSideEffect, lifecycleOwner) { @@ -93,7 +94,6 @@ fun HomeRoute( .collect { sideEffect -> when (sideEffect) { is HomeSideEffect.ShowToast -> context.toast(sideEffect.message) - is HomeSideEffect.NavigateToHome -> navController.navigateUp() is HomeSideEffect.NavigateToCalendar -> navigateToCalendar() is HomeSideEffect.NavigateToIntern -> navigateToIntern(sideEffect.announcementId) } @@ -117,7 +117,8 @@ fun HomeRoute( viewModel.navigateCalendar() }, updateRecommendDialogVisibility = viewModel::updateRecommendDialogVisibility, - updateUpcomingDialogVisibility = viewModel::updateUpcomingDialogVisibility, + updateSortingSheetVisibility = viewModel::updateSortingSheetVisibility, + updateSortBy = viewModel::updateSortBy, getHomeUpcomingInternList = viewModel::getHomeUpcomingInternList, getRecommendInternsData = viewModel::getRecommendInternsData, viewModel = viewModel, @@ -131,9 +132,10 @@ fun HomeScreen( navigateToIntern: (Long) -> Unit, navigateToCalendar: () -> Unit, updateRecommendDialogVisibility: (Boolean) -> Unit, - updateUpcomingDialogVisibility: (Boolean) -> Unit, + updateSortingSheetVisibility: (Boolean) -> Unit, + updateSortBy: (Int) -> Unit, getHomeUpcomingInternList: () -> Unit, - getRecommendInternsData: (Int, Int?, Int?) -> Unit, + getRecommendInternsData: (Int) -> Unit, viewModel: HomeViewModel, ) { val homeState by viewModel.homeState.collectAsStateWithLifecycle() @@ -149,7 +151,7 @@ fun HomeScreen( } val homeRecommendInternList = when (homeState.homeRecommendInternState) { - is UiState.Success -> (homeState.homeRecommendInternState as UiState.Success).data.homeRecommendInternDetail + is UiState.Success -> (homeState.homeRecommendInternState as UiState.Success).data.homeRecommendInternDetail.toImmutableList() else -> listOf() } @@ -165,7 +167,7 @@ fun HomeScreen( if (homeState.sortingSheetVisibility) { SortingBottomSheet( onDismiss = { - viewModel.updateSortingSheetVisibility(false) + updateSortingSheetVisibility(false) }, currentSortBy = homeState.sortBy.ordinal, onSortChange = { sortBy -> @@ -179,11 +181,7 @@ fun HomeScreen( else -> "filtered_hits" } ) - viewModel.updateSortBy( - sortBy, - homeFilteringInfo.startYear, - homeFilteringInfo.startMonth, - ) + updateSortBy(sortBy) } ) } @@ -208,12 +206,6 @@ fun HomeScreen( ) } - LaunchedEffect(changeFilteringSheetState) { - if (!changeFilteringSheetState) { - viewModel.getFilteringInfo() - } - } - if (homeState.homeRecommendDialogVisibility) { with(homeState.homeInternModel) { if (this != null) { @@ -226,8 +218,6 @@ fun HomeScreen( getHomeUpcomingInternList() getRecommendInternsData( homeState.sortBy.ordinal, - homeFilteringInfo.startYear, - homeFilteringInfo.startMonth ) } } @@ -247,8 +237,6 @@ fun HomeScreen( if (isScrapped) { getRecommendInternsData( homeState.sortBy.ordinal, - homeFilteringInfo.startYear, - homeFilteringInfo.startMonth ) getHomeUpcomingInternList() } @@ -273,24 +261,18 @@ fun HomeScreen( ) LazyColumn( - contentPadding = PaddingValues( - top = 2.dp, - bottom = 20.dp, - ), + contentPadding = PaddingValues(bottom = 20.dp), verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier .fillMaxWidth(), ) { item { Column { - ShowMainTitleWithName(homeUserName) + ShowUpcomingTitle() ShowUpcomingIntern( homeUpcomingInternState = homeState.homeUpcomingInternState, - homeState = homeState, - navigateToIntern = { navigateToIntern(it) }, + navigateToIntern = navigateToIntern, navigateToCalendar = navigateToCalendar, - updateUpcomingDialogVisibility = updateUpcomingDialogVisibility, - getHomeUpcomingInternList = getHomeUpcomingInternList, ) } } @@ -299,18 +281,15 @@ fun HomeScreen( modifier = Modifier .background(White) ) { - ShowRecommendTitle() - ShowInternFilter( - homeFilteringInfo = homeFilteringInfo, - onChangeFilterClick = { changeFilteringSheetState = true }, - ) + ShowRecommendTitle(homeUserName) Row( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, modifier = Modifier .fillMaxWidth() - .padding(start = 24.dp, end = 18.dp), + .padding(horizontal = 24.dp) + .padding(top = 15.dp, bottom = 3.dp), ) { Row { Text( @@ -331,14 +310,16 @@ fun HomeScreen( color = Grey400, ) } - Row { - SortingButton( - sortBy = homeState.sortBy.ordinal, - onCLick = { viewModel.updateSortingSheetVisibility(true) }, - modifier = Modifier - .padding(vertical = 4.dp) - ) - } + Spacer(modifier = Modifier.weight(1f)) + SortingButton( + sortBy = homeState.sortBy.ordinal, + onCLick = { updateSortingSheetVisibility(true) }, + ) + HomeFilteringScreen( + onChangeFilterClick = { changeFilteringSheetState = true }, + modifier = Modifier + .padding(start = 8.dp) + ) } } } @@ -401,6 +382,7 @@ private fun RecommendInternItem( dateDeadline = intern.dDay, workingPeriod = intern.workingPeriod, isScrapped = intern.isScrapped, + isApplyClosed = (intern.dDay == stringResource(id = R.string.intern_apply_closed)), shadowRadius = 5.dp, shadowWidth = 1.dp, onScrapButtonClicked = onScrapButtonClicked, @@ -408,13 +390,9 @@ private fun RecommendInternItem( } @Composable -private fun ShowMainTitleWithName(userName: String) { +private fun ShowUpcomingTitle() { Text( - text = stringResource( - id = R.string.home_upcoming_title, - if (userName.length in NAME_START_LENGTH..NAME_END_LENGTH) "\n" + userName - else userName - ), + text = stringResource(id = R.string.home_upcoming_title), modifier = Modifier .padding( top = 2.dp, @@ -430,11 +408,8 @@ private fun ShowMainTitleWithName(userName: String) { @Composable private fun ShowUpcomingIntern( homeUpcomingInternState: UiState, - homeState: HomeState, navigateToIntern: (Long) -> Unit, navigateToCalendar: () -> Unit, - updateUpcomingDialogVisibility: (Boolean) -> Unit, - getHomeUpcomingInternList: () -> Unit, ) { when (homeUpcomingInternState) { is UiState.Success -> { @@ -446,11 +421,8 @@ private fun ShowUpcomingIntern( ) else -> HomeUpcomingInternScreen( - internList = homeUpcomingInternDetail, - homeState = homeState, - updateUpcomingDialogVisibility = updateUpcomingDialogVisibility, - getHomeUpcomingInternList = getHomeUpcomingInternList, - navigateToIntern = navigateToIntern + internList = homeUpcomingInternDetail.toImmutableList(), + navigateToIntern = navigateToIntern, ) } } @@ -461,9 +433,13 @@ private fun ShowUpcomingIntern( } @Composable -private fun ShowRecommendTitle() { +private fun ShowRecommendTitle(userName: String) { Text( - text = stringResource(id = R.string.home_recommend_main_title), + text = stringResource( + id = R.string.home_recommend_main_title, + userName, + if (userName.length > NAME_MAX_LENGTH) "\n" else " " + ), style = TerningTheme.typography.title1, color = Black, modifier = Modifier @@ -474,14 +450,3 @@ private fun ShowRecommendTitle() { ), ) } - -@Composable -private fun ShowInternFilter( - homeFilteringInfo: HomeFilteringInfo, - onChangeFilterClick: () -> Unit, -) { - HomeFilteringScreen( - homeFilteringInfo = homeFilteringInfo, - onChangeFilterClick = onChangeFilterClick, - ) -} diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeSideEffect.kt b/feature/home/src/main/java/com/terning/feature/home/HomeSideEffect.kt index 994850ee..6580073f 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeSideEffect.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeSideEffect.kt @@ -4,7 +4,6 @@ import androidx.annotation.StringRes sealed class HomeSideEffect { data class ShowToast(@StringRes val message: Int) : HomeSideEffect() - data object NavigateToHome : HomeSideEffect() data object NavigateToCalendar : HomeSideEffect() data class NavigateToIntern(val announcementId: Long) : HomeSideEffect() } \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeState.kt b/feature/home/src/main/java/com/terning/feature/home/HomeState.kt index de563b9b..1f0ca01c 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeState.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeState.kt @@ -13,7 +13,6 @@ data class HomeState( val homeFilteringInfoState: UiState = UiState.Loading, val homeUpcomingInternState: UiState = UiState.Empty, val homeRecommendInternState: UiState = UiState.Loading, - val homeUpcomingDialogVisibility: Boolean = false, val homeRecommendDialogVisibility: Boolean = false, val homeInternModel: HomeRecommendIntern.HomeRecommendInternDetail? = null, ) diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt index 801bea8b..06636e31 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt @@ -2,8 +2,6 @@ package com.terning.feature.home import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.terning.core.designsystem.extension.currentMonth -import com.terning.core.designsystem.extension.currentYear import com.terning.core.designsystem.state.UiState import com.terning.core.designsystem.type.SortBy import com.terning.domain.home.entity.ChangeFilteringRequestModel @@ -17,7 +15,6 @@ import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch -import java.util.Calendar import javax.inject.Inject @HiltViewModel @@ -31,12 +28,10 @@ class HomeViewModel @Inject constructor( private val _homeSideEffect = MutableSharedFlow() val homeSideEffect get() = _homeSideEffect.asSharedFlow() - fun getRecommendInternsData(sortBy: Int, startYear: Int?, startMonth: Int?) { + fun getRecommendInternsData(sortBy: Int) { viewModelScope.launch { homeRepository.getRecommendIntern( sortBy = SortBy.entries[sortBy].type, - startYear ?: Calendar.getInstance().currentYear, - startMonth ?: Calendar.getInstance().currentMonth, ).onSuccess { internList -> _homeState.value = _homeState.value.copy( homeRecommendInternState = UiState.Success(internList) @@ -71,14 +66,6 @@ class HomeViewModel @Inject constructor( _homeState.value = _homeState.value.copy( homeFilteringInfoState = UiState.Success(filteringInfo) ) - if (filteringInfo.grade != null) { - getRecommendInternsData( - sortBy = _homeState.value.sortBy.ordinal, - startYear = filteringInfo.startYear, - startMonth = filteringInfo.startMonth, - ) - getHomeUpcomingInternList() - } }.onFailure { exception: Throwable -> _homeState.value = _homeState.value.copy( homeFilteringInfoState = UiState.Failure(exception.toString()) @@ -97,7 +84,10 @@ class HomeViewModel @Inject constructor( year, month ) - ) + ).onSuccess { + getFilteringInfo() + getRecommendInternsData(_homeState.value.sortBy.ordinal) + } } } @@ -115,12 +105,6 @@ class HomeViewModel @Inject constructor( } } - fun updateUpcomingDialogVisibility(visibility: Boolean) { - _homeState.update { - it.copy(homeUpcomingDialogVisibility = visibility) - } - } - fun updateRecommendDialogVisibility(visibility: Boolean) { _homeState.update { it.copy(homeRecommendDialogVisibility = visibility) @@ -156,7 +140,7 @@ class HomeViewModel @Inject constructor( } } - fun updateSortBy(sortBy: Int, startYear: Int?, startMonth: Int?) { + fun updateSortBy(sortBy: Int) { _homeState.update { it.copy( sortBy = SortBy.entries[sortBy] @@ -164,8 +148,6 @@ class HomeViewModel @Inject constructor( } getRecommendInternsData( _homeState.value.sortBy.ordinal, - startYear ?: Calendar.getInstance().currentYear, - startMonth ?: Calendar.getInstance().currentMonth, ) } diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringScreen.kt index cbac1746..f5dfa67b 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringScreen.kt @@ -1,23 +1,14 @@ package com.terning.feature.home.component -import androidx.compose.foundation.background import androidx.compose.foundation.border -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign @@ -25,125 +16,52 @@ import androidx.compose.ui.unit.dp import com.terning.core.analytics.EventType import com.terning.core.analytics.LocalTracker import com.terning.core.designsystem.extension.noRippleClickable -import com.terning.core.designsystem.theme.Grey350 -import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme -import com.terning.core.designsystem.type.Grade -import com.terning.core.designsystem.type.WorkingPeriod -import com.terning.domain.home.entity.HomeFilteringInfo import com.terning.feature.home.R @Composable fun HomeFilteringScreen( - homeFilteringInfo: HomeFilteringInfo, onChangeFilterClick: () -> Unit, modifier: Modifier = Modifier, ) { + val amplitudeTracker = LocalTracker.current + Row( - modifier = modifier - .padding(horizontal = 24.dp, vertical = 12.dp) - .height(IntrinsicSize.Min) - .fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, - ) { - val amplitudeTracker = LocalTracker.current - - Row( - modifier = Modifier - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(5.dp) - ) - .align(Alignment.CenterVertically) - .noRippleClickable { - amplitudeTracker.track( - type = EventType.CLICK, - name = "home_filtering" - ) - onChangeFilterClick() - }, - ) { - Icon( - painter = painterResource(id = R.drawable.ic_home_filtering_28), - contentDescription = stringResource(id = R.string.home_recommend_filtering), - modifier = modifier - .padding( - start = 2.dp, - top = 2.dp, - bottom = 2.dp, - ), - tint = TerningMain, - ) - Text( - text = stringResource(id = R.string.home_recommend_filtering), - style = TerningTheme.typography.button3, + modifier = modifier + .border( + width = 1.dp, color = TerningMain, - textAlign = TextAlign.Center, - modifier = Modifier - .padding(start = 5.dp, end = 11.dp) - .align(Alignment.CenterVertically), + shape = RoundedCornerShape(5.dp) ) - } - with(homeFilteringInfo) { - if (grade != null) { - Row( - verticalAlignment = Alignment.CenterVertically, - ) { - HomeFilteringInfoText( - text = stringResource(id = Grade.fromString(grade).stringResId), - modifier = Modifier - .padding(end = 6.dp), - ) - HomeFilteringInfoDivider() - HomeFilteringInfoText( - text = stringResource(WorkingPeriod.fromString(workingPeriod).stringResId), - modifier = Modifier - .padding(horizontal = 6.dp), - ) - HomeFilteringInfoDivider() - HomeFilteringInfoText( - text = stringResource( - id = R.string.home_recommend_filtering_startYearMonth, - startYear.toString(), - startMonth.toString() - ), - modifier = Modifier - .padding(start = 6.dp), - ) - } - } else { - HomeFilteringInfoText( - text = stringResource(id = R.string.home_filtering_empty), - modifier = Modifier - .align(Alignment.CenterVertically), + .noRippleClickable { + amplitudeTracker.track( + type = EventType.CLICK, + name = "home_filtering" ) - } - } + onChangeFilterClick() + }, + ) { + Icon( + painter = painterResource(id = R.drawable.ic_home_filtering_28), + contentDescription = stringResource(id = R.string.home_recommend_filtering), + modifier = Modifier + .padding( + start = 2.dp, + top = 1.dp, + bottom = 1.dp, + ), + tint = TerningMain, + ) + Text( + text = stringResource(id = R.string.home_recommend_filtering), + style = TerningTheme.typography.button3, + color = TerningMain, + textAlign = TextAlign.Center, + modifier = Modifier + .padding(start = 5.dp, end = 11.dp) + .align(Alignment.CenterVertically), + ) } } - -@Composable -private fun HomeFilteringInfoText( - text: String, - modifier: Modifier = Modifier -) { - Text( - text = text, - style = TerningTheme.typography.body5, - color = Grey400, - modifier = modifier, - ) -} - -@Composable -private fun HomeFilteringInfoDivider() { - Box( - modifier = Modifier - .size(4.dp) - .clip(CircleShape) - .background(Grey350), - ) -} \ No newline at end of file diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt index 8562ccaa..eb9896ea 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt @@ -51,15 +51,8 @@ import com.terning.feature.home.R @Composable fun HomeUpcomingInternScreen( internList: List, - homeState: HomeState, navigateToIntern: (Long) -> Unit, - updateUpcomingDialogVisibility: (Boolean) -> Unit, - getHomeUpcomingInternList: () -> Unit, ) { - var selectedInternItem: HomeUpcomingIntern.HomeUpcomingInternDetail? by remember { - mutableStateOf(null) - } - val amplitudeTracker = LocalTracker.current LazyRow( @@ -90,8 +83,7 @@ fun HomeUpcomingInternScreen( type = EventType.CLICK, name = "remind_intern_card" ) - selectedInternItem = homeUpcomingIntern - updateUpcomingDialogVisibility(true) + navigateToIntern(homeUpcomingIntern.internshipAnnouncementId) }, verticalArrangement = Arrangement.SpaceBetween, ) { @@ -165,25 +157,4 @@ fun HomeUpcomingInternScreen( ) } } - - if (homeState.homeUpcomingDialogVisibility) { - val upcomingIntern = selectedInternItem - with(upcomingIntern) { - if (this != null) { - ScrapDialog( - title = title, - scrapColor = Color(android.graphics.Color.parseColor(color)), - deadline = deadline, - startYearMonth = startYearMonth, - workingPeriod = workingPeriod, - internshipAnnouncementId = internshipAnnouncementId, - companyImage = companyImage, - isScrapped = isScrapped, - onDismissRequest = { updateUpcomingDialogVisibility(false) }, - onClickChangeColor = getHomeUpcomingInternList, - onClickNavigateButton = { navigateToIntern(internshipAnnouncementId) } - ) - } - } - } } diff --git a/feature/home/src/main/java/com/terning/feature/home/navigation/HometNavigation.kt b/feature/home/src/main/java/com/terning/feature/home/navigation/HometNavigation.kt index 217d4cd8..57996f9e 100644 --- a/feature/home/src/main/java/com/terning/feature/home/navigation/HometNavigation.kt +++ b/feature/home/src/main/java/com/terning/feature/home/navigation/HometNavigation.kt @@ -1,11 +1,8 @@ package com.terning.feature.home.navigation -import androidx.compose.animation.EnterTransition -import androidx.compose.animation.ExitTransition import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder -import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.MainTabRoute @@ -21,27 +18,12 @@ fun NavController.navigateHome(navOptions: NavOptions? = null) { fun NavGraphBuilder.homeNavGraph( paddingValues: PaddingValues, - navHostController: NavHostController, navigateToCalendar: () -> Unit, - navigateToIntern:(Long)-> Unit + navigateToIntern: (Long) -> Unit ) { - composable( - exitTransition = { - ExitTransition.None - }, - popEnterTransition = { - EnterTransition.None - }, - enterTransition = { - EnterTransition.None - }, - popExitTransition = { - ExitTransition.None - } - ) { + composable { HomeRoute( paddingValues = paddingValues, - navController = navHostController, navigateToCalendar = navigateToCalendar, navigateToIntern = navigateToIntern ) diff --git a/feature/home/src/main/res/values/strings.xml b/feature/home/src/main/res/values/strings.xml index 4de5c31f..9e4291b1 100644 --- a/feature/home/src/main/res/values/strings.xml +++ b/feature/home/src/main/res/values/strings.xml @@ -4,25 +4,26 @@ 서버통신에 실패했어요 - 곧 마감되는 %s님의 관심 공고 + 곧 마감되는 관심 공고 아직 스크랩된 인턴 공고가 없어요! 일주일 내에 마감인 공고가 없어요\n캘린더에서 스크랩한 공고 일정을 확인해 보세요 공고 마감 일정 확인하기 근무기간 - 내 계획에 딱 맞는 대학생 인턴 공고 + %s님에게%s딱 맞는 대학생 인턴 공고 필터링 %s년 %s월 - 필터링 설정에 일치하는 인턴 공고가 없어요! + 아직 채용중인 인턴 공고가 없어요!\n새로운 공고가 올라오면 보여드릴게요 인턴 공고가 없어요! 지금 공고 필터링을 설정하고\n내 계획에 딱 맞는 대학생 인턴 공고를 추천받아보세요! - 개의 공고가 있어요 + 설정된 필터링 정보가 없어요 기업 이미지 - 오늘 마감인 공고가 없어요 + 지원마감 diff --git a/feature/main/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/main/src/main/java/com/terning/feature/main/MainScreen.kt index e51797e7..643c5ce1 100644 --- a/feature/main/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/main/src/main/java/com/terning/feature/main/MainScreen.kt @@ -44,6 +44,7 @@ import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.White import com.terning.core.designsystem.util.NoRippleInteractionSource import com.terning.feature.calendar.calendar.navigation.calendarNavGraph +import com.terning.feature.calendar.calendar.navigation.navigateCalendar import com.terning.feature.filtering.filteringone.navigation.filteringOneNavGraph import com.terning.feature.filtering.filteringone.navigation.navigateFilteringOne import com.terning.feature.filtering.filteringthree.navigation.filteringThreeNavGraph @@ -171,8 +172,7 @@ fun MainScreen( ) homeNavGraph( paddingValues = paddingValues, - navHostController = navigator.navController, - navigateToCalendar = { navigator.navController.navigateHome() }, + navigateToCalendar = { navigator.navController.navigateCalendar() }, navigateToIntern = { announcementId -> navigator.navController.navigateIntern(announcementId) } diff --git a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt index c06b16da..0cc28017 100644 --- a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt @@ -388,6 +388,7 @@ private fun SearchResultInternItem( dateDeadline = intern.dDay, workingPeriod = intern.workingPeriod, isScrapped = intern.isScrapped, + isApplyClosed = intern.dDay == stringResource(id = R.string.intern_apply_closed), shadowRadius = 5.dp, shadowWidth = 1.dp, onScrapButtonClicked = { diff --git a/feature/search/src/main/res/values/strings.xml b/feature/search/src/main/res/values/strings.xml index 29a4790c..ba32e862 100644 --- a/feature/search/src/main/res/values/strings.xml +++ b/feature/search/src/main/res/values/strings.xml @@ -19,4 +19,6 @@ 해당하는 검색 결과가 없어요 개의 공고가 있어요 + + 지원마감