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

Refactor: replace `Instant` with `LocalDateTime` for improved date management...

Refactor: replace `Instant` with `LocalDateTime` for improved date management and interface consistency

- Updated all references of `Instant` to `LocalDateTime` in the `Main` module and associated components.
- Removed unused intents (`OnUpdate`, `OnResetSelectDate`) in `MainComponent`.
- Enhanced date handling logic with new `currentDate` state and validation to prevent past date selections.
- Refactored `DateTimeView` structure with reusable composable functions for better readability.
- Improved date transition animations and formatting in `DateTimeView`.
владелец b6f63f82
package band.effective.office.tablet.core.domain
import band.effective.office.tablet.core.domain.util.currentLocalDateTime
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.LocalTime
......@@ -9,10 +10,10 @@ object OfficeTime {
private val startWorkLocalTime = LocalTime(8, 0)
private val endWorkLocalTime = LocalTime(22, 0)
fun startWorkTime(localDateTime: LocalDateTime = currentLocalDateTime): LocalDateTime =
LocalDateTime(localDateTime.date, startWorkLocalTime)
fun startWorkTime(localDate: LocalDate = currentLocalDateTime.date): LocalDateTime =
LocalDateTime(localDate, startWorkLocalTime)
fun finishWorkTime(localDateTime: LocalDateTime = currentLocalDateTime): LocalDateTime =
LocalDateTime(localDateTime.date, endWorkLocalTime)
fun finishWorkTime(localDate: LocalDate = currentLocalDateTime.date): LocalDateTime =
LocalDateTime(localDate, endWorkLocalTime)
}
\ Нет новой строки в конце файла
package band.effective.office.tablet.core.domain.util
import kotlin.time.Clock
import kotlin.time.Duration
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Instant
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.LocalTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toInstant
import kotlinx.datetime.toLocalDateTime
......@@ -12,6 +13,7 @@ import kotlinx.datetime.toLocalDateTime
val defaultTimeZone = TimeZone.currentSystemDefault()
val currentLocalDateTime: LocalDateTime get() = Clock.System.now().toLocalDateTime(defaultTimeZone)
val currentLocalDate: LocalDate get() = Clock.System.now().toLocalDateTime(defaultTimeZone).date
val currentInstant: Instant get() = Instant.fromEpochMilliseconds(Clock.System.now().toEpochMilliseconds())
fun roundUpToNextQuarter(dateTime: LocalDateTime): LocalDateTime {
......@@ -28,39 +30,5 @@ fun roundUpToNextQuarter(dateTime: LocalDateTime): LocalDateTime {
val LocalDateTime.asInstant get() = toInstant(defaultTimeZone)
val Instant.asLocalDateTime get() = this.toLocalDateTime(defaultTimeZone)
val LocalTime.Companion.Max
get() = LocalTime(
hour = 23,
minute = 59,
second = 59,
nanosecond = 999999999
)
val LocalTime.Companion.Min
get() = LocalTime(
hour = 0,
minute = 0,
second = 0,
nanosecond = 0
)
fun LocalTime.Companion.of(
hour: Int,
minute: Int
) = LocalTime(hour = hour, minute = minute, second = 0, nanosecond = 0)
fun LocalTime.truncatedToMinute() = LocalTime.of(
hour = hour,
minute = minute
)
fun LocalTime.withHour(hour: Int) =
LocalTime(hour = hour, minute = minute, second = second, nanosecond = nanosecond)
fun LocalTime.withMinute(minute: Int) =
LocalTime(hour = hour, minute = minute, second = second, nanosecond = nanosecond)
fun LocalTime.isBefore(other: LocalTime) = this < other
fun LocalTime.isAfter(other: LocalTime) = this > other
\ Нет новой строки в конце файла
fun LocalDateTime.plus(duration: Duration) = asInstant.plus(duration).asLocalDateTime
fun LocalDateTime.minus(duration: Duration) = asInstant.minus(duration).asLocalDateTime
package band.effective.office.tablet.core.ui.date
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.with
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.height
......@@ -14,11 +21,13 @@ import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
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.arrow_left
......@@ -28,9 +37,7 @@ import band.effective.office.tablet.core.ui.theme.LocalCustomColorsPalette
import band.effective.office.tablet.core.ui.theme.h6
import band.effective.office.tablet.core.ui.theme.h8
import kotlin.time.ExperimentalTime
import kotlin.time.Instant
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import kotlinx.datetime.LocalDateTime
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
......@@ -38,91 +45,129 @@ import org.jetbrains.compose.resources.stringResource
@Composable
fun DateTimeView(
modifier: Modifier,
selectDate: Instant,
currentDate: Instant? = null,
back: () -> Unit = {},
selectDate: LocalDateTime,
currentDate: LocalDateTime? = null,
increment: () -> Unit,
decrement: () -> Unit,
onOpenDateTimePickerModal: () -> Unit,
showTitle: Boolean = false
) {
val backButtonWeight = when {
currentDate == null -> 0f
currentDate != selectDate -> 1.5f
else -> 0f
}
val timeDayMonthDateFormat = remember { dateTimeFormat }
val dayMonthDateFormat = remember { dayMonthFormat }
Column(modifier = modifier) {
if (showTitle) {
Text(
text = stringResource(Res.string.select_date_tine_title),
color = LocalCustomColorsPalette.current.secondaryTextAndIcon,
style = MaterialTheme.typography.h8
)
DateTimeTitle()
Spacer(modifier = Modifier.height(10.dp))
}
Row {
Button(
modifier = Modifier.fillMaxHeight().weight(1f).clip(RoundedCornerShape(15.dp)),
onClick = { decrement() },
colors = ButtonDefaults.buttonColors(
containerColor = LocalCustomColorsPalette.current.elevationBackground
)
) {
Image(
modifier = Modifier,
painter = painterResource(Res.drawable.arrow_left),
contentDescription = null
)
}
PreviousDateButton(decrement)
Spacer(modifier = Modifier.width(10.dp))
Button(
modifier = Modifier.fillMaxHeight().weight(4f - backButtonWeight)
.clip(RoundedCornerShape(15.dp)),
onClick = { onOpenDateTimePickerModal() },
colors = ButtonDefaults.buttonColors(
containerColor = LocalCustomColorsPalette.current.elevationBackground
)
) {
Text(
text = timeDayMonthDateFormat.format(selectDate.toLocalDateTime(TimeZone.currentSystemDefault())),
style = MaterialTheme.typography.h6
)
}
SelectedDate(onOpenDateTimePickerModal, selectDate, currentDate)
Spacer(modifier = Modifier.width(10.dp))
if (backButtonWeight > 0) {
Button(
modifier = Modifier.fillMaxHeight().weight(backButtonWeight)
.clip(RoundedCornerShape(15.dp))
.border(3.dp, Color.White, RoundedCornerShape(15.dp)),
onClick = back,
colors = ButtonDefaults.buttonColors(
containerColor = LocalCustomColorsPalette.current.elevationBackground
)
) {
Text(
text = dayMonthDateFormat.format(currentDate?.toLocalDateTime(TimeZone.UTC)!!),
style = MaterialTheme.typography.h6,
textAlign = TextAlign.Center
)
}
Spacer(modifier = Modifier.width(10.dp))
}
Button(
modifier = Modifier.fillMaxHeight().weight(1f).clip(RoundedCornerShape(15.dp)),
onClick = { increment() },
colors = ButtonDefaults.buttonColors(
containerColor = LocalCustomColorsPalette.current.elevationBackground
)
) {
Image(
modifier = Modifier,
painter = painterResource(Res.drawable.arrow_right),
contentDescription = null
)
}
NextDateButton(increment)
}
}
}
@Composable
private fun RowScope.NextDateButton(increment: () -> Unit) {
Button(
modifier = Modifier.fillMaxHeight().weight(1f).clip(RoundedCornerShape(15.dp)),
onClick = { increment() },
colors = ButtonDefaults.buttonColors(
containerColor = LocalCustomColorsPalette.current.elevationBackground
)
) {
Image(
modifier = Modifier,
painter = painterResource(Res.drawable.arrow_right),
contentDescription = null
)
}
}
@OptIn(ExperimentalAnimationApi::class)
@Composable
private fun RowScope.SelectedDate(
onOpenDateTimePickerModal: () -> Unit,
selectDate: LocalDateTime,
currentDate: LocalDateTime?
) {
val timeDayMonthDateFormat = remember { dateTimeFormat }
val dayMonthDateFormat = remember { dayMonthFormat }
var previousDate by remember { mutableStateOf(selectDate) }
val slideDirection = remember(selectDate) {
if (selectDate > previousDate) AnimatedContentTransitionScope.SlideDirection.Left
else AnimatedContentTransitionScope.SlideDirection.Right
}
val displayedFormat by remember(selectDate) {
mutableStateOf(
if (currentDate != null && selectDate.date > currentDate.date) dayMonthDateFormat else timeDayMonthDateFormat
)
}
LaunchedEffect(selectDate) {
previousDate = selectDate
}
Button(
modifier = Modifier
.fillMaxHeight()
.weight(4f)
.clip(RoundedCornerShape(15.dp)),
onClick = onOpenDateTimePickerModal,
colors = ButtonDefaults.buttonColors(
containerColor = LocalCustomColorsPalette.current.elevationBackground
),
contentPadding = PaddingValues(0.dp)
) {
AnimatedContent(
targetState = displayedFormat.format(selectDate),
transitionSpec = {
slideIntoContainer(slideDirection) + fadeIn() with
slideOutOfContainer(slideDirection.opposite()) + fadeOut()
},
label = "AnimatedDateChange"
) { formattedDate ->
Text(
text = formattedDate,
style = MaterialTheme.typography.h6
)
}
}
}
// Удлинение SlideDirection для удобства
private fun AnimatedContentTransitionScope.SlideDirection.opposite(): AnimatedContentTransitionScope.SlideDirection {
return when (this) {
AnimatedContentTransitionScope.SlideDirection.Left -> AnimatedContentTransitionScope.SlideDirection.Right
AnimatedContentTransitionScope.SlideDirection.Right -> AnimatedContentTransitionScope.SlideDirection.Left
else -> this
}
}
@Composable
private fun RowScope.PreviousDateButton(decrement: () -> Unit) {
Button(
modifier = Modifier.fillMaxHeight().weight(1f).clip(RoundedCornerShape(15.dp)),
onClick = { decrement() },
colors = ButtonDefaults.buttonColors(
containerColor = LocalCustomColorsPalette.current.elevationBackground
)
) {
Image(
modifier = Modifier,
painter = painterResource(Res.drawable.arrow_left),
contentDescription = null
)
}
}
@Composable
private fun DateTimeTitle() {
Text(
text = stringResource(Res.string.select_date_tine_title),
color = LocalCustomColorsPalette.current.secondaryTextAndIcon,
style = MaterialTheme.typography.h8
)
}
......@@ -7,19 +7,17 @@ import kotlinx.datetime.format.Padding
import kotlinx.datetime.format.char
val dateTimeFormat = LocalDateTime.Format {
monthNumber(padding = Padding.SPACE)
char('/')
dayOfMonth(padding = Padding.ZERO)
char(' ')
year()
char(' ')
hour(padding = Padding.ZERO)
char(':')
minute(padding = Padding.ZERO)
char(' ')
day(padding = Padding.ZERO)
char(' ')
monthName(MonthNames.ENGLISH_FULL)
}
val dayMonthFormat = LocalDateTime.Format {
dayOfMonth(padding = Padding.ZERO)
day(padding = Padding.ZERO)
char(' ')
monthName(MonthNames.ENGLISH_FULL)
}
......
......@@ -23,18 +23,17 @@ import band.effective.office.tablet.feature.main.components.RoomInfoComponent
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.components.SlotView
import kotlin.time.Clock
import kotlin.time.ExperimentalTime
import kotlin.time.Instant
import kotlinx.datetime.LocalDateTime
@OptIn(ExperimentalTime::class)
@Composable
fun RoomInfoLeftPanel(
slotComponent: SlotComponent,
selectedDate: Instant,
selectedDate: LocalDateTime,
currentDate: LocalDateTime,
onIncrementData: () -> Unit,
onDecrementData: () -> Unit,
onResetDate: () -> Unit,
roomList: List<RoomInfo>,
indexSelectRoom: Int,
onCancelEventRequest: () -> Unit,
......@@ -63,11 +62,10 @@ fun RoomInfoLeftPanel(
bottom = 0.dp
).height(70.dp),
selectDate = selectedDate,
currentDate = currentDate,
increment = onIncrementData,
decrement = onDecrementData,
onOpenDateTimePickerModal = onOpenDateTimePickerModal,
currentDate = Clock.System.now(),
back = onResetDate,
)
}
......
......@@ -15,7 +15,7 @@ class GetSlotsByRoomUseCase(
operator fun invoke(
roomInfo: RoomInfo,
start: LocalDateTime = currentLocalDateTime,
finish: LocalDateTime = OfficeTime.finishWorkTime(start)
finish: LocalDateTime = OfficeTime.finishWorkTime(start.date)
): List<Slot> {
val roundedStart = roundUpToNextQuarter(start)
return slotUseCase.getSlots(
......
......@@ -3,10 +3,7 @@ package band.effective.office.tablet.feature.main.presentation.main
sealed interface Intent {
object OnOpenFreeRoomModal : Intent
object RebootRequest : Intent
data class OnChangeEventRequest(val eventInfo: Any) : Intent
data class OnSelectRoom(val index: Int) : Intent
object OnUpdate : Intent
data class OnFastBooking(val minDuration: Int) : Intent
data class OnUpdateSelectDate(val updateInDays: Int) : Intent
object OnResetSelectDate : Intent
}
\ Нет новой строки в конце файла
......@@ -8,9 +8,10 @@ import band.effective.office.tablet.core.domain.useCase.RoomInfoUseCase
import band.effective.office.tablet.core.domain.useCase.TimerUseCase
import band.effective.office.tablet.core.domain.useCase.UpdateUseCase
import band.effective.office.tablet.core.domain.util.BootstrapperTimer
import band.effective.office.tablet.core.domain.util.asLocalDateTime
import band.effective.office.tablet.core.domain.util.currentInstant
import band.effective.office.tablet.core.domain.util.currentLocalDate
import band.effective.office.tablet.core.domain.util.currentLocalDateTime
import band.effective.office.tablet.core.domain.util.minus
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.utils.componentCoroutineScope
import band.effective.office.tablet.feature.main.domain.DeleteBookingUseCase
......@@ -28,7 +29,7 @@ import com.arkivanov.decompose.router.slot.SlotNavigation
import com.arkivanov.decompose.router.slot.activate
import com.arkivanov.decompose.router.slot.childSlot
import com.arkivanov.decompose.router.slot.dismiss
import io.github.aakira.napier.Napier
import kotlin.math.abs
import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
......@@ -46,7 +47,7 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.LocalDate
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
......@@ -151,19 +152,19 @@ class MainComponent(
// reset select date
currentTimeTimer.start(1.minutes) {
withContext(Dispatchers.Main) {
mutableState.update { it.copy(selectedDate = currentInstant) }
slotComponent.sendIntent(
SlotIntent.UpdateDate(
currentLocalDateTime
mutableState.update {
it.copy(
selectedDate = currentLocalDateTime,
currentDate = currentLocalDateTime,
)
)
}
slotComponent.sendIntent(SlotIntent.UpdateDate(currentLocalDate))
}
}
}
fun sendIntent(intent: Intent) {
when (intent) {
is Intent.OnChangeEventRequest -> TODO()
is Intent.OnFastBooking ->
navigation.activate(
ModalWindowsConfig.FastEvent(
......@@ -179,13 +180,7 @@ class MainComponent(
)
)
Intent.OnResetSelectDate -> {
slotComponent.sendIntent(SlotIntent.UpdateDate(currentLocalDateTime))
mutableState.update { it.copy(selectedDate = currentInstant) }
}
is Intent.OnSelectRoom -> selectRoom(intent.index)
Intent.OnUpdate -> reboot()
is Intent.OnUpdateSelectDate -> updateSelectDate(intent)
Intent.RebootRequest -> reboot(refresh = true)
}
......@@ -248,13 +243,18 @@ class MainComponent(
private fun updateSelectDate(intent: Intent.OnUpdateSelectDate) {
currentTimeTimer.restart()
currentRoomTimer.restart()
val selectedDate = state.value.selectedDate
val newDate = if (intent.updateInDays < 0) {
(state.value.selectedDate.minus(intent.updateInDays.days))
selectedDate.minus(abs(intent.updateInDays).days)
} else {
state.value.selectedDate.plus(intent.updateInDays.days)
selectedDate.plus(intent.updateInDays.days)
}
// there is no point in looking at bookings from the past days
if (newDate.date >= currentLocalDateTime.date) {
mutableState.update { it.copy(selectedDate = newDate) }
slotComponent.sendIntent(SlotIntent.UpdateDate(newDate.date))
}
mutableState.update { it.copy(selectedDate = newDate) }
slotComponent.sendIntent(SlotIntent.UpdateDate(newDate.asLocalDateTime))
}
private fun selectRoom(index: Int) {
......@@ -268,10 +268,10 @@ class MainComponent(
)
)
}
updateComponents(state.value.roomList[index], state.value.selectedDate.asLocalDateTime)
updateComponents(state.value.roomList[index], state.value.selectedDate.date)
}
private fun updateComponents(roomInfo: RoomInfo, date: LocalDateTime) {
private fun updateComponents(roomInfo: RoomInfo, date: LocalDate) {
slotComponent.sendIntent(
SlotIntent.UpdateRequest(
room = roomInfo.name,
......@@ -345,7 +345,7 @@ class MainComponent(
}
loadRooms()
state.roomList.getOrNull(roomIndex)?.let { roomInfo ->
updateComponents(roomInfo, state.selectedDate.asLocalDateTime)
updateComponents(roomInfo, state.selectedDate.date)
}
}
}
......@@ -46,11 +46,10 @@ fun MainScreen(component: MainComponent) {
onRoomButtonClick = { component.sendIntent(Intent.OnSelectRoom(it)) },
onCancelEventRequest = { component.sendIntent(Intent.OnOpenFreeRoomModal) },
onFastBooking = { component.sendIntent(Intent.OnFastBooking(it)) },
onUpdate = { component.sendIntent(Intent.OnUpdate) },
onIncrementData = { component.sendIntent(Intent.OnUpdateSelectDate(updateInDays = 1)) },
onDecrementData = { component.sendIntent(Intent.OnUpdateSelectDate(updateInDays = -1)) },
selectedDate = state.selectedDate,
onResetDate = { component.sendIntent(Intent.OnResetSelectDate) },
currentDate = state.currentDate,
onOpenDateTimePickerModalRequest = {}, // TODO
)
}
......
......@@ -10,7 +10,7 @@ import band.effective.office.tablet.feature.main.components.uiComponent.FastBook
import band.effective.office.tablet.feature.main.components.uiComponent.RoomInfoLeftPanel
import band.effective.office.tablet.feature.main.presentation.slot.SlotComponent
import kotlin.time.ExperimentalTime
import kotlin.time.Instant
import kotlinx.datetime.LocalDateTime
@OptIn(ExperimentalTime::class)
@Composable
......@@ -23,21 +23,20 @@ fun MainScreenView(
onRoomButtonClick: (Int) -> Unit,
onCancelEventRequest: () -> Unit,
onFastBooking: (Int) -> Unit,
onUpdate: () -> Unit,
onOpenDateTimePickerModalRequest: () -> Unit,
onIncrementData: () -> Unit,
onDecrementData: () -> Unit,
selectedDate: Instant,
onResetDate: () -> Unit
selectedDate: LocalDateTime,
currentDate: LocalDateTime,
) {
Box(modifier = Modifier.fillMaxSize()) {
Row(modifier = Modifier.fillMaxSize()) {
RoomInfoLeftPanel(
slotComponent = slotComponent,
selectedDate = selectedDate,
currentDate = currentDate,
onIncrementData = onIncrementData,
onDecrementData = onDecrementData,
onResetDate = onResetDate,
roomList = roomList,
indexSelectRoom = indexSelectRoom,
onCancelEventRequest = onCancelEventRequest,
......
package band.effective.office.tablet.feature.main.presentation.main
import band.effective.office.tablet.core.domain.model.RoomInfo
import kotlin.time.Clock
import kotlin.time.Instant
import band.effective.office.tablet.core.domain.util.currentLocalDateTime
import kotlinx.datetime.LocalDateTime
data class State(
val isLoad: Boolean,
......@@ -14,7 +14,8 @@ data class State(
val roomList: List<RoomInfo>,
val indexSelectRoom: Int,
val timeToNextEvent: Int,
val selectedDate: Instant,
val selectedDate: LocalDateTime,
val currentDate: LocalDateTime,
) {
companion object {
val defaultState =
......@@ -28,7 +29,8 @@ data class State(
roomList = listOf(),
indexSelectRoom = 0,
timeToNextEvent = 0,
selectedDate = Clock.System.now(),
selectedDate = currentLocalDateTime,
currentDate = currentLocalDateTime,
)
}
}
\ Нет новой строки в конце файла
......@@ -26,7 +26,7 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.LocalDate
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
......@@ -233,14 +233,11 @@ class SlotComponent(
}
}
private fun updateDate(newDate: LocalDateTime) = coroutineScope.launch {
private fun updateDate(newDate: LocalDate) = coroutineScope.launch {
roomInfoUseCase.getRoom(room = roomName())?.let { roomInfo ->
val slots = getSlotsByRoomUseCase(
roomInfo = roomInfo,
start = maxOf(
OfficeTime.startWorkTime(newDate),
currentLocalDateTime
)
start = OfficeTime.startWorkTime(newDate)
)
val uiSlots = slots.map(slotUiMapper::map)
mutableState.update { it.copy(slots = uiSlots) }
......
package band.effective.office.tablet.feature.main.presentation.slot
import band.effective.office.tablet.core.domain.model.Slot
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalDateTime
sealed interface SlotIntent {
data class ClickOnSlot(val slot: SlotUi) : SlotIntent
data class UpdateRequest(val room: String, val refresh: Boolean = true) : SlotIntent
data class UpdateDate(val newDate: LocalDateTime) : SlotIntent
data class UpdateDate(val newDate: LocalDate) : SlotIntent
data class Delete(val slot: Slot, val onDelete: () -> Unit) : SlotIntent
data class OnCancelDelete(val slot: SlotUi.DeleteSlot) : SlotIntent
}
......
......@@ -157,7 +157,7 @@ fun UpdateEventView(
Spacer(modifier = Modifier.height(15.dp))
DateTimeView(
modifier = Modifier.fillMaxWidth().height(100.dp),
selectDate = selectData.asInstant,
selectDate = selectData,
increment = incrementData,
decrement = decrementData,
onOpenDateTimePickerModal = onOpenDateTimePickerModal,
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать