UI/UX solution:

Added clickable date tabs for booking
This commit is contained in:
2025-12-05 21:28:06 +07:00
parent 40a8428a19
commit dbe735e541
2 changed files with 19 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
package ru.myitschool.work.core package ru.myitschool.work.core
object Constants { object Constants {
const val HOST = "http://10.0.2.2:8080" const val HOST = "http://192.168.1.46:8080"
const val AUTH_URL = "/auth" const val AUTH_URL = "/auth"
const val INFO_URL = "/info" const val INFO_URL = "/info"
const val BOOKING_URL = "/booking" const val BOOKING_URL = "/booking"

View File

@@ -1,5 +1,6 @@
package ru.myitschool.work.ui.screen.book package ru.myitschool.work.ui.screen.book
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@@ -13,6 +14,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.selection.selectable import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.Card import androidx.compose.material3.Card
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
@@ -27,6 +29,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.testTag import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
@@ -262,15 +265,27 @@ private fun BookDataContent(
itemsIndexed(state.dates) { index, dateLabel -> itemsIndexed(state.dates) { index, dateLabel ->
Surface( Surface(
modifier = Modifier modifier = Modifier
.testTag(TestIds.Book.getIdDateItemByPosition(index)), .testTag(TestIds.Book.getIdDateItemByPosition(index))
tonalElevation = if (index == state.selectedDateIndex) 4.dp else 0.dp .clickable { onSelectDate(index) }
.clip(RoundedCornerShape(8.dp)),
tonalElevation = if (index == state.selectedDateIndex) 4.dp else 0.dp,
color = if (index == state.selectedDateIndex) {
MaterialTheme.colorScheme.primaryContainer
} else {
MaterialTheme.colorScheme.surface
}
) { ) {
Text( Text(
modifier = Modifier modifier = Modifier
.padding(horizontal = 12.dp, vertical = 8.dp) .padding(horizontal = 12.dp, vertical = 8.dp)
.testTag(TestIds.Book.ITEM_DATE), .testTag(TestIds.Book.ITEM_DATE),
text = dateLabel, text = dateLabel,
style = MaterialTheme.typography.bodyMedium style = MaterialTheme.typography.bodyMedium,
color = if (index == state.selectedDateIndex) {
MaterialTheme.colorScheme.onPrimaryContainer
} else {
MaterialTheme.colorScheme.onSurface
}
) )
} }
} }