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

Refactor: modularize booking editor and domain logic

- Moved `CreateBookingUseCase` and `UpdateBookingUseCase` to the `core/domain` module for better cross-module reusability.
- Extracted `BookingEditor` logic into a new `bookingEditor` module with di setup and updated dependencies.
- Replaced `UpdateEventComponent` with `BookingEditorComponent` across the main module to streamline event management.
- Consolidated shared UI components into the `core/ui` module to avoid duplication.
- Updated Gradle files and DI modules for consistent dependency management.
- Improved naming and organization of string resources for booking-related views.
владелец 040a3209
......@@ -46,6 +46,7 @@ kotlin {
implementation(project(":clients:tablet:core:ui"))
implementation(project(":clients:tablet:feature:main"))
implementation(project(":clients:tablet:feature:settings"))
implementation(project(":clients:tablet:feature:bookingEditor"))
implementation(project(":clients:tablet:core:data"))
implementation(project(":clients:tablet:core:domain"))
......
......@@ -2,6 +2,7 @@ package band.effective.office.tablet.di
import band.effective.office.tablet.core.data.di.dataModule
import band.effective.office.tablet.core.domain.di.domainModule
import band.effective.office.tablet.feature.bookingEditor.di.bookingEditorModule
import band.effective.office.tablet.feature.main.di.mainScreenModule
import org.koin.core.context.startKoin
......@@ -14,6 +15,7 @@ class KoinInitializer {
dataModule,
domainModule,
mainScreenModule,
bookingEditorModule,
)
}
}
......
......@@ -2,12 +2,14 @@ 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.CheckSettingsUseCase
import band.effective.office.tablet.core.domain.useCase.CreateBookingUseCase
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.SelectRoomUseCase
import band.effective.office.tablet.core.domain.useCase.SetRoomUseCase
import band.effective.office.tablet.core.domain.useCase.SlotUseCase
import band.effective.office.tablet.core.domain.useCase.TimerUseCase
import band.effective.office.tablet.core.domain.useCase.UpdateBookingUseCase
import band.effective.office.tablet.core.domain.useCase.UpdateUseCase
import org.koin.dsl.module
......@@ -22,4 +24,7 @@ val domainModule = module {
single { SlotUseCase() }
single { TimerUseCase() }
single { UpdateUseCase(roomInfoUseCase = get(), timerUseCase = get()) }
single { CreateBookingUseCase(get()) }
single { UpdateBookingUseCase(get()) }
}
\ Нет новой строки в конце файла
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.repository.EventManagerRepository
......
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.repository.EventManagerRepository
......
......@@ -16,4 +16,14 @@
<string name="timepicker_view_title"> Занять с </string>
<string name="apply_date_time_for_booking"> Подтвердить </string>
<string name="connection_lost">Нет подключения к интернету</string>
<string name="booked_until">Забронирована до %1$s</string>
<string name="cancel_book">Отменить бронь</string>
<string name="no_free">Свободных нет</string>
<string name="find_quiet_place">Через %1$s мин освободится %2$s. Пока что попробуйте найти тихое место в офисе</string>
<string name="failure_text">Вас кто-то опередил</string>
<string name="select_other_room">Попробуйте занять другую переговорку, либо выберите другое время брони</string>
<string name="time_booked">Это время уже занято</string>
<string name="date_booking">%1$s, %2$s — %3$s</string>
<string name="on_main">На главную</string>
<string name="success_text">Вы заняли %1$s</string>
</resources>
\ Нет новой строки в конце файла
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.RowScope
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.shape.RoundedCornerShape
......@@ -12,7 +12,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import band.effective.office.tablet.core.ui.common.Loader
import band.effective.office.tablet.core.ui.theme.CustomDarkColors
import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.core.ui.theme.h6_button
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.layout.Box
import androidx.compose.material3.MaterialTheme
......@@ -6,17 +6,21 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import band.effective.office.tablet.core.domain.model.EventInfo
import band.effective.office.tablet.core.domain.util.timeFormatter
import band.effective.office.tablet.core.ui.Res
import band.effective.office.tablet.core.ui.date.timeFormatter
import band.effective.office.tablet.core.ui.date_booking
import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.core.ui.theme.h5
import band.effective.office.tablet.feature.main.Res
import band.effective.office.tablet.feature.main.date_booking
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.format
import org.jetbrains.compose.resources.stringResource
@Composable
fun DateTimeView(modifier: Modifier, eventInfo: EventInfo) {
fun DateTimeView(
modifier: Modifier,
startTime: LocalDateTime,
finishTime: LocalDateTime,
) {
Box(
modifier = modifier,
contentAlignment = Alignment.Center
......@@ -24,9 +28,9 @@ fun DateTimeView(modifier: Modifier, eventInfo: EventInfo) {
Text(
text = stringResource(
Res.string.date_booking,
eventInfo.startTime,
eventInfo.startTime.format(timeFormatter),
eventInfo.finishTime.format(timeFormatter)
startTime,
startTime.format(timeFormatter),
finishTime.format(timeFormatter)
),
style = MaterialTheme.typography.h5,
color = LocalCustomColorsPalette.current.primaryTextAndIcon
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
......@@ -42,7 +42,6 @@ import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.toSize
import androidx.compose.ui.window.PopupProperties
import band.effective.office.tablet.core.domain.model.Organizer
import band.effective.office.tablet.core.ui.Res
import band.effective.office.tablet.core.ui.arrow_to_down
import band.effective.office.tablet.core.ui.selectbox_organizer_error
......@@ -56,11 +55,10 @@ import org.jetbrains.compose.resources.stringResource
@Composable
fun EventOrganizerView(
modifier: Modifier = Modifier,
selectOrganizers: List<Organizer>,
selectOrganizers: List<String>,
expanded: Boolean,
selectedItem: Organizer,
onExpandedChange: () -> Unit,
onSelectItem: (Organizer) -> Unit,
onSelectItem: (String) -> Unit,
onInput: (String) -> Unit,
isInputError: Boolean,
onDoneInput: (String) -> Unit,
......@@ -155,7 +153,7 @@ fun EventOrganizerView(
focusManager.clearFocus()
onExpandedChange()
},
text = { Text(text = organizer.fullName) },
text = { Text(text = organizer) },
contentPadding = ExposedDropdownMenuDefaults.ItemContentPadding,
)
}
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
......@@ -18,13 +18,12 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import band.effective.office.tablet.core.ui.Res
import band.effective.office.tablet.core.ui.common.CrossButtonView
import band.effective.office.tablet.core.ui.failure
import band.effective.office.tablet.core.ui.find_quiet_place
import band.effective.office.tablet.core.ui.no_free
import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.core.ui.theme.h2
import band.effective.office.tablet.core.ui.theme.h4
import band.effective.office.tablet.feature.main.find_quiet_place
import band.effective.office.tablet.feature.main.no_free
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
......@@ -55,7 +54,7 @@ fun FailureFastSelectRoomView(
)
Spacer(modifier = Modifier.height(24.dp))
Text(
text = stringResource(band.effective.office.tablet.feature.main.Res.string.no_free),
text = stringResource(Res.string.no_free),
style = MaterialTheme.typography.h2,
color = LocalCustomColorsPalette.current.primaryTextAndIcon,
textAlign = TextAlign.Center
......@@ -63,7 +62,7 @@ fun FailureFastSelectRoomView(
Spacer(modifier = Modifier.height(24.dp))
Text(
text = stringResource(
band.effective.office.tablet.feature.main.Res.string.find_quiet_place,
Res.string.find_quiet_place,
minutes.toString(), room
),
style = MaterialTheme.typography.h4,
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
......@@ -18,13 +18,12 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import band.effective.office.tablet.core.ui.Res
import band.effective.office.tablet.core.ui.common.CrossButtonView
import band.effective.office.tablet.core.ui.failure
import band.effective.office.tablet.core.ui.failure_text
import band.effective.office.tablet.core.ui.select_other_room
import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.core.ui.theme.h2
import band.effective.office.tablet.core.ui.theme.h4
import band.effective.office.tablet.feature.main.failure_text
import band.effective.office.tablet.feature.main.select_other_room
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
......@@ -51,14 +50,14 @@ fun FailureSelectRoomView(onDismissRequest: () -> Unit) {
)
Spacer(modifier = Modifier.height(24.dp))
Text(
text = stringResource(band.effective.office.tablet.feature.main.Res.string.failure_text),
text = stringResource(Res.string.failure_text),
style = MaterialTheme.typography.h2,
color = LocalCustomColorsPalette.current.primaryTextAndIcon,
textAlign = TextAlign.Center
)
Spacer(modifier = Modifier.height(24.dp))
Text(
text = stringResource(band.effective.office.tablet.feature.main.Res.string.select_other_room),
text = stringResource(Res.string.select_other_room),
style = MaterialTheme.typography.h4,
minLines = 2,
textAlign = TextAlign.Center
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
......@@ -16,7 +16,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import band.effective.office.tablet.core.ui.Res
import band.effective.office.tablet.core.ui.common.Loader
import band.effective.office.tablet.core.ui.cross
import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.core.ui.theme.h6_button
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
......@@ -15,21 +15,20 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import band.effective.office.tablet.core.domain.model.EventInfo
import band.effective.office.tablet.core.ui.common.CrossButtonView
import band.effective.office.tablet.core.ui.Res
import band.effective.office.tablet.core.ui.booked_until
import band.effective.office.tablet.core.ui.cancel_book
import band.effective.office.tablet.core.ui.date.timeFormatter
import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.core.ui.theme.h5
import band.effective.office.tablet.feature.main.Res
import band.effective.office.tablet.feature.main.booked_until
import band.effective.office.tablet.feature.main.cancel_book
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.format
import org.jetbrains.compose.resources.stringResource
@Composable
fun SuccessFastSelectRoomView(
roomName: String,
eventInfo: EventInfo,
finishTime: LocalDateTime,
close: () -> Unit,
onFreeRoomRequest: (String) -> Unit,
isLoading: Boolean
......@@ -59,7 +58,7 @@ fun SuccessFastSelectRoomView(
contentAlignment = Alignment.Center
) {
Text(
text = stringResource(Res.string.booked_until, eventInfo.finishTime.format(timeFormatter)),
text = stringResource(Res.string.booked_until, finishTime.format(timeFormatter)),
style = MaterialTheme.typography.h5,
color = LocalCustomColorsPalette.current.primaryTextAndIcon
)
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
......@@ -12,18 +12,18 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import band.effective.office.tablet.core.domain.model.EventInfo
import band.effective.office.tablet.core.ui.common.CrossButtonView
import band.effective.office.tablet.core.ui.Res
import band.effective.office.tablet.core.ui.on_main
import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.feature.main.Res
import band.effective.office.tablet.feature.main.on_main
import kotlinx.datetime.LocalDateTime
import org.jetbrains.compose.resources.stringResource
@Composable
fun SuccessSelectRoomView(
roomName: String,
organizerName: String,
eventInfo: EventInfo,
startTime: LocalDateTime,
finishTime: LocalDateTime,
close: () -> Unit
) {
Column(
......@@ -49,7 +49,8 @@ fun SuccessSelectRoomView(
Spacer(modifier = Modifier.height(50.dp))
DateTimeView(
modifier = Modifier.fillMaxWidth(),
eventInfo = eventInfo
startTime = startTime,
finishTime = finishTime,
)
Spacer(modifier = Modifier.height(12.dp))
OrganizerEventView(organizer = organizerName)
......
package band.effective.office.tablet.feature.main.presentation.common
package band.effective.office.tablet.core.ui.common
import androidx.compose.foundation.layout.Box
import androidx.compose.material3.MaterialTheme
......@@ -6,10 +6,10 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import band.effective.office.tablet.core.ui.Res
import band.effective.office.tablet.core.ui.success_text
import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.core.ui.theme.h2
import band.effective.office.tablet.feature.main.Res
import band.effective.office.tablet.feature.main.success_text
import org.jetbrains.compose.resources.stringResource
@Composable
......
plugins {
id("band.effective.office.client.kmp.feature")
}
compose.resources {
publicResClass = false
packageOfResClass = "band.effective.office.tablet.feature.bookingEditor"
generateResClass = auto
}
\ Нет новой строки в конце файла
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать