Skip to content

Commit

Permalink
feat: 받은 봉투 편집 ui
Browse files Browse the repository at this point in the history
  • Loading branch information
jinukeu committed Jan 31, 2024
1 parent a4af27c commit 6517b26
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 86 deletions.
4 changes: 2 additions & 2 deletions core/ui/src/main/java/com/susu/core/ui/util/Date.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ fun LocalDateTime.to_yyyy_dot_MM_dot_dd(): String {
* 2023년 11월 25일
*/
@Suppress("detekt:FunctionNaming")
fun LocalDateTime.to_yyyy_korYear_MM_korMonth_dd_korDay(): String {
val formatter = DateTimeFormatter.ofPattern("yyyy년 MM월 dd일")
fun LocalDateTime.to_yyyy_korYear_M_korMonth_d_korDay(): String {
val formatter = DateTimeFormatter.ofPattern("yyyy년 M월 d일")
return this.format(formatter)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal class MainNavigator(
ReceivedRoute.ledgerSearchRoute,
ReceivedRoute.ledgerFilterRoute("{${ReceivedRoute.FILTER_ARGUMENT_NAME}}"),
ReceivedRoute.envelopeDetailRoute("{${ReceivedRoute.ENVELOPE_ARGUMENT_NAME}}"),
ReceivedRoute.envelopeEditRoute,
ReceivedRoute.envelopeEditRoute("{${ReceivedRoute.ENVELOPE_ARGUMENT_NAME}}"),
SentRoute.sentEnvelopeRoute,
SentRoute.sentEnvelopeDetailRoute,
SentRoute.sentEnvelopeEditRoute,
Expand Down Expand Up @@ -172,8 +172,8 @@ internal class MainNavigator(
navController.navigateReceivedEnvelopeDetail(envelope)
}

fun navigateReceivedEnvelopeEdit() {
navController.navigateReceivedEnvelopeEdit()
fun navigateReceivedEnvelopeEdit(envelope: Envelope) {
navController.navigateReceivedEnvelopeEdit(envelope)
}

fun navigateVoteAdd() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ import com.susu.core.designsystem.component.appbar.icon.DeleteText
import com.susu.core.designsystem.component.appbar.icon.EditText
import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.SusuTheme
import com.susu.core.model.Envelope
import com.susu.core.ui.DialogToken
import com.susu.core.ui.SnackbarToken
import com.susu.core.ui.extension.collectWithLifecycle
import com.susu.core.ui.extension.toMoneyFormat
import com.susu.core.ui.util.to_yyyy_dot_MM_dot_dd
import com.susu.core.ui.util.to_yyyy_korYear_MM_korMonth_dd_korDay
import com.susu.core.ui.util.to_yyyy_korYear_M_korMonth_d_korDay
import com.susu.feature.received.R
import com.susu.feature.received.envelopedetail.component.DetailItem
import kotlinx.datetime.toJavaLocalDateTime
Expand All @@ -40,7 +41,7 @@ fun ReceivedEnvelopeDetailRoute(
viewModel: ReceivedEnvelopeDetailViewModel = hiltViewModel(),
popBackStackWithDeleteReceivedEnvelopeId: (Long) -> Unit,
popBackStackWithReceivedEnvelope: (String) -> Unit,
navigateReceivedEnvelopeEdit: () -> Unit,
navigateReceivedEnvelopeEdit: (Envelope) -> Unit,
handleException: (Throwable, () -> Unit) -> Unit,
onShowSnackbar: (SnackbarToken) -> Unit,
onShowDialog: (DialogToken) -> Unit,
Expand All @@ -50,7 +51,7 @@ fun ReceivedEnvelopeDetailRoute(
viewModel.sideEffect.collectWithLifecycle { sideEffect ->
when (sideEffect) {
is ReceivedEnvelopeDetailSideEffect.HandleException -> handleException(sideEffect.throwable, sideEffect.retry)
is ReceivedEnvelopeDetailSideEffect.NavigateReceivedEnvelopeEdit -> TODO()
is ReceivedEnvelopeDetailSideEffect.NavigateReceivedEnvelopeEdit -> navigateReceivedEnvelopeEdit(sideEffect.envelope)
is ReceivedEnvelopeDetailSideEffect.PopBackStackWithDeleteReceivedEnvelopeId -> popBackStackWithDeleteReceivedEnvelopeId(
sideEffect.envelopeId,
)
Expand Down Expand Up @@ -84,7 +85,7 @@ fun ReceivedEnvelopeDetailRoute(

ReceivedEnvelopeDetailScreen(
uiState = uiState,
onClickEdit = navigateReceivedEnvelopeEdit,
onClickEdit = viewModel::navigateEnvelopeEdit,
onClickDelete = viewModel::showDeleteDialog,
onClickBackIcon = viewModel::popBackStackWithEnvelope,
)
Expand Down Expand Up @@ -151,7 +152,7 @@ fun ReceivedEnvelopeDetailScreen(
)
DetailItem(
categoryText = stringResource(com.susu.core.ui.R.string.word_date),
contentText = uiState.envelope.handedOverAt.toJavaLocalDateTime().to_yyyy_korYear_MM_korMonth_dd_korDay(),
contentText = uiState.envelope.handedOverAt.toJavaLocalDateTime().to_yyyy_korYear_M_korMonth_d_korDay(),
isEmptyContent = false,
)
DetailItem(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.susu.feature.received.envelopeedit

import com.susu.core.model.Envelope
import com.susu.core.model.Relationship
import com.susu.core.ui.base.SideEffect
import com.susu.core.ui.base.UiState
import com.susu.feature.received.envelopeadd.content.relationship.RelationShipSideEffect
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf

data class ReceivedEnvelopeEditState(
val envelope: Envelope = Envelope(),
val relationshipConfig: PersistentList<Relationship> = persistentListOf(Relationship()),
val showCustomRelationButton: Boolean = false,
val showDateBottomSheet: Boolean = false,
val isRelationSaved: Boolean = false,
) : UiState {
}

sealed interface ReceivedEnvelopeEditSideEffect : SideEffect {
data object PopBackStack : ReceivedEnvelopeEditSideEffect
data class HandleException(val throwable: Throwable, val retry: () -> Unit) : ReceivedEnvelopeEditSideEffect
}
Loading

0 comments on commit 6517b26

Please sign in to comment.