Skip to content

Commit

Permalink
fix: homeScreen 에서 organizationDetail로 가는 로직 수정 (#134)
Browse files Browse the repository at this point in the history
- task screen -> organization detail
  • Loading branch information
easyhz committed Aug 22, 2024
1 parent fed3e17 commit 3d05aff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -150,7 +146,9 @@ fun HomeScreen(
TaskView(
modifier = Modifier
.screenHorizonPadding()
)
) { organizationId, organizationName ->
viewModel.postIntent(HomeIntent.ClickOrganizationHeader(organizationId, organizationName))
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3d05aff

Please sign in to comment.