Fix GlossaryDetails issues
parent
a5d3811b45
commit
6631008fcc
|
@ -28,6 +28,7 @@ fun glossaryDetailedPage(
|
|||
onExportClick: () -> Unit,
|
||||
onImportClick: () -> Unit
|
||||
) {
|
||||
println(glossary)
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Top, // Align content at the top
|
||||
|
|
|
@ -34,7 +34,7 @@ fun app() {
|
|||
val languageManager = remember { LanguageManager() }
|
||||
MaterialTheme {
|
||||
|
||||
val glossaryDetail: List<Word> by remember { mutableStateOf(emptyList()) }
|
||||
|
||||
var isJavaScriptFileSelected by remember { mutableStateOf(false) }
|
||||
|
||||
|
||||
|
@ -81,32 +81,34 @@ fun app() {
|
|||
}
|
||||
|
||||
"glossaireDetail" -> {
|
||||
glossaryDetailedPage(
|
||||
glossary = glossaryDetail,
|
||||
glossaryName = appState.selectedGlossary?.name ?: "",
|
||||
onBackClick = { currentPage.value = "glossaires" },
|
||||
onAddWordClick = { currentPage.value = "formulaire" },
|
||||
onExportClick = {
|
||||
val fileDialog = FileDialog(Frame(), "Save as CSV", FileDialog.SAVE)
|
||||
fileDialog.file = appState.selectedGlossary?.name // Initial file name
|
||||
fileDialog.isVisible = true
|
||||
val selectedFile = fileDialog.file
|
||||
val selectedDirectory = fileDialog.directory
|
||||
if (selectedFile != null) {
|
||||
val csvFilePath = "$selectedDirectory$selectedFile"
|
||||
println("Exporting to: $csvFilePath")
|
||||
appState.selectedGlossary?.let { exportToCSV(it, csvFilePath) }
|
||||
} else {
|
||||
println("Export command cancelled by user.")
|
||||
appState.selectedGlossary?.let { loadDatasFromFile(it.jsonFilePath) }?.let {
|
||||
glossaryDetailedPage(
|
||||
glossary = it,
|
||||
glossaryName = appState.selectedGlossary?.name ?: "",
|
||||
onBackClick = { currentPage.value = "glossaires" },
|
||||
onAddWordClick = { currentPage.value = "formulaire" },
|
||||
onExportClick = {
|
||||
val fileDialog = FileDialog(Frame(), "Save as CSV", FileDialog.SAVE)
|
||||
fileDialog.file = appState.selectedGlossary?.name // Initial file name
|
||||
fileDialog.isVisible = true
|
||||
val selectedFile = fileDialog.file
|
||||
val selectedDirectory = fileDialog.directory
|
||||
if (selectedFile != null) {
|
||||
val csvFilePath = "$selectedDirectory$selectedFile"
|
||||
println("Exporting to: $csvFilePath")
|
||||
appState.selectedGlossary?.let { exportToCSV(it, csvFilePath) }
|
||||
} else {
|
||||
println("Export command cancelled by user.")
|
||||
}
|
||||
},
|
||||
onImportClick = {
|
||||
selectFile(setOf("csv", "xlsx")) { filePath ->
|
||||
println("Importing file: $filePath")
|
||||
appState.selectedGlossary?.let { importFile(it, filePath) }
|
||||
}
|
||||
}
|
||||
},
|
||||
onImportClick = {
|
||||
selectFile(setOf("csv", "xlsx")) { filePath ->
|
||||
println("Importing file: $filePath")
|
||||
appState.selectedGlossary?.let { importFile(it, filePath) }
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"formulaire" -> {
|
||||
|
|
Loading…
Reference in New Issue