diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt index abdfb0b9e..4f5b1e3d3 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.kt @@ -10,7 +10,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -32,7 +32,7 @@ fun SortingBottomSheet( onDismiss: () -> Unit, currentSortBy: Int, modifier: Modifier = Modifier, - newSortBy: MutableState = mutableStateOf(currentSortBy), + newSortBy: MutableState = mutableIntStateOf(currentSortBy), onSortChange: (Int) -> Unit = {}, ) { val scope = rememberCoroutineScope() diff --git a/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt b/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt index 61c101e42..7c3c87190 100644 --- a/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt +++ b/data/src/main/java/com/terning/data/datasource/HomeDataSource.kt @@ -8,7 +8,7 @@ import com.terning.data.dto.response.HomeRecommendInternResponseDto import com.terning.data.dto.response.HomeUpcomingInternResponseDto interface HomeDataSource { - suspend fun getUpcomingIntern(): BaseResponse> + suspend fun getUpcomingIntern(): BaseResponse suspend fun getRecommendIntern( sortBy: String, diff --git a/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt index 9e859e56f..9e4c3defe 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/HomeDataSourceImpl.kt @@ -13,7 +13,7 @@ import javax.inject.Inject class HomeDataSourceImpl @Inject constructor( private val homeService: HomeService, ) : HomeDataSource { - override suspend fun getUpcomingIntern(): BaseResponse> = + override suspend fun getUpcomingIntern(): BaseResponse = homeService.getHomeUpcomingIntern() override suspend fun getRecommendIntern( diff --git a/data/src/main/java/com/terning/data/dto/response/HomeUpcomingInternResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/HomeUpcomingInternResponseDto.kt index f51a028d9..3d77d24e1 100644 --- a/data/src/main/java/com/terning/data/dto/response/HomeUpcomingInternResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/HomeUpcomingInternResponseDto.kt @@ -5,24 +5,32 @@ import kotlinx.serialization.Serializable @Serializable data class HomeUpcomingInternResponseDto( - @SerialName("internshipAnnouncementId") - val internshipAnnouncementId: Long, - @SerialName("companyImage") - val companyImage: String, - @SerialName("title") - val title: String, - @SerialName("dDay") - val dDay: String, - @SerialName("deadline") - val deadline: String, - @SerialName("workingPeriod") - val workingPeriod: String, - @SerialName("isScrapped") - val isScrapped: Boolean, - @SerialName("color") - val color: String, - @SerialName("startYearMonth") - val startYearMonth: String, - @SerialName("companyInfo") - val companyInfo: String, -) + @SerialName("hasScrapped") + val hasScrapped: Boolean, + @SerialName("scraps") + val scraps: List, +) { + @Serializable + data class HomeUpcomingInternList( + @SerialName("internshipAnnouncementId") + val internshipAnnouncementId: Long, + @SerialName("companyImage") + val companyImage: String, + @SerialName("title") + val title: String, + @SerialName("dDay") + val dDay: String, + @SerialName("deadline") + val deadline: String, + @SerialName("workingPeriod") + val workingPeriod: String, + @SerialName("isScrapped") + val isScrapped: Boolean, + @SerialName("color") + val color: String, + @SerialName("startYearMonth") + val startYearMonth: String, + @SerialName("companyInfo") + val companyInfo: String, + ) +} diff --git a/data/src/main/java/com/terning/data/mapper/home/HomeUpcomingInternMapper.kt b/data/src/main/java/com/terning/data/mapper/home/HomeUpcomingInternMapper.kt index 3d8a760b2..e11577c32 100644 --- a/data/src/main/java/com/terning/data/mapper/home/HomeUpcomingInternMapper.kt +++ b/data/src/main/java/com/terning/data/mapper/home/HomeUpcomingInternMapper.kt @@ -5,6 +5,14 @@ import com.terning.domain.entity.home.HomeUpcomingIntern fun HomeUpcomingInternResponseDto.toHomeUpcomingInternList(): HomeUpcomingIntern = HomeUpcomingIntern( + hasScrapped = this.hasScrapped, + homeUpcomingInternDetail = this.scraps.map { + it.toHomeUpcomingInternDetail() + }, + ) + +fun HomeUpcomingInternResponseDto.HomeUpcomingInternList.toHomeUpcomingInternDetail(): HomeUpcomingIntern.HomeUpcomingInternDetail = + HomeUpcomingIntern.HomeUpcomingInternDetail( internshipAnnouncementId = this.internshipAnnouncementId, companyImage = this.companyImage, title = this.title, diff --git a/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt index f8247399f..8955364fd 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/HomeRepositoryImpl.kt @@ -15,11 +15,9 @@ import javax.inject.Inject class HomeRepositoryImpl @Inject constructor( private val homeDataSource: HomeDataSource, ) : HomeRepository { - override suspend fun getHomeUpcomingInternList(): Result> = + override suspend fun getHomeUpcomingInternList(): Result = runCatching { - homeDataSource.getUpcomingIntern().result.map { homeTodayInternResponseDto -> - homeTodayInternResponseDto.toHomeUpcomingInternList() - } + homeDataSource.getUpcomingIntern().result.toHomeUpcomingInternList() } override suspend fun getRecommendIntern( diff --git a/data/src/main/java/com/terning/data/service/HomeService.kt b/data/src/main/java/com/terning/data/service/HomeService.kt index c87dc2dce..dd89765d3 100644 --- a/data/src/main/java/com/terning/data/service/HomeService.kt +++ b/data/src/main/java/com/terning/data/service/HomeService.kt @@ -13,7 +13,7 @@ import retrofit2.http.Query interface HomeService { @GET("api/v1/home/upcoming") - suspend fun getHomeUpcomingIntern(): BaseResponse> + suspend fun getHomeUpcomingIntern(): BaseResponse @GET("api/v1/home") suspend fun getRecommendIntern( diff --git a/domain/src/main/java/com/terning/domain/entity/home/HomeUpcomingIntern.kt b/domain/src/main/java/com/terning/domain/entity/home/HomeUpcomingIntern.kt index 60072a616..68dcd4711 100644 --- a/domain/src/main/java/com/terning/domain/entity/home/HomeUpcomingIntern.kt +++ b/domain/src/main/java/com/terning/domain/entity/home/HomeUpcomingIntern.kt @@ -1,14 +1,19 @@ package com.terning.domain.entity.home data class HomeUpcomingIntern( - val internshipAnnouncementId: Long, - val companyImage: String, - val title: String, - val dDay: String, - val deadline: String, - val workingPeriod: String, - val isScrapped: Boolean, - val color: String, - val startYearMonth: String, - val companyInfo: String, -) + val hasScrapped: Boolean, + val homeUpcomingInternDetail: List +) { + data class HomeUpcomingInternDetail( + val internshipAnnouncementId: Long, + val companyImage: String, + val title: String, + val dDay: String, + val deadline: String, + val workingPeriod: String, + val isScrapped: Boolean, + val color: String, + val startYearMonth: String, + val companyInfo: String, + ) +} diff --git a/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt b/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt index e78187054..6d7753435 100644 --- a/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt +++ b/domain/src/main/java/com/terning/domain/repository/HomeRepository.kt @@ -6,7 +6,7 @@ import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.domain.entity.request.ChangeFilteringRequestModel interface HomeRepository { - suspend fun getHomeUpcomingInternList(): Result> + suspend fun getHomeUpcomingInternList(): Result suspend fun getRecommendIntern( sortBy: String, diff --git a/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt index ca1c71795..6f5570956 100644 --- a/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt +++ b/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt @@ -8,7 +8,7 @@ import androidx.navigation.compose.composable import androidx.navigation.navOptions import com.terning.core.navigation.Route import com.terning.feature.filtering.starthome.StartHomeRoute -import com.terning.feature.home.home.navigation.navigateHome +import com.terning.feature.home.navigation.navigateHome import kotlinx.serialization.Serializable fun NavController.navigateStartHome(navOptions: NavOptions? = null) { diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/HomeRoute.kt similarity index 79% rename from feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt rename to feature/src/main/java/com/terning/feature/home/HomeRoute.kt index 5a3bfea05..8962c8d57 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home +package com.terning.feature.home import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background @@ -12,10 +12,8 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.MutableState import androidx.compose.runtime.SideEffect 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 @@ -40,8 +38,6 @@ import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White -import com.terning.core.extension.currentMonth -import com.terning.core.extension.currentYear import com.terning.core.extension.noRippleClickable import com.terning.core.extension.toast import com.terning.core.state.UiState @@ -54,14 +50,13 @@ import com.terning.feature.R import com.terning.feature.calendar.calendar.navigation.navigateCalendar import com.terning.feature.dialog.cancel.ScrapCancelDialog import com.terning.feature.dialog.detail.ScrapDialog -import com.terning.feature.home.home.component.HomeFilteringBottomSheet -import com.terning.feature.home.home.component.HomeFilteringScreen -import com.terning.feature.home.home.component.HomeRecommendEmptyIntern -import com.terning.feature.home.home.component.HomeUpcomingEmptyFilter -import com.terning.feature.home.home.component.HomeUpcomingEmptyIntern -import com.terning.feature.home.home.component.HomeUpcomingInternScreen +import com.terning.feature.home.component.HomeFilteringBottomSheet +import com.terning.feature.home.component.HomeFilteringScreen +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 com.terning.feature.intern.navigation.navigateIntern -import java.util.Calendar const val NAME_START_LENGTH = 7 const val NAME_END_LENGTH = 12 @@ -104,6 +99,10 @@ fun HomeRoute( paddingValues = paddingValues, navigateToIntern = { navController.navigateIntern(announcementId = it) }, navigateToCalendar = { navController.navigateCalendar() }, + updateRecommendDialogVisibility = viewModel::updateRecommendDialogVisibility, + updateUpcomingDialogVisibility = viewModel::updateUpcomingDialogVisibility, + getHomeUpcomingInternList = viewModel::getHomeUpcomingInternList, + getRecommendInternsData = viewModel::getRecommendInternsData, viewModel = viewModel, ) } @@ -114,6 +113,10 @@ fun HomeScreen( paddingValues: PaddingValues, navigateToIntern: (Long) -> Unit, navigateToCalendar: () -> Unit, + updateRecommendDialogVisibility: (Boolean) -> Unit, + updateUpcomingDialogVisibility: (Boolean) -> Unit, + getHomeUpcomingInternList: () -> Unit, + getRecommendInternsData: (Int, Int?, Int?) -> Unit, viewModel: HomeViewModel, ) { val homeState by viewModel.homeState.collectAsStateWithLifecycle() @@ -138,22 +141,21 @@ fun HomeScreen( else -> 0 } - val currentSortBy: MutableState = remember { mutableIntStateOf(0) } - var sortingSheetState by remember { mutableStateOf(false) } var changeFilteringSheetState by remember { mutableStateOf(false) } - if (sortingSheetState) { + if (homeState.sortingSheetVisibility) { SortingBottomSheet( onDismiss = { - sortingSheetState = false - viewModel.getRecommendInternsData( - currentSortBy.value, + viewModel.updateSortingSheetVisibility(false) + }, + currentSortBy = homeState.sortBy.ordinal, + onSortChange = { + viewModel.updateSortBy( + it, homeFilteringInfo.startYear, homeFilteringInfo.startMonth, ) - }, - currentSortBy = currentSortBy.value, - newSortBy = currentSortBy + } ) } @@ -185,15 +187,16 @@ fun HomeScreen( if (isScrapped) { ScrapCancelDialog( internshipAnnouncementId = internshipAnnouncementId, - onDismissRequest = { - viewModel.updateRecommendDialogVisibility(false) - viewModel.getHomeUpcomingInternList() - viewModel.getRecommendInternsData( - sortBy = homeState.sortBy.ordinal, - startYear = homeFilteringInfo.startYear ?: Calendar.getInstance().currentYear, - startMonth = homeFilteringInfo.startMonth - ?: Calendar.getInstance().currentMonth, - ) + onDismissRequest = { isScrapCancelled -> + updateRecommendDialogVisibility(false) + if (isScrapCancelled) { + getHomeUpcomingInternList() + getRecommendInternsData( + homeState.sortBy.ordinal, + homeFilteringInfo.startYear, + homeFilteringInfo.startMonth + ) + } } ) } else { @@ -206,17 +209,16 @@ fun HomeScreen( internshipAnnouncementId = internshipAnnouncementId, companyImage = companyImage, isScrapped = isScrapped, - onDismissRequest = { - viewModel.updateRecommendDialogVisibility( - false - ) - viewModel.getHomeUpcomingInternList() - viewModel.getRecommendInternsData( - sortBy = homeState.sortBy.ordinal, - startYear = homeFilteringInfo.startYear ?: Calendar.getInstance().currentYear, - startMonth = homeFilteringInfo.startMonth - ?: Calendar.getInstance().currentMonth, - ) + onDismissRequest = { isScrapped -> + updateRecommendDialogVisibility(false) + if (isScrapped) { + getRecommendInternsData( + homeState.sortBy.ordinal, + homeFilteringInfo.startYear, + homeFilteringInfo.startMonth + ) + getHomeUpcomingInternList() + } }, onClickNavigateButton = navigateToIntern ) @@ -254,6 +256,8 @@ fun HomeScreen( homeState = homeState, navigateToIntern = { navigateToIntern(it) }, navigateToCalendar = navigateToCalendar, + updateUpcomingDialogVisibility = updateUpcomingDialogVisibility, + getHomeUpcomingInternList = getHomeUpcomingInternList, ) } } @@ -296,8 +300,8 @@ fun HomeScreen( } Row { SortingButton( - sortBy = currentSortBy.value, - onCLick = { sortingSheetState = true }, + sortBy = homeState.sortBy.ordinal, + onCLick = { viewModel.updateSortingSheetVisibility(true) }, modifier = Modifier .padding(vertical = 4.dp) ) @@ -312,7 +316,7 @@ fun HomeScreen( navigateToIntern = navigateToIntern, intern = homeRecommendInternList[index], onScrapButtonClicked = { - viewModel.updateRecommendDialogVisibility(true) + updateRecommendDialogVisibility(true) with(homeRecommendInternList[index]) { viewModel.updateHomeInternModel( internshipAnnouncementId = internshipAnnouncementId, @@ -388,27 +392,34 @@ private fun ShowMainTitleWithName(userName: String) { @Composable private fun ShowUpcomingIntern( - homeUpcomingInternState: UiState>, + homeUpcomingInternState: UiState, homeState: HomeState, navigateToIntern: (Long) -> Unit, navigateToCalendar: () -> Unit, + updateUpcomingDialogVisibility: (Boolean) -> Unit, + getHomeUpcomingInternList: () -> Unit, ) { when (homeUpcomingInternState) { is UiState.Success -> { - if (homeUpcomingInternState.data.isEmpty()) { - HomeUpcomingEmptyIntern(navigateToCalendar = navigateToCalendar) - } else { - HomeUpcomingInternScreen( - internList = homeUpcomingInternState.data, - homeState = homeState, - navigateToIntern = navigateToIntern - ) + with(homeUpcomingInternState.data) { + when { + !hasScrapped -> HomeUpcomingEmptyFilter() + hasScrapped && homeUpcomingInternDetail.isEmpty() -> HomeUpcomingEmptyIntern( + navigateToCalendar = navigateToCalendar + ) + + else -> HomeUpcomingInternScreen( + internList = homeUpcomingInternDetail, + homeState = homeState, + updateUpcomingDialogVisibility = updateUpcomingDialogVisibility, + getHomeUpcomingInternList = getHomeUpcomingInternList, + navigateToIntern = navigateToIntern + ) + } } } - is UiState.Loading -> HomeUpcomingEmptyFilter() - is UiState.Empty -> HomeUpcomingEmptyFilter() - else -> {} + else -> HomeUpcomingEmptyFilter() } } diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeSideEffect.kt b/feature/src/main/java/com/terning/feature/home/HomeSideEffect.kt similarity index 83% rename from feature/src/main/java/com/terning/feature/home/home/HomeSideEffect.kt rename to feature/src/main/java/com/terning/feature/home/HomeSideEffect.kt index ec74db512..abc8659ec 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeSideEffect.kt +++ b/feature/src/main/java/com/terning/feature/home/HomeSideEffect.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home +package com.terning.feature.home import androidx.annotation.StringRes diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt b/feature/src/main/java/com/terning/feature/home/HomeState.kt similarity index 72% rename from feature/src/main/java/com/terning/feature/home/home/HomeState.kt rename to feature/src/main/java/com/terning/feature/home/HomeState.kt index 4b7cde0fb..6bf0278f2 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeState.kt +++ b/feature/src/main/java/com/terning/feature/home/HomeState.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home +package com.terning.feature.home import com.terning.core.state.UiState import com.terning.core.type.SortBy @@ -8,11 +8,12 @@ import com.terning.domain.entity.home.HomeUpcomingIntern data class HomeState( val sortBy: SortBy = SortBy.EARLIEST, + val sortingSheetVisibility: Boolean = false, val homeUserNameState: UiState = UiState.Loading, val homeFilteringInfoState: UiState = UiState.Loading, - val homeUpcomingInternState: UiState> = UiState.Empty, + val homeUpcomingInternState: UiState = UiState.Empty, val homeRecommendInternState: UiState = UiState.Loading, val homeUpcomingDialogVisibility: Boolean = false, val homeRecommendDialogVisibility: Boolean = false, - val homeInternModel: HomeUpcomingIntern? = null, + val homeInternModel: HomeRecommendIntern.HomeRecommendInternDetail? = null, ) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt b/feature/src/main/java/com/terning/feature/home/HomeViewModel.kt similarity index 86% rename from feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt rename to feature/src/main/java/com/terning/feature/home/HomeViewModel.kt index eb65774a3..13a9d4d8a 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeViewModel.kt +++ b/feature/src/main/java/com/terning/feature/home/HomeViewModel.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home +package com.terning.feature.home import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope @@ -6,7 +6,7 @@ import com.terning.core.extension.currentMonth import com.terning.core.extension.currentYear import com.terning.core.state.UiState import com.terning.core.type.SortBy -import com.terning.domain.entity.home.HomeUpcomingIntern +import com.terning.domain.entity.home.HomeRecommendIntern import com.terning.domain.entity.request.ChangeFilteringRequestModel import com.terning.domain.repository.HomeRepository import com.terning.domain.repository.MyPageRepository @@ -53,9 +53,9 @@ class HomeViewModel @Inject constructor( fun getHomeUpcomingInternList() { viewModelScope.launch { - homeRepository.getHomeUpcomingInternList().onSuccess { internList -> + homeRepository.getHomeUpcomingInternList().onSuccess { upcomingIntern -> _homeState.value = _homeState.value.copy( - homeUpcomingInternState = UiState.Success(internList) + homeUpcomingInternState = UiState.Success(upcomingIntern) ) }.onFailure { exception: Throwable -> _homeState.value = _homeState.value.copy( @@ -73,12 +73,12 @@ class HomeViewModel @Inject constructor( homeFilteringInfoState = UiState.Success(filteringInfo) ) if (filteringInfo.grade != null) { - getHomeUpcomingInternList() getRecommendInternsData( sortBy = _homeState.value.sortBy.ordinal, startYear = filteringInfo.startYear, startMonth = filteringInfo.startMonth, ) + getHomeUpcomingInternList() } }.onFailure { exception: Throwable -> _homeState.value = _homeState.value.copy( @@ -133,12 +133,11 @@ class HomeViewModel @Inject constructor( isScrapped: Boolean, color: String?, startYearMonth: String, - companyInfo: String = "", ) { _homeState.update { it.copy( homeInternModel = - HomeUpcomingIntern( + HomeRecommendIntern.HomeRecommendInternDetail( internshipAnnouncementId = internshipAnnouncementId, companyImage = companyImage, title = title, @@ -148,9 +147,29 @@ class HomeViewModel @Inject constructor( isScrapped = isScrapped, color = color ?: "", startYearMonth = startYearMonth, - companyInfo = companyInfo, ) ) } } + + fun updateSortBy(sortBy: Int, startYear: Int?, startMonth: Int?) { + _homeState.update { + it.copy( + sortBy = SortBy.entries[sortBy] + ) + } + getRecommendInternsData( + _homeState.value.sortBy.ordinal, + startYear ?: Calendar.getInstance().currentYear, + startMonth ?: Calendar.getInstance().currentMonth, + ) + } + + fun updateSortingSheetVisibility(visibility: Boolean) { + _homeState.update { + it.copy( + sortingSheetVisibility = visibility + ) + } + } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt b/feature/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt similarity index 99% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt rename to feature/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index ca8b6778d..eda76cd34 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringBottomSheet.kt +++ b/feature/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home.component +package com.terning.feature.home.component import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt b/feature/src/main/java/com/terning/feature/home/component/HomeFilteringScreen.kt similarity index 99% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt rename to feature/src/main/java/com/terning/feature/home/component/HomeFilteringScreen.kt index 242cf6537..532f3128c 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/component/HomeFilteringScreen.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home.component +package com.terning.feature.home.component import androidx.compose.foundation.background import androidx.compose.foundation.border diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/component/HomeRecommendEmptyIntern.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendEmptyIntern.kt rename to feature/src/main/java/com/terning/feature/home/component/HomeRecommendEmptyIntern.kt index c29f55ae1..d6bca8a39 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeRecommendEmptyIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/component/HomeRecommendEmptyIntern.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home.component +package com.terning.feature.home.component import androidx.annotation.StringRes import androidx.compose.foundation.Image diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyFilter.kt b/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingEmptyFilter.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyFilter.kt rename to feature/src/main/java/com/terning/feature/home/component/HomeUpcomingEmptyFilter.kt index a39e54459..98dd5d2c0 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyFilter.kt +++ b/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingEmptyFilter.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home.component +package com.terning.feature.home.component import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt b/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingEmptyIntern.kt similarity index 98% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt rename to feature/src/main/java/com/terning/feature/home/component/HomeUpcomingEmptyIntern.kt index 7363df1aa..c2e658559 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingEmptyIntern.kt +++ b/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingEmptyIntern.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home.component +package com.terning.feature.home.component import androidx.compose.foundation.background import androidx.compose.foundation.border diff --git a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt b/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt similarity index 91% rename from feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt rename to feature/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt index 77228a7bc..7cfe26f9c 100644 --- a/feature/src/main/java/com/terning/feature/home/home/component/HomeUpcomingInternScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home.component +package com.terning.feature.home.component import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.background @@ -31,7 +31,6 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel import coil.compose.AsyncImage import coil.request.ImageRequest import com.terning.core.designsystem.component.item.ScrapBox @@ -47,17 +46,17 @@ import com.terning.core.extension.noRippleClickable import com.terning.domain.entity.home.HomeUpcomingIntern import com.terning.feature.R import com.terning.feature.dialog.detail.ScrapDialog -import com.terning.feature.home.home.HomeState -import com.terning.feature.home.home.HomeViewModel +import com.terning.feature.home.HomeState @Composable fun HomeUpcomingInternScreen( - internList: List, + internList: List, homeState: HomeState, navigateToIntern: (Long) -> Unit, - homeViewModel: HomeViewModel = hiltViewModel() + updateUpcomingDialogVisibility: (Boolean) -> Unit, + getHomeUpcomingInternList: () -> Unit, ) { - var selectedInternItem: HomeUpcomingIntern? by remember { + var selectedInternItem: HomeUpcomingIntern.HomeUpcomingInternDetail? by remember { mutableStateOf(null) } @@ -86,7 +85,7 @@ fun HomeUpcomingInternScreen( .fillMaxHeight() .noRippleClickable { selectedInternItem = homeUpcomingIntern - homeViewModel.updateUpcomingDialogVisibility(true) + updateUpcomingDialogVisibility(true) }, verticalArrangement = Arrangement.SpaceBetween, ) { @@ -135,13 +134,13 @@ fun HomeUpcomingInternScreen( color = Grey500, maxLines = 1, modifier = Modifier - .padding(start = 6.dp, end = 15.dp) + .padding(start = 6.dp, end = 16.dp) .weight(1f) ) Row( modifier = Modifier - .size(width = 40.dp, height = 20.dp) + .size(width = 48.dp, height = 20.dp) .background( color = TerningSub3, shape = RoundedCornerShape(size = 5.dp) @@ -175,10 +174,8 @@ fun HomeUpcomingInternScreen( internshipAnnouncementId = internshipAnnouncementId, companyImage = companyImage, isScrapped = isScrapped, - onDismissRequest = { - homeViewModel.updateUpcomingDialogVisibility(false) - }, - onClickChangeColor = homeViewModel::getHomeUpcomingInternList, + onDismissRequest = { updateUpcomingDialogVisibility(false) }, + onClickChangeColor = getHomeUpcomingInternList, onClickNavigateButton = { navigateToIntern(internshipAnnouncementId) } ) } diff --git a/feature/src/main/java/com/terning/feature/home/home/model/HomeDialogState.kt b/feature/src/main/java/com/terning/feature/home/model/HomeDialogState.kt similarity index 89% rename from feature/src/main/java/com/terning/feature/home/home/model/HomeDialogState.kt rename to feature/src/main/java/com/terning/feature/home/model/HomeDialogState.kt index 2df1a7ca3..97af988e8 100644 --- a/feature/src/main/java/com/terning/feature/home/home/model/HomeDialogState.kt +++ b/feature/src/main/java/com/terning/feature/home/model/HomeDialogState.kt @@ -1,4 +1,4 @@ -package com.terning.feature.home.home.model +package com.terning.feature.home.model import androidx.compose.ui.graphics.Color import com.terning.core.designsystem.theme.CalRed diff --git a/feature/src/main/java/com/terning/feature/home/home/navigation/HometNavigation.kt b/feature/src/main/java/com/terning/feature/home/navigation/HometNavigation.kt similarity index 80% rename from feature/src/main/java/com/terning/feature/home/home/navigation/HometNavigation.kt rename to feature/src/main/java/com/terning/feature/home/navigation/HometNavigation.kt index 307d4ed93..ef2ee3c9b 100644 --- a/feature/src/main/java/com/terning/feature/home/home/navigation/HometNavigation.kt +++ b/feature/src/main/java/com/terning/feature/home/navigation/HometNavigation.kt @@ -1,19 +1,15 @@ -package com.terning.feature.home.home.navigation +package com.terning.feature.home.navigation import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition -import androidx.compose.animation.core.LinearOutSlowInEasing -import androidx.compose.animation.core.tween -import androidx.compose.animation.slideIn import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.ui.unit.IntOffset 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 -import com.terning.feature.home.home.HomeRoute +import com.terning.feature.home.HomeRoute import kotlinx.serialization.Serializable fun NavController.navigateHome(navOptions: NavOptions? = null) { 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 8455eb2a6..fff645486 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -4,13 +4,12 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.navigation.NavDestination import androidx.navigation.NavDestination.Companion.hasRoute -import androidx.navigation.NavGraph.Companion.findStartDestination import androidx.navigation.NavHostController import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import androidx.navigation.navOptions import com.terning.feature.calendar.calendar.navigation.navigateCalendar -import com.terning.feature.home.home.navigation.navigateHome +import com.terning.feature.home.navigation.navigateHome import com.terning.feature.mypage.mypage.navigation.navigateMyPage import com.terning.feature.onboarding.splash.navigation.Splash import com.terning.feature.search.search.navigation.navigateSearch 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 99ec64c46..61714f0b6 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -45,7 +45,7 @@ import com.terning.feature.filtering.filtering.navigation.filteringTwoNavGraph import com.terning.feature.filtering.filteringthree.navigation.filteringThreeNavGraph import com.terning.feature.filtering.startfiltering.navigation.startFilteringNavGraph import com.terning.feature.filtering.starthome.navigation.startHomeNavGraph -import com.terning.feature.home.home.navigation.homeNavGraph +import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.intern.navigation.internNavGraph import com.terning.feature.mypage.mypage.navigation.myPageNavGraph import com.terning.feature.mypage.profileedit.navigation.profileEditNavGraph diff --git a/feature/src/main/java/com/terning/feature/main/MainTab.kt b/feature/src/main/java/com/terning/feature/main/MainTab.kt index 993a7c47a..fe0ebf4a2 100644 --- a/feature/src/main/java/com/terning/feature/main/MainTab.kt +++ b/feature/src/main/java/com/terning/feature/main/MainTab.kt @@ -7,7 +7,7 @@ import com.terning.core.navigation.MainTabRoute import com.terning.core.navigation.Route import com.terning.feature.R import com.terning.feature.calendar.calendar.navigation.Calendar -import com.terning.feature.home.home.navigation.Home +import com.terning.feature.home.navigation.Home import com.terning.feature.mypage.mypage.navigation.MyPage import com.terning.feature.search.search.navigation.Search diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt index 1f9559611..c22cd447b 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt @@ -7,7 +7,7 @@ import androidx.navigation.NavOptions import androidx.navigation.compose.composable import androidx.navigation.navOptions import com.terning.core.navigation.Route -import com.terning.feature.home.home.navigation.navigateHome +import com.terning.feature.home.navigation.navigateHome import com.terning.feature.onboarding.signin.SignInRoute import com.terning.feature.onboarding.signup.navigation.navigateSignUp import kotlinx.serialization.Serializable diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt index 61dc771e7..3d959d0a5 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt @@ -6,7 +6,7 @@ import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.Route -import com.terning.feature.home.home.navigation.navigateHome +import com.terning.feature.home.navigation.navigateHome import com.terning.feature.onboarding.signin.navigation.navigateSignIn import com.terning.feature.onboarding.splash.SplashRoute import kotlinx.serialization.Serializable