Added home page

main
Cemal Odabasioglu 2023-11-07 14:48:46 +01:00
parent 2a671dfe2d
commit a8335f51e3
1 changed files with 68 additions and 19 deletions

View File

@ -1,45 +1,84 @@
import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.window.Window import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application import androidx.compose.ui.window.application
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material.TextField import androidx.compose.material.*
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Close
@Composable
fun HomePage(onGlossaireClick: () -> Unit) {
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text("Quali'Nomme", style = MaterialTheme.typography.h3)
Spacer(modifier = Modifier.height(16.dp))
Row(
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
Button(onClick = onGlossaireClick) {
Text("Glossaire")
}
Button(onClick = { /* Action de Code à Vérifier */ }) {
Text("Code à Vérifier")
}
Button(onClick = { /* Action de Comparer */ }) {
Text("Comparer")
}
}
}
}
@Composable @Composable
@Preview @Preview
fun App() { fun App() {
MaterialTheme {
val currentPage = remember { mutableStateOf("accueil") }
MaterialTheme { when (currentPage.value) {
val currentPage = remember { mutableStateOf("accueil") } "accueil" -> {
HomePage(
onGlossaireClick = { currentPage.value = "glossaire" }
when (currentPage.value) { )
"accueil" -> { }
AccueilPage( "glossaire" -> {
onAjouterMotClick = { currentPage.value = "formulaire" }, glossairePage(
onImporterClick = { /* Action d'importation */ }, onAjouterMotClick = { currentPage.value = "formulaire" },
onExporterClick = { /* Action d'exportation */ } onImporterClick = { /* Action d'import */ },
) onExporterClick = { /* Action d'export */ },
} onRetourClick = { currentPage.value = "accueil" }
"formulaire" -> { )
FormulairePage(onAnnulerClick = { currentPage.value = "accueil" }) }
"formulaire" -> {
FormulairePage(onAnnulerClick = { currentPage.value = "glossaire" })
}
// ... Ajoutez d'autres cas pour les pages "glossaire," "code a verifier," et "comparer"
} }
} }
} }
}
@Composable @Composable
fun AccueilPage( fun glossairePage(
onAjouterMotClick: () -> Unit, onAjouterMotClick: () -> Unit,
onImporterClick: () -> Unit, onImporterClick: () -> Unit,
onExporterClick: () -> Unit onExporterClick: () -> Unit,
onRetourClick: () -> Unit
) { ) {
Column( Column(
modifier = Modifier modifier = Modifier
@ -62,9 +101,17 @@ fun AccueilPage(
Button(onClick = onExporterClick) { Button(onClick = onExporterClick) {
Text("Exporter un fichier CSV") Text("Exporter un fichier CSV")
} }
//Ajoute un bouton retour
Button(onClick = onRetourClick) {
Text("Retour")
}
} }
} }
@Composable @Composable
fun FormulairePage(onAnnulerClick: () -> Unit) { fun FormulairePage(onAnnulerClick: () -> Unit) {
MaterialTheme { MaterialTheme {
@ -129,9 +176,11 @@ fun FormulairePage(onAnnulerClick: () -> Unit) {
horizontalArrangement = Arrangement.SpaceEvenly horizontalArrangement = Arrangement.SpaceEvenly
) { ) {
Button(onClick = onAnnulerClick) { Button(onClick = onAnnulerClick) {
Icon(imageVector = Icons.Default.Close, contentDescription = null)
Text("Annuler") Text("Annuler")
} }
Button(onClick = { /* Action de validation */ }) { Button(onClick = { /* Action de validation */ }) {
Icon(imageVector = Icons.Default.Check, contentDescription = null)
Text("Valider") Text("Valider")
} }
} }