Sonar lint on Home.kt
parent
a05e2c5e7c
commit
b42780ac92
|
@ -28,10 +28,8 @@ fun homePage(
|
|||
val appState = AppState
|
||||
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||
var isCompareClicked by remember { mutableStateOf(false) }
|
||||
|
||||
var selectedGlossary by remember { mutableStateOf<Glossary?>(null) }
|
||||
|
||||
|
||||
if (!isCompareClicked && selectedGlossary == null) {
|
||||
// Utilisez un Box pour placer le drapeau en haut à droite
|
||||
Box(
|
||||
|
@ -88,7 +86,6 @@ fun homePage(
|
|||
onClick = {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
println("Veuillez d'abord importer un fichier")
|
||||
return@Button
|
||||
} else {
|
||||
isCompareClicked = true
|
||||
|
@ -137,7 +134,6 @@ fun homePage(
|
|||
"Comparer" -> {
|
||||
if (mostUsedWordList.isEmpty()) {
|
||||
noFileSnackbarVisibleState.value = true
|
||||
println("Veuillez d'abord importer un fichier")
|
||||
return@dropdownButtonComponent
|
||||
} else {
|
||||
isCompareClicked = true
|
||||
|
@ -149,40 +145,53 @@ fun homePage(
|
|||
var selectedProject by remember { mutableStateOf<Project?>(null) }
|
||||
|
||||
|
||||
if (isCompareClicked && selectedProject == null && selectedGlossary == null) {
|
||||
when {
|
||||
isCompareClicked && selectedProject == null && selectedGlossary == null -> {
|
||||
projectList(
|
||||
projects = loadProjects(),
|
||||
onProjectSelected = { project ->
|
||||
selectedProject = project
|
||||
appState.selectedProject = selectedProject
|
||||
println("selectedProject = $selectedProject")
|
||||
},
|
||||
onBackClick = { isCompareClicked = false; selectedGlossary = null; selectedProject = null }
|
||||
onBackClick = {
|
||||
isCompareClicked = false
|
||||
selectedGlossary = null
|
||||
selectedProject = null
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
} else if (isCompareClicked && selectedGlossary == null) {
|
||||
|
||||
isCompareClicked && selectedGlossary == null -> {
|
||||
glossaryList(
|
||||
glossaries = loadGlossaries(appState.selectedProject!!),
|
||||
onGlossarySelected = { glossary ->
|
||||
selectedGlossary = glossary
|
||||
println("selectedGlossary = $selectedGlossary")
|
||||
},
|
||||
onBackClick = { isCompareClicked = false; selectedGlossary = null; selectedProject = null }
|
||||
onBackClick = {
|
||||
isCompareClicked = false
|
||||
selectedGlossary = null
|
||||
selectedProject = null
|
||||
}
|
||||
)
|
||||
} else if (isCompareClicked) {
|
||||
}
|
||||
|
||||
isCompareClicked -> {
|
||||
selectedGlossary?.let {
|
||||
compareResults(
|
||||
glossaryWords = loadDatasFromFile(it.jsonFilePath),
|
||||
codeWords = mostUsedWordList.keys.toList(),
|
||||
onBackClick = { isCompareClicked = false; selectedGlossary = null; selectedProject = null }
|
||||
onBackClick = {
|
||||
isCompareClicked = false
|
||||
selectedGlossary = null
|
||||
selectedProject = null
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Composable
|
||||
fun glossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> Unit, onBackClick: () -> Unit) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
|
|
Loading…
Reference in New Issue