Show Parsed Words in compare window

main
Thomas BREIL 2023-12-19 14:55:57 +01:00
parent c65c90b0a1
commit d85eb1b705
1 changed files with 12 additions and 7 deletions

View File

@ -65,9 +65,14 @@ fun commonWordsTable(
commonWordsHeaderRow()
}
items(glossaryWords) { word ->
commonWordsDataRow(word.name, codeWords, glossaryWordsSet)
}
items(codeWords) { word ->
if (word !in glossaryWordsSet) {
commonWordsDataRow(word, codeWords, glossaryWordsSet)
}
}
}
)
}
@ -93,7 +98,7 @@ fun commonWordsHeaderRow() {
@Composable
fun commonWordsDataRow(
word: Word,
word: String,
codeWords: List<String>,
glossaryWordsSet: Set<String>
) {
@ -102,12 +107,12 @@ fun commonWordsDataRow(
.border(1.dp, Color.Black)
.padding(8.dp)
val isCommon = word.name in codeWords && word.name in glossaryWordsSet
val isCommon = word in codeWords && word in glossaryWordsSet
val backgroundColor = when {
isCommon -> Color.Yellow
word.name in codeWords -> Color.Blue // Couleur pour les mots du code
word.name in glossaryWordsSet -> Color.Green // Couleur pour les mots du glossaire
word in codeWords -> Color.Blue // Couleur pour les mots du code
word in glossaryWordsSet -> Color.Green // Couleur pour les mots du glossaire
else -> Color.White
}
@ -115,8 +120,8 @@ fun commonWordsDataRow(
modifier = modifier.background(backgroundColor),
verticalAlignment = Alignment.CenterVertically
) {
cellContent(word.name, modifier)
cellContent(if (word.name in codeWords) "Oui" else "Non", modifier)
cellContent(word, modifier)
cellContent(if (word in codeWords) "Oui" else "Non", modifier)
cellContent(if (isCommon) "Oui" else "Non", modifier)
}
}