Fix warnings
parent
d02ffb5e00
commit
4794c8f3b1
|
@ -25,7 +25,7 @@ var appState = AppState
|
|||
@Composable
|
||||
fun formPage(glossary: Glossary, onCancelClick: () -> Unit) {
|
||||
// State to track whether to show the snackbar
|
||||
var appState = AppState
|
||||
AppState
|
||||
val requiredFieldsSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||
val alreadyExistSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ fun homePage(
|
|||
|
||||
|
||||
if (isCompareClicked && selectedProject == null && selectedGlossary == null) {
|
||||
ProjectList(
|
||||
projectList(
|
||||
projects = loadProjects(),
|
||||
onProjectSelected = { project ->
|
||||
selectedProject = project
|
||||
|
@ -142,7 +142,7 @@ fun homePage(
|
|||
|
||||
} else if (isCompareClicked && selectedGlossary == null) {
|
||||
|
||||
GlossaryList(
|
||||
glossaryList(
|
||||
glossaries = loadGlossaries(appState.selectedProject!!),
|
||||
onGlossarySelected = { glossary ->
|
||||
selectedGlossary = glossary
|
||||
|
@ -163,7 +163,7 @@ fun homePage(
|
|||
}
|
||||
|
||||
@Composable
|
||||
fun GlossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> Unit, onBackClick: () -> Unit) {
|
||||
fun glossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> Unit, onBackClick: () -> Unit) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
|
@ -216,7 +216,7 @@ fun GlossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
|
|||
|
||||
Button(
|
||||
onClick = onBackClick,
|
||||
colors = androidx.compose.material.ButtonDefaults.buttonColors(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
|
@ -227,7 +227,7 @@ fun GlossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
|
|||
}
|
||||
|
||||
@Composable
|
||||
fun ProjectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, onBackClick: () -> Unit) {
|
||||
fun projectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, onBackClick: () -> Unit) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
|
@ -280,7 +280,7 @@ fun ProjectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, o
|
|||
|
||||
Button(
|
||||
onClick = onBackClick,
|
||||
colors = androidx.compose.material.ButtonDefaults.buttonColors(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.*
|
|||
val customRedColor = Color(0xFFB70D1B)
|
||||
val currentPage = mutableStateOf("accueil")
|
||||
|
||||
val glossaryPath : String = "src/main/resources/projects/"
|
||||
const val glossaryPath : String = "src/main/resources/projects/"
|
||||
|
||||
// Classe pour stocker l'état global
|
||||
object AppState {
|
||||
|
|
|
@ -17,7 +17,7 @@ fun takeOnlyJs(fileName: String): String {
|
|||
}
|
||||
|
||||
fun jsWords(code : Map<String,Int>) : Map<String,Int>{
|
||||
val js = File("src/main/kotlin/main/sampleJS.txt").readText().toString().split(",")
|
||||
val js = File("src/main/kotlin/main/sampleJS.txt").readText().split(",")
|
||||
|
||||
return code.filter { it.key !in js }
|
||||
}
|
||||
|
@ -49,10 +49,10 @@ fun splitLanguages(file : String){
|
|||
|
||||
fun parser(fileName : String) : MutableMap<String, Int> {
|
||||
val delimiter1 = " "
|
||||
val regex = "[^a-zA-Z^é^à]".toRegex()
|
||||
val regex = "[^a-zA-Z^éà]".toRegex()
|
||||
val array = mutableListOf<String>()
|
||||
|
||||
val line = delStrings(takeOnlyJs(fileName)).toString().replace(regex, " ").toString()
|
||||
val line = delStrings(takeOnlyJs(fileName)).replace(regex, " ")
|
||||
line.split(delimiter1).forEach {
|
||||
|
||||
if (it != "") {
|
||||
|
@ -62,7 +62,7 @@ fun parser(fileName : String) : MutableMap<String, Int> {
|
|||
val map = jsWords(array.groupingBy { it }.eachCount())
|
||||
|
||||
var sortedMap = map.toList().take(10).sortedBy { (_, value) -> value }.toMap()
|
||||
sortedMap.forEach() { (t, u) -> println("$t : $u") } // affiche le nombre d'occurence de chaque mot
|
||||
sortedMap.forEach { (t, u) -> println("$t : $u") } // affiche le nombre d'occurence de chaque mot
|
||||
sortedMap = sortedMap.toMutableMap()
|
||||
return sortedMap
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ fun projectsPage(
|
|||
currentPage: MutableState<String>
|
||||
) {
|
||||
val appState = AppState
|
||||
var selectedProject: Project? by remember { mutableStateOf(null) }
|
||||
var projects: List<Project> by remember { mutableStateOf(loadProjects()) }
|
||||
|
||||
Column(
|
||||
|
@ -113,25 +112,6 @@ fun projectsPage(
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun mySuperCoolButton(
|
||||
project: Project,
|
||||
){
|
||||
var projects: List<Project> = loadProjects()
|
||||
|
||||
IconButton(
|
||||
onClick = {
|
||||
// Handle delete glossary action
|
||||
projects = projects.filterNot { it == project }
|
||||
val directory = File("src/main/resources/projects/${project.name}/")
|
||||
directory.deleteRecursively()
|
||||
|
||||
}
|
||||
) {
|
||||
Icon(imageVector = Icons.Default.Delete, contentDescription = "Delete Project")
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun newProject(
|
||||
currentPage: MutableState<String>
|
||||
|
|
Loading…
Reference in New Issue