diff --git a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/sessions/DefaultSessionsApiClient.kt b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/sessions/DefaultSessionsApiClient.kt index 313c3d199..66ac715d7 100644 --- a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/sessions/DefaultSessionsApiClient.kt +++ b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/sessions/DefaultSessionsApiClient.kt @@ -156,6 +156,7 @@ public fun SessionsAllResponse.toTimetable(): Timetable { } else { apiSession.i18nDesc.toMultiLangText() }, + message = apiSession.message?.toMultiLangText(), ) } } diff --git a/core/droidkaigiui/src/commonMain/kotlin/io/github/droidkaigi/confsched/droidkaigiui/component/TimetableItemCard.kt b/core/droidkaigiui/src/commonMain/kotlin/io/github/droidkaigi/confsched/droidkaigiui/component/TimetableItemCard.kt index b6404facc..e3ea41859 100644 --- a/core/droidkaigiui/src/commonMain/kotlin/io/github/droidkaigi/confsched/droidkaigiui/component/TimetableItemCard.kt +++ b/core/droidkaigiui/src/commonMain/kotlin/io/github/droidkaigi/confsched/droidkaigiui/component/TimetableItemCard.kt @@ -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" @@ -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, + ) } } } diff --git a/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/Timetable.kt b/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/Timetable.kt index 89f155aa2..d86547d79 100644 --- a/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/Timetable.kt +++ b/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/Timetable.kt @@ -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) { @@ -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.", + ), ), ) } diff --git a/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/TimetableItem.kt b/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/TimetableItem.kt index 843f62cb1..5790ba60f 100644 --- a/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/TimetableItem.kt +++ b/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/TimetableItem.kt @@ -62,6 +62,7 @@ public sealed class TimetableItem { override val levels: PersistentList, override val speakers: PersistentList, val description: MultiLangText, + val message: MultiLangText?, ) : TimetableItem() private val startsDateString: String by lazy { diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableGridItem.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableGridItem.kt index a79837759..2b7e884f3 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableGridItem.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableGridItem.kt @@ -59,6 +59,7 @@ import io.github.droidkaigi.confsched.model.TimetableAsset import io.github.droidkaigi.confsched.model.TimetableCategory import io.github.droidkaigi.confsched.model.TimetableItem import io.github.droidkaigi.confsched.model.TimetableItem.Session +import io.github.droidkaigi.confsched.model.TimetableItem.Special import io.github.droidkaigi.confsched.model.TimetableItemId import io.github.droidkaigi.confsched.model.TimetableLanguage import io.github.droidkaigi.confsched.model.TimetableRoom @@ -226,7 +227,10 @@ fun TimetableGridItem( }, ) - val shouldShowError = timetableItem is Session && timetableItem.message != null + val shouldShowError = when (timetableItem) { + is Session -> timetableItem.message + is Special -> timetableItem.message + } != null if (isShowingAllContent && (speakers.isNotEmpty() || shouldShowError)) { Row( @@ -263,7 +267,7 @@ fun TimetableGridItem( .size(TimetableGridItemSizes.errorHeight), imageVector = Icons.Default.Error, contentDescription = stringResource(SessionsRes.string.content_description_error_icon), - tint = MaterialTheme.colorScheme.errorContainer, + tint = MaterialTheme.colorScheme.error, ) } } @@ -587,6 +591,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,