Skip to content

Commit

Permalink
feat: creation 으로 이동 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
easyhz committed Jul 19, 2024
1 parent eee7a2e commit 9e56b9b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ package com.easyhz.noffice.feature.organization.contract.organization
import com.easyhz.noffice.core.common.base.UiSideEffect

sealed class OrganizationSideEffect: UiSideEffect() {

data object NavigateToCreation: OrganizationSideEffect()
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.easyhz.noffice.core.common.util.collectInSideEffectWithLifecycle
import com.easyhz.noffice.core.design_system.R
import com.easyhz.noffice.core.design_system.component.button.IconMediumButton
import com.easyhz.noffice.core.design_system.component.exception.ExceptionView
Expand All @@ -21,17 +22,19 @@ import com.easyhz.noffice.core.design_system.component.topBar.HomeTopBar
import com.easyhz.noffice.core.design_system.extension.screenHorizonPadding
import com.easyhz.noffice.core.design_system.util.exception.ExceptionType
import com.easyhz.noffice.feature.organization.component.organization.OrganizationItem
import com.easyhz.noffice.feature.organization.contract.organization.OrganizationIntent
import com.easyhz.noffice.feature.organization.contract.organization.OrganizationSideEffect
import com.easyhz.noffice.feature.organization.util.OrganizationTopBarMenu

@Composable
fun OrganizationScreen(
modifier: Modifier = Modifier,
viewModel: OrganizationViewModel = hiltViewModel()
viewModel: OrganizationViewModel = hiltViewModel(),
navigateToCreation: () -> Unit
) {
val uiState by viewModel.uiState.collectAsStateWithLifecycle()

NofficeScaffold(
modifier = modifier,
topBar = {
HomeTopBar(
tabs = enumValues<OrganizationTopBarMenu>(),
Expand All @@ -48,7 +51,7 @@ fun OrganizationScreen(
)
}
Column(
modifier = Modifier
modifier = modifier
.padding(top = it.calculateTopPadding())
.screenHorizonPadding()
) {
Expand All @@ -57,7 +60,7 @@ fun OrganizationScreen(
text = stringResource(id = R.string.organization_new),
iconId = R.drawable.ic_plus
) {

viewModel.postIntent(OrganizationIntent.ClickOrganizationCreation)
}
LazyColumn(
modifier = Modifier.fillMaxSize()
Expand All @@ -75,4 +78,10 @@ fun OrganizationScreen(

}
}

viewModel.sideEffect.collectInSideEffectWithLifecycle {sideEffect ->
when(sideEffect) {
is OrganizationSideEffect.NavigateToCreation -> { navigateToCreation() }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ class OrganizationViewModel @Inject constructor(
initialState = OrganizationState.init()
) {
override fun handleIntent(intent: OrganizationIntent) {
TODO("Not yet implemented")
when(intent) {
is OrganizationIntent.ClickOrganizationCreation -> { onClickOrganizationCreation() }
}
}

private fun onClickOrganizationCreation() {
postSideEffect { OrganizationSideEffect.NavigateToCreation }
}
}

0 comments on commit 9e56b9b

Please sign in to comment.