AlertDialog when file upload

main
Cemal Odabasioglu 2023-12-08 13:59:34 +01:00
parent 90f1623749
commit 9deec816e0
1 changed files with 33 additions and 2 deletions

View File

@ -1,7 +1,7 @@
package main package main
import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.material.MaterialTheme import androidx.compose.material.*
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
@ -13,6 +13,7 @@ import java.awt.Frame
val customRedColor = Color(0xFFB70D1B) val customRedColor = Color(0xFFB70D1B)
@OptIn(ExperimentalMaterialApi::class)
@Composable @Composable
@Preview @Preview
fun app() { fun app() {
@ -20,6 +21,7 @@ fun app() {
val currentPage = remember { mutableStateOf("accueil") } val currentPage = remember { mutableStateOf("accueil") }
var glossaryDetail: List<Word> by remember { mutableStateOf(emptyList()) } var glossaryDetail: List<Word> by remember { mutableStateOf(emptyList()) }
var isJavaScriptFileSelected by remember { mutableStateOf(false) }
when (currentPage.value) { when (currentPage.value) {
"accueil" -> { "accueil" -> {
@ -89,11 +91,40 @@ fun app() {
onJavaScriptClick = { onJavaScriptClick = {
selectFile(jsExtensions) { filePath -> selectFile(jsExtensions) { filePath ->
mostUsedWordList = parser(filePath) // Change by parser functions mostUsedWordList = parser(filePath) // Change by parser functions
isJavaScriptFileSelected = true
} }
} }
) )
} }
// ... Add other pages here ... }
if (isJavaScriptFileSelected) {
AlertDialog(
onDismissRequest = {
// Handle dialog dismissal if needed
isJavaScriptFileSelected = false
},
title = {
Text("Le fichier a été importé avec succès")
},
text = {
Text("Vous pouvez maintenant comparer votre code avec le glossaire")
},
confirmButton = {
Button(
onClick = {
// Handle the confirm button action
isJavaScriptFileSelected = false
currentPage.value = "accueil"
},
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)
) {
Text("Ok")
}
}
)
} }
} }
} }