Skip to content

Commit

Permalink
Show opening hours info
Browse files Browse the repository at this point in the history
  • Loading branch information
cristan committed Sep 1, 2024
1 parent 5cc9738 commit 6dadabe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ object DetailsMapper {
// Just for Rotterdam Kralingse Zoom
?.replace("&", "&")
val about = payload.infoImages.find { it.title == "Bijzonderheden" }?.body?.replace(newLinesAtEnd, "")
// Filled in example Leiden Centraal, Centrumzijde
val openingHoursInfo = payload.infoImages.find { it.title == "Info openingstijden" }?.body

val location =
if (payload.city == "" || payload.city == null || payload.street == null || payload.houseNumber == null || payload.postalCode == null) {
Expand Down Expand Up @@ -83,6 +85,7 @@ object DetailsMapper {

return DetailsModel(
description = payload.description,
openingHoursInfo = openingHoursInfo,
openingHours = openingHoursModels,
rentalBikesAvailable = rentalBikesAvailable,
capacity = max(rentalBikesAvailable ?: 0, maxCapacity),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import nl.ovfietsbeschikbaarheid.R
data class DetailsModel(
val description: String,
val openState: OpenState?,
val openingHoursInfo: String?,
val openingHours: List<OpeningHoursModel>,
val rentalBikesAvailable: Int?,
val capacity: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ private fun OpeningHours(details: DetailsModel) {
style = MaterialTheme.typography.headlineMedium,
modifier = Modifier.padding(bottom = 8.dp)
)
details.openingHoursInfo?.let {
Text(it, Modifier.padding(bottom = 8.dp))
}
details.openingHours.forEach {
Row(Modifier.fillMaxWidth()) {
Text(it.dayOfWeek, Modifier.weight(1f))
Expand Down Expand Up @@ -442,6 +445,7 @@ fun DetailsPreview() {
val details = DetailsModel(
"Hilversum",
OpenState.Open247,
null,
openingHours,
144,
200,
Expand Down

0 comments on commit 6dadabe

Please sign in to comment.