diff --git a/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/common/DateTimeView.kt b/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/common/DateTimeView.kt index 1e95abcae..0358c21da 100644 --- a/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/common/DateTimeView.kt +++ b/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/common/DateTimeView.kt @@ -7,12 +7,11 @@ 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.date.timeFormatter -import band.effective.office.tablet.core.ui.date_booking + 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.core.ui.utils.DateDisplayMapper import kotlinx.datetime.LocalDateTime -import kotlinx.datetime.format import org.jetbrains.compose.resources.stringResource @Composable @@ -29,8 +28,8 @@ fun DateTimeView( text = stringResource( Res.string.date_booking, startTime, - startTime.format(timeFormatter), - finishTime.format(timeFormatter) + DateDisplayMapper.formatTime(startTime), + DateDisplayMapper.formatTime(finishTime) ), style = MaterialTheme.typography.h5, color = LocalCustomColorsPalette.current.primaryTextAndIcon diff --git a/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/common/SuccessFastSelectRoomView.kt b/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/common/SuccessFastSelectRoomView.kt index 3e13cbd2a..4749a8c81 100644 --- a/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/common/SuccessFastSelectRoomView.kt +++ b/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/common/SuccessFastSelectRoomView.kt @@ -18,11 +18,10 @@ import androidx.compose.ui.unit.dp 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.core.ui.utils.DateDisplayMapper import kotlinx.datetime.LocalDateTime -import kotlinx.datetime.format import org.jetbrains.compose.resources.stringResource @Composable @@ -58,7 +57,7 @@ fun SuccessFastSelectRoomView( contentAlignment = Alignment.Center ) { Text( - text = stringResource(Res.string.booked_until, finishTime.format(timeFormatter)), + text = stringResource(Res.string.booked_until, DateDisplayMapper.formatTime(finishTime)), style = MaterialTheme.typography.h5, color = LocalCustomColorsPalette.current.primaryTextAndIcon ) diff --git a/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/BookingEditor.kt b/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/BookingEditor.kt index 038c91979..73baff4f3 100644 --- a/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/BookingEditor.kt +++ b/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/BookingEditor.kt @@ -21,7 +21,6 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -29,7 +28,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import band.effective.office.tablet.core.domain.model.Organizer -import band.effective.office.tablet.core.domain.util.timeFormatter import band.effective.office.tablet.core.ui.button.SuccessButton import band.effective.office.tablet.core.ui.common.AlertButton import band.effective.office.tablet.core.ui.common.CrossButtonView @@ -41,6 +39,7 @@ import band.effective.office.tablet.core.ui.common.SuccessSelectRoomView import band.effective.office.tablet.core.ui.date.DateTimeView import band.effective.office.tablet.core.ui.theme.h3 import band.effective.office.tablet.core.ui.theme.h6 +import band.effective.office.tablet.core.ui.utils.DateDisplayMapper import band.effective.office.tablet.feature.bookingEditor.Res import band.effective.office.tablet.feature.bookingEditor.booking_time_button import band.effective.office.tablet.feature.bookingEditor.booking_view_title @@ -54,7 +53,6 @@ import band.effective.office.tablet.feature.bookingEditor.presentation.datetimep import band.effective.office.tablet.feature.bookingEditor.update_button import com.arkivanov.decompose.extensions.compose.stack.Children import kotlinx.datetime.LocalDateTime -import kotlinx.datetime.format import org.jetbrains.compose.resources.stringResource @Composable @@ -116,8 +114,8 @@ fun BookingEditor( enableUpdateButton = state.enableUpdateButton, isNewEvent = !state.isCreatedEvent(), onCreateEvent = { component.sendIntent(Intent.OnBooking) }, - start = state.event.startTime.format(timeFormatter), - finish = state.event.finishTime.format(timeFormatter), + start = DateDisplayMapper.formatTime(state.event.startTime), + finish = DateDisplayMapper.formatTime(state.event.finishTime), room = component.roomName, isTimeInPastError = state.isTimeInPastError, isEditable = state.event.isEditable, diff --git a/clients/tablet/feature/fastbooking/src/commonMain/kotlin/band/effective/office/tablet/feature/fastBooking/presentation/FastBooking.kt b/clients/tablet/feature/fastbooking/src/commonMain/kotlin/band/effective/office/tablet/feature/fastBooking/presentation/FastBooking.kt index c8715c764..6a2eafdee 100644 --- a/clients/tablet/feature/fastbooking/src/commonMain/kotlin/band/effective/office/tablet/feature/fastBooking/presentation/FastBooking.kt +++ b/clients/tablet/feature/fastbooking/src/commonMain/kotlin/band/effective/office/tablet/feature/fastBooking/presentation/FastBooking.kt @@ -30,11 +30,11 @@ import band.effective.office.tablet.core.ui.common.CrossButtonView import band.effective.office.tablet.core.ui.common.FailureFastSelectRoomView import band.effective.office.tablet.core.ui.common.Loader import band.effective.office.tablet.core.ui.common.SuccessFastSelectRoomView -import band.effective.office.tablet.core.ui.date.timeFormatter import band.effective.office.tablet.core.ui.error 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.core.ui.utils.DateDisplayMapper import com.arkivanov.decompose.extensions.compose.stack.Children import org.jetbrains.compose.resources.stringResource @@ -47,7 +47,6 @@ import org.jetbrains.compose.resources.stringResource @Composable fun FastBooking(component: FastBookingComponent) { val state by component.state.collectAsState() - val timeFormat = remember { timeFormatter } Children(stack = component.childStack, modifier = Modifier.padding(35.dp)) { modal -> Dialog( @@ -62,7 +61,7 @@ fun FastBooking(component: FastBookingComponent) { ) { Spacer(modifier = Modifier.height(50.dp)) Text( - text = timeFormat.format(state.currentTime), + text = DateDisplayMapper.formatTime(state.currentTime), style = MaterialTheme.typography.h2, color = LocalCustomColorsPalette.current.primaryTextAndIcon ) diff --git a/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/components/uiComponent/BusyRoomInfoComponent.kt b/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/components/uiComponent/BusyRoomInfoComponent.kt index 563389c80..b040d892c 100644 --- a/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/components/uiComponent/BusyRoomInfoComponent.kt +++ b/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/components/uiComponent/BusyRoomInfoComponent.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.interaction.collectIsPressedAsState import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -20,11 +19,11 @@ 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.domain.util.toFormattedString import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette import band.effective.office.tablet.core.ui.theme.h5 import band.effective.office.tablet.core.ui.theme.roomInfoColor import band.effective.office.tablet.core.ui.theme.undefineStateColor +import band.effective.office.tablet.core.ui.utils.DateDisplayMapper import band.effective.office.tablet.feature.main.Res import band.effective.office.tablet.feature.main.room_occupancy_date import band.effective.office.tablet.feature.main.room_occupancy_time @@ -62,7 +61,7 @@ fun BusyRoomInfoComponent( isError = isError ) { Text( - text = stringResource(Res.string.room_occupancy_date, event.finishTime.toFormattedString("HH:mm")) + + text = stringResource(Res.string.room_occupancy_date, DateDisplayMapper.formatTime(event.finishTime)) + " " + if (timeToFinish > 0) stringResource(Res.string.room_occupancy_time, timeToFinish.getDuration()) else "", style = MaterialTheme.typography.h5, color = roomInfoColor diff --git a/media/tablet/demo-tablet.gif b/media/tablet/demo-tablet.gif index 4255f2a26..affa9d20e 100644 Binary files a/media/tablet/demo-tablet.gif and b/media/tablet/demo-tablet.gif differ