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