diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/task/TaskView.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/task/TaskView.kt index 986ff132..2b48c699 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/task/TaskView.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/task/TaskView.kt @@ -24,7 +24,8 @@ import com.easyhz.noffice.feature.home.component.viewmodel.TaskViewModel @Composable internal fun TaskView( modifier: Modifier = Modifier, - viewModel: TaskViewModel = hiltViewModel() + viewModel: TaskViewModel = hiltViewModel(), + onClickOrganizationHeader: (organizationId: Int, organizationTitle: String) -> Unit, ) { val taskList = viewModel.taskListState.collectAsLazyPagingItems() LazyColumn( @@ -41,7 +42,7 @@ internal fun TaskView( modifier = Modifier .fillMaxWidth(), organizationName = item.organizationName - ) { } + ) { onClickOrganizationHeader(item.organizationId, item.organizationName) } item.tasks.forEach { task -> TaskItem( modifier = Modifier diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt index ccab5d34..c42db6d4 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt @@ -2,13 +2,12 @@ package com.easyhz.noffice.feature.home.contract.home import com.easyhz.noffice.core.common.base.UiIntent import com.easyhz.noffice.core.design_system.util.topBar.TopBarIconMenu -import com.easyhz.noffice.core.model.organization.Organization import com.easyhz.noffice.feature.home.util.HomeTopBarMenu sealed class HomeIntent: UiIntent() { data class ChangeTopBarMenu(val topBarMenu: HomeTopBarMenu): HomeIntent() data class ClickTopBarIconMenu(val iconMenu: TopBarIconMenu): HomeIntent() - data class ClickOrganizationHeader(val organization: Organization): HomeIntent() + data class ClickOrganizationHeader(val organizationId: Int, val organizationName: String): HomeIntent() data class ClickAnnouncementCard(val organizationId: Int, val announcementId: Int, val announcementTitle: String): HomeIntent() data class JoinToOrganization(val organizationId: Int): HomeIntent() data object SetInitLoading: HomeIntent() diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt index 5f63221f..eb47f648 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt @@ -128,11 +128,7 @@ fun HomeScreen( isLoading = uiState.isInitLoading, isRefreshing = isRefreshing, onClickOrganizationHeader = { - viewModel.postIntent( - HomeIntent.ClickOrganizationHeader( - it - ) - ) + viewModel.postIntent(HomeIntent.ClickOrganizationHeader(it.id, it.name)) }, onClickAnnouncementCard = { organizationId, announcementId, announcementTitle -> viewModel.postIntent( @@ -150,7 +146,9 @@ fun HomeScreen( TaskView( modifier = Modifier .screenHorizonPadding() - ) + ) { organizationId, organizationName -> + viewModel.postIntent(HomeIntent.ClickOrganizationHeader(organizationId, organizationName)) + } } } } diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt index 58080828..5be729fc 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt @@ -48,7 +48,7 @@ class HomeViewModel @Inject constructor( is HomeIntent.JoinToOrganization -> { joinToOrganization(intent.organizationId) } is HomeIntent.Refresh -> { refresh() } is HomeIntent.SetInitLoading -> { reduce { copy(isInitLoading = false) }} - is HomeIntent.ClickOrganizationHeader -> { navigateToOrganizationDetail(intent.organization) } + is HomeIntent.ClickOrganizationHeader -> { navigateToOrganizationDetail(intent.organizationId, intent.organizationName) } is HomeIntent.ClickAnnouncementCard -> { navigateToAnnouncementDetail(intent.organizationId, intent.announcementId, intent.announcementTitle) } } } @@ -89,8 +89,8 @@ class HomeViewModel @Inject constructor( postSideEffect { HomeSideEffect.NavigateToMyPage } } - private fun navigateToOrganizationDetail(organization: Organization) { - postSideEffect { HomeSideEffect.NavigateToOrganizationDetail(organizationId = organization.id, organizationName = organization.name) } + private fun navigateToOrganizationDetail(id: Int, name: String) { + postSideEffect { HomeSideEffect.NavigateToOrganizationDetail(organizationId = id, organizationName = name) } } private fun navigateToAnnouncementDetail(organizationId: Int, id: Int, title: String) {