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