Skip to content
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

Remove "interpretation target" chip and add another lang chip when the session is interpretation target #571

Merged
merged 3 commits into from
Aug 17, 2023
Merged
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 @@ -4,10 +4,11 @@ public data class TimetableLanguage(
val langOfSpeaker: String,
val isInterpretationTarget: Boolean,
) {
val langLabel = when (langOfSpeaker) {
"MIXED" -> langOfSpeaker
else -> {
langOfSpeaker.take(2)
}
val labels = if (langOfSpeaker == Lang.MIXED.tagName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

listOf(Lang.MIXED.tagName)
} else if (isInterpretationTarget) {
listOf(Lang.ENGLISH.tagName, Lang.JAPANESE.tagName)
} else {
listOf(langOfSpeaker.take(2))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ import io.github.droidkaigi.confsched2023.model.RoomIndex.Room5
import io.github.droidkaigi.confsched2023.model.Timetable
import io.github.droidkaigi.confsched2023.model.TimetableItem
import io.github.droidkaigi.confsched2023.model.type
import io.github.droidkaigi.confsched2023.sessions.SessionsStrings
import io.github.droidkaigi.confsched2023.sessions.component.TimetableListItem
import kotlinx.collections.immutable.PersistentMap
import java.util.Locale

const val TimetableListTestTag = "TimetableList"

Expand Down Expand Up @@ -87,21 +85,6 @@ fun TimetableList(
onBookmarkClick = onBookmarkClick,
chipContent = {
// Chips
val infoChip = mutableListOf<String>()

infoChip.add(
timetableItem.language.langOfSpeaker.let {
when (it) {
"MIXED" -> it
else -> {
it.take(2).toUpperCase(Locale.ENGLISH)
}
}
},
)
if (timetableItem.language.isInterpretationTarget) {
infoChip.add(SessionsStrings.InterpretationTarget.asString())
}

SuggestionChip(
colors = SuggestionChipDefaults.suggestionChipColors(
Expand All @@ -123,7 +106,7 @@ fun TimetableList(
)
},
)
infoChip.forEach {
timetableItem.language.labels.forEach {
SuggestionChip(
modifier = Modifier.padding(start = 4.dp),
onClick = { /* Do nothing */ },
Expand Down
Loading