Skip to content

Commit

Permalink
Fix to show message for special session
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniokrait committed Sep 6, 2024
1 parent 0148d94 commit 71c7728
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public fun SessionsAllResponse.toTimetable(): Timetable {
} else {
apiSession.i18nDesc.toMultiLangText()
},
message = apiSession.message?.toMultiLangText(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import io.github.droidkaigi.confsched.droidkaigiui.animation.LocalFavoriteAnimat
import io.github.droidkaigi.confsched.droidkaigiui.previewOverride
import io.github.droidkaigi.confsched.model.TimetableItem
import io.github.droidkaigi.confsched.model.TimetableItem.Session
import io.github.droidkaigi.confsched.model.TimetableItem.Special
import org.jetbrains.compose.resources.stringResource

const val TimetableItemCardBookmarkButtonTestTag = "TimetableItemCardBookmarkButton"
Expand Down Expand Up @@ -170,25 +171,27 @@ fun TimetableItemCard(
}
}
}
if (timetableItem is Session) {
timetableItem.message?.let {
Row(
modifier = Modifier
.padding(top = 8.dp)
.height(IntrinsicSize.Min),
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
Icon(
Icons.Filled.Info,
contentDescription = stringResource(DroidKaigiUiRes.string.image),
tint = MaterialTheme.colorScheme.error,
)
Text(
text = it.currentLangTitle,
fontSize = 16.sp,
color = MaterialTheme.colorScheme.error,
)
}

when (timetableItem) {
is Session -> timetableItem.message
is Special -> timetableItem.message
}?.let {
Row(
modifier = Modifier
.padding(top = 8.dp)
.height(IntrinsicSize.Min),
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
Icon(
Icons.Filled.Info,
contentDescription = stringResource(DroidKaigiUiRes.string.image),
tint = MaterialTheme.colorScheme.error,
)
Text(
text = it.currentLangTitle,
fontSize = 16.sp,
color = MaterialTheme.colorScheme.error,
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public fun Timetable.Companion.fake(): Timetable {
enTitle = "This is a description\nThis is a description\nThis is a description\n" +
"This is a description\nThis is a description\nThis is a description\n",
),
message = null,
),
)
for (day in -1..1) {
Expand Down Expand Up @@ -229,6 +230,10 @@ public fun Timetable.Companion.fake(): Timetable {
enTitle = "This is a description\nThis is a description\nThis is a description\n" +
"This is a description\nThis is a description\nThis is a description\n",
),
message = MultiLangText(
jaTitle = "このセッションは事情により中止となりました",
enTitle = "This session has been cancelled due to circumstances.",
),
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public sealed class TimetableItem {
override val levels: PersistentList<String>,
override val speakers: PersistentList<TimetableSpeaker>,
val description: MultiLangText,
val message: MultiLangText?,
) : TimetableItem()

private val startsDateString: String by lazy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ fun TimetableGridItemWelcomeTalkPreview() {
enTitle = "This is a description\nThis is a description\nThis is a description\n" +
"This is a description\nThis is a description\nThis is a description\n",
),
message = null,
),
onTimetableItemClick = {},
gridItemHeightPx = 154,
Expand Down

0 comments on commit 71c7728

Please sign in to comment.