From a8335f51e385babcac70b3c390ca19344885987d Mon Sep 17 00:00:00 2001 From: cemal Date: Tue, 7 Nov 2023 14:48:46 +0100 Subject: [PATCH] Added home page --- src/main/kotlin/Main.kt | 87 ++++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 19 deletions(-) diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index be22172..5c3f6cf 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -1,45 +1,84 @@ 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.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.window.Window import androidx.compose.ui.window.application import androidx.compose.foundation.layout.* -import androidx.compose.material.TextField +import androidx.compose.material.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier 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 @Preview fun App() { + MaterialTheme { + val currentPage = remember { mutableStateOf("accueil") } -MaterialTheme { - val currentPage = remember { mutableStateOf("accueil") } + when (currentPage.value) { + "accueil" -> { + HomePage( + onGlossaireClick = { currentPage.value = "glossaire" } - when (currentPage.value) { - "accueil" -> { - AccueilPage( - onAjouterMotClick = { currentPage.value = "formulaire" }, - onImporterClick = { /* Action d'importation */ }, - onExporterClick = { /* Action d'exportation */ } - ) - } - "formulaire" -> { - FormulairePage(onAnnulerClick = { currentPage.value = "accueil" }) + ) + } + "glossaire" -> { + glossairePage( + onAjouterMotClick = { currentPage.value = "formulaire" }, + onImporterClick = { /* Action d'import */ }, + onExporterClick = { /* Action d'export */ }, + onRetourClick = { currentPage.value = "accueil" } + ) + } + "formulaire" -> { + FormulairePage(onAnnulerClick = { currentPage.value = "glossaire" }) + } + // ... Ajoutez d'autres cas pour les pages "glossaire," "code a verifier," et "comparer" } } } -} @Composable -fun AccueilPage( +fun glossairePage( onAjouterMotClick: () -> Unit, onImporterClick: () -> Unit, - onExporterClick: () -> Unit + onExporterClick: () -> Unit, + onRetourClick: () -> Unit ) { Column( modifier = Modifier @@ -62,9 +101,17 @@ fun AccueilPage( Button(onClick = onExporterClick) { Text("Exporter un fichier CSV") } + //Ajoute un bouton retour + Button(onClick = onRetourClick) { + Text("Retour") + } + } + } + + @Composable fun FormulairePage(onAnnulerClick: () -> Unit) { MaterialTheme { @@ -129,9 +176,11 @@ fun FormulairePage(onAnnulerClick: () -> Unit) { horizontalArrangement = Arrangement.SpaceEvenly ) { Button(onClick = onAnnulerClick) { + Icon(imageVector = Icons.Default.Close, contentDescription = null) Text("Annuler") } Button(onClick = { /* Action de validation */ }) { + Icon(imageVector = Icons.Default.Check, contentDescription = null) Text("Valider") } }