From 01fcd8690b7fd5b5b06f48b1c3fcb222718845d8 Mon Sep 17 00:00:00 2001 From: Thomas Breil Date: Thu, 21 Dec 2023 10:26:12 +0100 Subject: [PATCH] Modify csv export and remove duplication from auto completion --- src/main/kotlin/main/Form.kt | 1 + src/main/kotlin/main/Glossary.kt | 2 +- src/main/kotlin/main/Home.kt | 2 +- src/main/kotlin/main/Main.kt | 2 +- src/main/kotlin/main/projects.kt | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/main/Form.kt b/src/main/kotlin/main/Form.kt index bc2bd5c..145ba27 100644 --- a/src/main/kotlin/main/Form.kt +++ b/src/main/kotlin/main/Form.kt @@ -107,6 +107,7 @@ fun formPage(glossary: Glossary, onCancelClick: () -> Unit) { glossaryWords.forEach { word: Word -> contextList = contextList + word.mainContext } + contextList = contextList.distinct() var listToShow by remember(mainContext.value) { mutableStateOf(contextList.filter { it.startsWith(mainContext.value, ignoreCase = true) }) diff --git a/src/main/kotlin/main/Glossary.kt b/src/main/kotlin/main/Glossary.kt index 54882c4..1dcab5c 100644 --- a/src/main/kotlin/main/Glossary.kt +++ b/src/main/kotlin/main/Glossary.kt @@ -224,7 +224,7 @@ fun exportToCSV(glossary: Glossary, csvFilePath: String) { } } try { - FileWriter(csvFilePath).use { fileWriter -> + FileWriter(csvFilePath + ".csv").use { fileWriter -> fileWriter.write(csvContent) } exportedSuccessfully.value = true diff --git a/src/main/kotlin/main/Home.kt b/src/main/kotlin/main/Home.kt index 0639234..b0af6ba 100644 --- a/src/main/kotlin/main/Home.kt +++ b/src/main/kotlin/main/Home.kt @@ -182,7 +182,7 @@ fun glossaryList(glossaries: List, onGlossarySelected: (Glossary) -> U val scrollState = rememberLazyListState() LazyColumn( state = scrollState, - modifier = Modifier.padding(10.dp).width(250.dp).border(1.dp, Color.Black), + modifier = Modifier.padding(10.dp).width(250.dp).height(300.dp).border(1.dp, Color.Black), verticalArrangement = Arrangement.spacedBy(10.dp) ) { if (glossaries.isEmpty()) { diff --git a/src/main/kotlin/main/Main.kt b/src/main/kotlin/main/Main.kt index 218f8c9..598288e 100644 --- a/src/main/kotlin/main/Main.kt +++ b/src/main/kotlin/main/Main.kt @@ -283,7 +283,7 @@ fun app() { }, onExportClick = { val fileDialog = FileDialog(Frame(), "Save as CSV", FileDialog.SAVE) - fileDialog.file = "glossaire_exporte.csv" // Initial file name + fileDialog.file = selectedGlossary?.name // Initial file name fileDialog.isVisible = true val selectedFile = fileDialog.file val selectedDirectory = fileDialog.directory diff --git a/src/main/kotlin/main/projects.kt b/src/main/kotlin/main/projects.kt index ed90b5c..9ec6949 100644 --- a/src/main/kotlin/main/projects.kt +++ b/src/main/kotlin/main/projects.kt @@ -102,7 +102,7 @@ fun projectsPage( contentColor = Color.White ) ) { - Text("Créer un nouveau project") + Text("Créer un nouveau projet") } Spacer(modifier = Modifier.height(6.dp))