Skip to content

fix: Localize remaining dates for EN version #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ 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
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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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(
Expand All @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file modified media/tablet/demo-tablet.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.