Added delete glossary
parent
3e88d7b888
commit
7edd584d7e
|
@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.*
|
|||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -17,6 +19,7 @@ import java.awt.Frame
|
|||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
|
||||
val customRedColor = Color(0xFFB70D1B)
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
|
@ -68,13 +71,17 @@ fun app() {
|
|||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
items(glossaries) { glossary ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Button(
|
||||
onClick = {
|
||||
selectedGlossary = glossary
|
||||
currentPage.value = "glossaireOptions"
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(200.dp),
|
||||
.width(150.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
|
@ -82,6 +89,18 @@ fun app() {
|
|||
) {
|
||||
Text(glossary.name)
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = {
|
||||
// Handle delete glossary action
|
||||
glossaries = glossaries.filterNot { it == glossary }
|
||||
val file = File(glossary.jsonFilePath)
|
||||
file.delete()
|
||||
}
|
||||
) {
|
||||
Icon(imageVector = Icons.Default.Delete, contentDescription = "Delete Glossary")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +138,7 @@ fun app() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Nouvelle page pour créer un nouveau glossaire
|
||||
"nouveauGlossaire" -> {
|
||||
var nouveauGlossaireName by remember { mutableStateOf("") }
|
||||
|
|
Loading…
Reference in New Issue