Skip to content

Commit db0f031

Browse files
committed
Feat: EditConfirmBottomSheet 활성 상태 구현
1 parent 3261a63 commit db0f031

7 files changed

Lines changed: 27 additions & 5 deletions

File tree

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListScreen.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme
2323
import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar
2424
import com.threegap.bitnagil.presentation.common.flow.collectAsEffect
2525
import com.threegap.bitnagil.presentation.routinelist.component.template.DeleteConfirmBottomSheet
26+
import com.threegap.bitnagil.presentation.routinelist.component.template.EditConfirmBottomSheet
2627
import com.threegap.bitnagil.presentation.routinelist.component.template.EmptyRoutineListView
2728
import com.threegap.bitnagil.presentation.routinelist.component.template.RoutineDetailsCard
2829
import com.threegap.bitnagil.presentation.routinelist.component.template.WeeklyDatePicker
@@ -57,6 +58,18 @@ fun RoutineListScreenContainer(
5758
}
5859
}
5960

61+
if (uiState.editConfirmBottomSheetVisible) {
62+
EditConfirmBottomSheet(
63+
onDismissRequest = { viewModel.sendIntent(RoutineListIntent.HideEditConfirmBottomSheet) },
64+
onApplyToday = {
65+
// TODO("루틴수정으로 이동(id와 수정여부(TODAY) 넘겨주기")
66+
},
67+
onApplyTomorrow = {
68+
//TODO("루틴수정으로 이동(id와 수정여부(TOMORROW) 넘겨주기")
69+
},
70+
)
71+
}
72+
6073
RoutineListScreen(
6174
uiState = uiState,
6275
onDateSelect = { selectedDate ->
@@ -65,6 +78,7 @@ fun RoutineListScreenContainer(
6578
onShowDeleteConfirmBottomSheet = { routine ->
6679
viewModel.sendIntent(RoutineListIntent.ShowDeleteConfirmBottomSheet(routine))
6780
},
81+
onShowEditConfirmBottomSheet = { viewModel.sendIntent(RoutineListIntent.ShowEditConfirmBottomSheet) },
6882
onRegisterRoutineClick = {},
6983
onBackClick = { viewModel.sendIntent(RoutineListIntent.NavigateToBack) },
7084
)
@@ -75,6 +89,7 @@ private fun RoutineListScreen(
7589
uiState: RoutineListState,
7690
onDateSelect: (LocalDate) -> Unit,
7791
onShowDeleteConfirmBottomSheet: (RoutineUiModel) -> Unit,
92+
onShowEditConfirmBottomSheet: () -> Unit,
7893
onRegisterRoutineClick: () -> Unit,
7994
onBackClick: () -> Unit,
8095
modifier: Modifier = Modifier,
@@ -122,6 +137,7 @@ private fun RoutineListScreen(
122137
) { routine ->
123138
RoutineDetailsCard(
124139
routine = routine,
140+
onEditClick = { onShowEditConfirmBottomSheet() },
125141
onDeleteClick = { onShowDeleteConfirmBottomSheet(routine) },
126142
)
127143
}
@@ -137,6 +153,7 @@ private fun RoutineListScreenPreview() {
137153
uiState = RoutineListState(),
138154
onDateSelect = {},
139155
onShowDeleteConfirmBottomSheet = {},
156+
onShowEditConfirmBottomSheet = {},
140157
onRegisterRoutineClick = {},
141158
onBackClick = {},
142159
)

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class RoutineListViewModel @Inject constructor(
2828
?.let { dateString ->
2929
runCatching { LocalDate.parse(dateString) }.getOrNull()
3030
}
31-
?: LocalDate.now()
31+
?: LocalDate.now(),
3232
),
3333
) {
3434

@@ -53,6 +53,8 @@ class RoutineListViewModel @Inject constructor(
5353
}
5454

5555
is RoutineListIntent.HideDeleteConfirmBottomSheet -> state.copy(deleteConfirmBottomSheetVisible = false)
56+
is RoutineListIntent.ShowEditConfirmBottomSheet -> state.copy(editConfirmBottomSheetVisible = true)
57+
is RoutineListIntent.HideEditConfirmBottomSheet -> state.copy(editConfirmBottomSheetVisible = false)
5658

5759
is RoutineListIntent.NavigateToBack -> {
5860
sendSideEffect(RoutineListSideEffect.NavigateToBack)

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/component/template/RoutineDetailsCard.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel
2727
@Composable
2828
fun RoutineDetailsCard(
2929
routine: RoutineUiModel,
30+
onEditClick: () -> Unit,
3031
onDeleteClick: () -> Unit,
3132
modifier: Modifier = Modifier,
3233
) {
@@ -66,7 +67,7 @@ fun RoutineDetailsCard(
6667

6768
BitnagilIconButton(
6869
id = R.drawable.ic_edit,
69-
onClick = { /*TODO*/ },
70+
onClick = onEditClick,
7071
tint = null,
7172
paddingValues = PaddingValues(12.dp),
7273
)
@@ -148,8 +149,9 @@ private fun RoutineDetailsCardPreview() {
148149
executionTime = "12:00:00",
149150
routineDate = "2025-08-15",
150151
subRoutineNames = listOf("어쩌구", "저쩌구", "얼씨구"),
151-
recommendedRoutineType = null
152+
recommendedRoutineType = null,
152153
),
154+
onEditClick = {},
153155
onDeleteClick = {},
154156
)
155157
}

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineListIntent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ sealed class RoutineListIntent : MviIntent {
99
data class OnDateSelect(val date: LocalDate) : RoutineListIntent()
1010
data class ShowDeleteConfirmBottomSheet(val routine: RoutineUiModel) : RoutineListIntent()
1111
data object HideDeleteConfirmBottomSheet : RoutineListIntent()
12+
data object ShowEditConfirmBottomSheet : RoutineListIntent()
13+
data object HideEditConfirmBottomSheet : RoutineListIntent()
1214
data object NavigateToBack : RoutineListIntent()
1315
}

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineListState.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ data class RoutineListState(
1212
val selectedRoutine: RoutineUiModel? = null,
1313
val selectedDate: LocalDate = LocalDate.now(),
1414
val deleteConfirmBottomSheetVisible: Boolean = false,
15+
val editConfirmBottomSheetVisible: Boolean = false,
1516
) : MviState {
1617
val currentWeekDates: List<LocalDate>
1718
get() = selectedDate.getCurrentWeekDays()

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ fun Routine.toUiModel(): RoutineUiModel =
2727
subRoutineNames = this.subRoutineNames,
2828
recommendedRoutineType = this.recommendedRoutineType,
2929
)
30-

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutinesUiModel.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ fun Routines.toUiModel(): RoutinesUiModel =
1515
dayRoutines.toUiModel()
1616
},
1717
)
18-

0 commit comments

Comments
 (0)