AlertDialog when file upload
parent
90f1623749
commit
9deec816e0
|
@ -1,7 +1,7 @@
|
|||
package main
|
||||
|
||||
import androidx.compose.desktop.ui.tooling.preview.Preview
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
@ -13,6 +13,7 @@ import java.awt.Frame
|
|||
|
||||
val customRedColor = Color(0xFFB70D1B)
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
@Preview
|
||||
fun app() {
|
||||
|
@ -20,6 +21,7 @@ fun app() {
|
|||
val currentPage = remember { mutableStateOf("accueil") }
|
||||
|
||||
var glossaryDetail: List<Word> by remember { mutableStateOf(emptyList()) }
|
||||
var isJavaScriptFileSelected by remember { mutableStateOf(false) }
|
||||
|
||||
when (currentPage.value) {
|
||||
"accueil" -> {
|
||||
|
@ -89,11 +91,40 @@ fun app() {
|
|||
onJavaScriptClick = {
|
||||
selectFile(jsExtensions) { filePath ->
|
||||
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")
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue