Коммит 29c75771 создал по автору Radch-enko's avatar Radch-enko
Просмотр файлов

Refactor: modularize fast booking feature and relocate DeleteBookingUseCase

- Moved `DeleteBookingUseCase` to `core/domain` module for better reuse across features.
- Extracted `FastEvent` logic into a new `fastBooking` module with dedicated DI setup and updated dependencies.
- Renamed `FastEventComponent` to `FastBookingComponent` for improved clarity and consistency.
- Updated references and file paths for `FastEvent` to align with the new `fastBooking` module.
- Adjusted Gradle and DI configurations to support the modularized `fastBooking` feature.
владелец 4f99cc15
...@@ -47,6 +47,7 @@ kotlin { ...@@ -47,6 +47,7 @@ kotlin {
implementation(project(":clients:tablet:feature:main")) implementation(project(":clients:tablet:feature:main"))
implementation(project(":clients:tablet:feature:settings")) implementation(project(":clients:tablet:feature:settings"))
implementation(project(":clients:tablet:feature:bookingEditor")) implementation(project(":clients:tablet:feature:bookingEditor"))
implementation(project(":clients:tablet:feature:fastBooking"))
implementation(project(":clients:tablet:core:data")) implementation(project(":clients:tablet:core:data"))
implementation(project(":clients:tablet:core:domain")) implementation(project(":clients:tablet:core:domain"))
......
...@@ -3,6 +3,7 @@ package band.effective.office.tablet.core.domain.di ...@@ -3,6 +3,7 @@ package band.effective.office.tablet.core.domain.di
import band.effective.office.tablet.core.domain.useCase.CheckBookingUseCase import band.effective.office.tablet.core.domain.useCase.CheckBookingUseCase
import band.effective.office.tablet.core.domain.useCase.CheckSettingsUseCase import band.effective.office.tablet.core.domain.useCase.CheckSettingsUseCase
import band.effective.office.tablet.core.domain.useCase.CreateBookingUseCase import band.effective.office.tablet.core.domain.useCase.CreateBookingUseCase
import band.effective.office.tablet.core.domain.useCase.DeleteBookingUseCase
import band.effective.office.tablet.core.domain.useCase.OrganizersInfoUseCase import band.effective.office.tablet.core.domain.useCase.OrganizersInfoUseCase
import band.effective.office.tablet.core.domain.useCase.RoomInfoUseCase import band.effective.office.tablet.core.domain.useCase.RoomInfoUseCase
import band.effective.office.tablet.core.domain.useCase.SelectRoomUseCase import band.effective.office.tablet.core.domain.useCase.SelectRoomUseCase
...@@ -27,4 +28,5 @@ val domainModule = module { ...@@ -27,4 +28,5 @@ val domainModule = module {
single { CreateBookingUseCase(get()) } single { CreateBookingUseCase(get()) }
single { UpdateBookingUseCase(get()) } single { UpdateBookingUseCase(get()) }
single { DeleteBookingUseCase(get()) }
} }
\ No newline at end of file
package band.effective.office.tablet.feature.main.domain package band.effective.office.tablet.core.domain.useCase
import band.effective.office.tablet.core.domain.model.EventInfo import band.effective.office.tablet.core.domain.model.EventInfo
import band.effective.office.tablet.core.domain.repository.EventManagerRepository import band.effective.office.tablet.core.domain.repository.EventManagerRepository
......
plugins {
id("band.effective.office.client.kmp.feature")
}
compose.resources {
publicResClass = false
packageOfResClass = "band.effective.office.tablet.feature.fastBooking"
generateResClass = auto
}
\ No newline at end of file
package band.effective.office.tablet.feature.main.presentation.fastevent package band.effective.office.tablet.feature.fastBooking.presentation
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
...@@ -34,7 +34,7 @@ import band.effective.office.tablet.core.ui.common.SuccessFastSelectRoomView ...@@ -34,7 +34,7 @@ import band.effective.office.tablet.core.ui.common.SuccessFastSelectRoomView
import com.arkivanov.decompose.extensions.compose.stack.Children import com.arkivanov.decompose.extensions.compose.stack.Children
@Composable @Composable
fun FastEventView(component: FastEventComponent) { fun FastBooking(component: FastBookingComponent) {
val state by component.state.collectAsState() val state by component.state.collectAsState()
val timeFormat = remember { timeFormatter } val timeFormat = remember { timeFormatter }
...@@ -42,7 +42,7 @@ fun FastEventView(component: FastEventComponent) { ...@@ -42,7 +42,7 @@ fun FastEventView(component: FastEventComponent) {
Dialog( Dialog(
onDismissRequest = { component.sendIntent(Intent.OnCloseWindowRequest) }, onDismissRequest = { component.sendIntent(Intent.OnCloseWindowRequest) },
properties = DialogProperties( properties = DialogProperties(
usePlatformDefaultWidth = modal.instance != FastEventComponent.ModalConfig.LoadingModal usePlatformDefaultWidth = modal.instance != FastBookingComponent.ModalConfig.LoadingModal
) )
) { ) {
Column( Column(
...@@ -61,17 +61,17 @@ fun FastEventView(component: FastEventComponent) { ...@@ -61,17 +61,17 @@ fun FastEventView(component: FastEventComponent) {
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
when (val modalInstance = modal.instance) { when (val modalInstance = modal.instance) {
FastEventComponent.ModalConfig.LoadingModal -> FastEventView( FastBookingComponent.ModalConfig.LoadingModal -> FastBooking(
onDismissRequest = { component.sendIntent(Intent.OnCloseWindowRequest) } onDismissRequest = { component.sendIntent(Intent.OnCloseWindowRequest) }
) )
is FastEventComponent.ModalConfig.FailureModal -> FailureFastSelectRoomView( is FastBookingComponent.ModalConfig.FailureModal -> FailureFastSelectRoomView(
onDismissRequest = { component.sendIntent(Intent.OnCloseWindowRequest) }, onDismissRequest = { component.sendIntent(Intent.OnCloseWindowRequest) },
minutes = state.minutesLeft, minutes = state.minutesLeft,
room = modalInstance.room room = modalInstance.room
) )
is FastEventComponent.ModalConfig.SuccessModal -> SuccessFastSelectRoomView( is FastBookingComponent.ModalConfig.SuccessModal -> SuccessFastSelectRoomView(
roomName = modalInstance.room, roomName = modalInstance.room,
finishTime = modalInstance.eventInfo.finishTime, finishTime = modalInstance.eventInfo.finishTime,
close = { component.sendIntent(Intent.OnCloseWindowRequest) }, close = { component.sendIntent(Intent.OnCloseWindowRequest) },
...@@ -86,7 +86,7 @@ fun FastEventView(component: FastEventComponent) { ...@@ -86,7 +86,7 @@ fun FastEventView(component: FastEventComponent) {
} }
@Composable @Composable
private fun FastEventView( private fun FastBooking(
onDismissRequest: () -> Unit onDismissRequest: () -> Unit
) { ) {
Box(contentAlignment = Alignment.Center) { Box(contentAlignment = Alignment.Center) {
......
package band.effective.office.tablet.feature.main.presentation.fastevent package band.effective.office.tablet.feature.fastBooking.presentation
import band.effective.office.tablet.core.domain.Either import band.effective.office.tablet.core.domain.Either
import band.effective.office.tablet.core.domain.model.EventInfo import band.effective.office.tablet.core.domain.model.EventInfo
import band.effective.office.tablet.core.domain.model.RoomInfo import band.effective.office.tablet.core.domain.model.RoomInfo
import band.effective.office.tablet.core.domain.useCase.CreateBookingUseCase
import band.effective.office.tablet.core.domain.useCase.DeleteBookingUseCase
import band.effective.office.tablet.core.domain.useCase.SelectRoomUseCase import band.effective.office.tablet.core.domain.useCase.SelectRoomUseCase
import band.effective.office.tablet.core.domain.useCase.TimerUseCase import band.effective.office.tablet.core.domain.useCase.TimerUseCase
import band.effective.office.tablet.core.domain.util.BootstrapperTimer import band.effective.office.tablet.core.domain.util.BootstrapperTimer
...@@ -12,8 +14,6 @@ import band.effective.office.tablet.core.domain.util.currentInstant ...@@ -12,8 +14,6 @@ import band.effective.office.tablet.core.domain.util.currentInstant
import band.effective.office.tablet.core.domain.util.currentLocalDateTime import band.effective.office.tablet.core.domain.util.currentLocalDateTime
import band.effective.office.tablet.core.ui.common.ModalWindow import band.effective.office.tablet.core.ui.common.ModalWindow
import band.effective.office.tablet.core.ui.utils.componentCoroutineScope import band.effective.office.tablet.core.ui.utils.componentCoroutineScope
import band.effective.office.tablet.core.domain.useCase.CreateBookingUseCase
import band.effective.office.tablet.feature.main.domain.DeleteBookingUseCase
import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.router.stack.StackNavigation import com.arkivanov.decompose.router.stack.StackNavigation
import com.arkivanov.decompose.router.stack.childStack import com.arkivanov.decompose.router.stack.childStack
...@@ -29,7 +29,7 @@ import kotlinx.serialization.Serializable ...@@ -29,7 +29,7 @@ import kotlinx.serialization.Serializable
import org.koin.core.component.KoinComponent import org.koin.core.component.KoinComponent
import org.koin.core.component.inject import org.koin.core.component.inject
class FastEventComponent( class FastBookingComponent(
private val componentContext: ComponentContext, private val componentContext: ComponentContext,
val minEventDuration: Int, val minEventDuration: Int,
val selectedRoom: RoomInfo, val selectedRoom: RoomInfo,
......
package band.effective.office.tablet.feature.main.presentation.fastevent package band.effective.office.tablet.feature.fastBooking.presentation
sealed interface Intent { sealed interface Intent {
data class OnFreeSelectRequest(val room: String) : Intent data class OnFreeSelectRequest(val room: String) : Intent
......
package band.effective.office.tablet.feature.main.presentation.fastevent package band.effective.office.tablet.feature.fastBooking.presentation
import band.effective.office.tablet.core.domain.model.EventInfo import band.effective.office.tablet.core.domain.model.EventInfo
import band.effective.office.tablet.core.domain.util.currentLocalDateTime import band.effective.office.tablet.core.domain.util.currentLocalDateTime
......
...@@ -6,6 +6,7 @@ kotlin { ...@@ -6,6 +6,7 @@ kotlin {
sourceSets { sourceSets {
commonMain.dependencies { commonMain.dependencies {
implementation(project(":clients:tablet:feature:bookingEditor")) implementation(project(":clients:tablet:feature:bookingEditor"))
implementation(project(":clients:tablet:feature:fastBooking"))
} }
} }
} }
......
package band.effective.office.tablet.feature.main.di package band.effective.office.tablet.feature.main.di
import band.effective.office.tablet.feature.main.domain.DeleteBookingUseCase import band.effective.office.tablet.core.domain.useCase.DeleteBookingUseCase
import band.effective.office.tablet.feature.main.domain.FreeUpRoomUseCase import band.effective.office.tablet.feature.main.domain.FreeUpRoomUseCase
import band.effective.office.tablet.feature.main.domain.GetRoomIndexUseCase import band.effective.office.tablet.feature.main.domain.GetRoomIndexUseCase
import band.effective.office.tablet.feature.main.domain.GetSlotsByRoomUseCase import band.effective.office.tablet.feature.main.domain.GetSlotsByRoomUseCase
...@@ -13,6 +13,5 @@ val mainScreenModule = module { ...@@ -13,6 +13,5 @@ val mainScreenModule = module {
single { GetTimeToNextEventUseCase() } single { GetTimeToNextEventUseCase() }
single { GetSlotsByRoomUseCase(get()) } single { GetSlotsByRoomUseCase(get()) }
single { FreeUpRoomUseCase(get()) } single { FreeUpRoomUseCase(get()) }
single { DeleteBookingUseCase(get()) }
single { SlotUiMapper() } single { SlotUiMapper() }
} }
\ No newline at end of file
...@@ -14,16 +14,16 @@ import band.effective.office.tablet.core.domain.util.minus ...@@ -14,16 +14,16 @@ import band.effective.office.tablet.core.domain.util.minus
import band.effective.office.tablet.core.domain.util.plus import band.effective.office.tablet.core.domain.util.plus
import band.effective.office.tablet.core.ui.common.ModalWindow import band.effective.office.tablet.core.ui.common.ModalWindow
import band.effective.office.tablet.core.ui.utils.componentCoroutineScope import band.effective.office.tablet.core.ui.utils.componentCoroutineScope
import band.effective.office.tablet.feature.main.domain.DeleteBookingUseCase import band.effective.office.tablet.core.domain.useCase.DeleteBookingUseCase
import band.effective.office.tablet.feature.main.domain.FreeUpRoomUseCase import band.effective.office.tablet.feature.main.domain.FreeUpRoomUseCase
import band.effective.office.tablet.feature.main.domain.GetRoomIndexUseCase import band.effective.office.tablet.feature.main.domain.GetRoomIndexUseCase
import band.effective.office.tablet.feature.main.domain.GetTimeToNextEventUseCase import band.effective.office.tablet.feature.main.domain.GetTimeToNextEventUseCase
import band.effective.office.tablet.feature.main.presentation.fastevent.FastEventComponent
import band.effective.office.tablet.feature.main.presentation.freeuproom.FreeSelectRoomComponent import band.effective.office.tablet.feature.main.presentation.freeuproom.FreeSelectRoomComponent
import band.effective.office.tablet.feature.main.presentation.main.navigation.ModalWindowsConfig import band.effective.office.tablet.feature.main.presentation.main.navigation.ModalWindowsConfig
import band.effective.office.tablet.feature.main.presentation.slot.SlotComponent import band.effective.office.tablet.feature.main.presentation.slot.SlotComponent
import band.effective.office.tablet.feature.main.presentation.slot.SlotIntent import band.effective.office.tablet.feature.main.presentation.slot.SlotIntent
import band.effective.office.tablet.feature.bookingEditor.presentation.BookingEditorComponent import band.effective.office.tablet.feature.bookingEditor.presentation.BookingEditorComponent
import band.effective.office.tablet.feature.fastBooking.presentation.FastBookingComponent
import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.router.slot.SlotNavigation import com.arkivanov.decompose.router.slot.SlotNavigation
import com.arkivanov.decompose.router.slot.activate import com.arkivanov.decompose.router.slot.activate
...@@ -230,7 +230,7 @@ class MainComponent( ...@@ -230,7 +230,7 @@ class MainComponent(
onCloseRequest = navigation::dismiss, onCloseRequest = navigation::dismiss,
) )
is ModalWindowsConfig.FastEvent -> FastEventComponent( is ModalWindowsConfig.FastEvent -> FastBookingComponent(
componentContext = componentContext, componentContext = componentContext,
minEventDuration = modalWindows.minEventDuration, minEventDuration = modalWindows.minEventDuration,
selectedRoom = modalWindows.selectedRoom, selectedRoom = modalWindows.selectedRoom,
......
...@@ -14,12 +14,12 @@ import androidx.compose.ui.graphics.Color ...@@ -14,12 +14,12 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import band.effective.office.tablet.core.ui.LoadMainScreen import band.effective.office.tablet.core.ui.LoadMainScreen
import band.effective.office.tablet.core.ui.common.ErrorMainScreen import band.effective.office.tablet.core.ui.common.ErrorMainScreen
import band.effective.office.tablet.feature.main.presentation.fastevent.FastEventComponent import band.effective.office.tablet.feature.bookingEditor.presentation.BookingEditor
import band.effective.office.tablet.feature.main.presentation.fastevent.FastEventView import band.effective.office.tablet.feature.bookingEditor.presentation.BookingEditorComponent
import band.effective.office.tablet.feature.fastBooking.presentation.FastBooking
import band.effective.office.tablet.feature.fastBooking.presentation.FastBookingComponent
import band.effective.office.tablet.feature.main.presentation.freeuproom.FreeSelectRoomComponent import band.effective.office.tablet.feature.main.presentation.freeuproom.FreeSelectRoomComponent
import band.effective.office.tablet.feature.main.presentation.freeuproom.FreeSelectRoomView import band.effective.office.tablet.feature.main.presentation.freeuproom.FreeSelectRoomView
import band.effective.office.tablet.feature.bookingEditor.presentation.BookingEditorComponent
import band.effective.office.tablet.feature.bookingEditor.presentation.BookingEditor
import com.arkivanov.decompose.extensions.compose.subscribeAsState import com.arkivanov.decompose.extensions.compose.subscribeAsState
import kotlin.time.ExperimentalTime import kotlin.time.ExperimentalTime
...@@ -73,7 +73,7 @@ fun MainScreen(component: MainComponent) { ...@@ -73,7 +73,7 @@ fun MainScreen(component: MainComponent) {
when (val activeComponent = activeWindowSlot.child?.instance) { when (val activeComponent = activeWindowSlot.child?.instance) {
is FreeSelectRoomComponent -> FreeSelectRoomView(freeSelectRoomComponent = activeComponent) is FreeSelectRoomComponent -> FreeSelectRoomView(freeSelectRoomComponent = activeComponent)
is BookingEditorComponent -> BookingEditor(component = activeComponent) is BookingEditorComponent -> BookingEditor(component = activeComponent)
is FastEventComponent -> FastEventView(component = activeComponent) is FastBookingComponent -> FastBooking(component = activeComponent)
} }
} }
} }
...@@ -47,4 +47,5 @@ include( ...@@ -47,4 +47,5 @@ include(
"clients:tablet:feature:main", "clients:tablet:feature:main",
"clients:tablet:feature:settings", "clients:tablet:feature:settings",
"clients:tablet:feature:bookingEditor", "clients:tablet:feature:bookingEditor",
"clients:tablet:feature:fastBooking",
) )
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать