Modify csv export and remove duplication from auto completion

main
Thomas Breil 2023-12-21 10:26:12 +01:00
parent 708cbd9522
commit 01fcd8690b
5 changed files with 5 additions and 4 deletions

View File

@ -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) })

View File

@ -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

View File

@ -182,7 +182,7 @@ fun glossaryList(glossaries: List<Glossary>, 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()) {

View File

@ -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

View File

@ -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))