From c8131965559b746f240854361977edb9f00c42b3 Mon Sep 17 00:00:00 2001 From: "leni.beaulaton" Date: Sat, 29 Mar 2025 20:28:24 +0100 Subject: [PATCH] ViewModel pour NavBar --- .../data/services/ServicesStub.kt | 2 - .../what_the_fantasy/ui/components/NavBar.kt | 38 ++++++++++++------- .../ui/navigations/AppNavigator.kt | 35 ++++++++++++----- .../ui/screens/AccueilPage.kt | 15 +++++--- .../ui/screens/FavoritePage.kt | 9 ++++- .../what_the_fantasy/ui/screens/ProfilPage.kt | 9 ++--- .../ui/screens/QuizEndPage.kt | 8 +++- .../what_the_fantasy/ui/screens/QuizMenu.kt | 11 ++++-- .../what_the_fantasy/ui/screens/QuizPage.kt | 8 +++- .../what_the_fantasy/ui/screens/QuotePage.kt | 9 ++++- .../ui/screens/RecapSubmitPage.kt | 9 ++++- .../ui/screens/SubmitQuotePage.kt | 9 ++++- 12 files changed, 111 insertions(+), 51 deletions(-) diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt index 0b01ea9..05fbddf 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt @@ -11,8 +11,6 @@ import com.example.what_the_fantasy.data.model.Favorite import com.example.what_the_fantasy.data.model.Quote import com.example.what_the_fantasy.data.model.SrcLanguage import com.example.what_the_fantasy.ui.components.hashPassword -import com.example.what_the_fantasy.ui.states.AuthUserState -import kotlinx.coroutines.flow.StateFlow import java.time.LocalDate class ServicesStub : IServices { diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt index a69a6dc..5d9a60e 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt @@ -1,5 +1,6 @@ package com.example.what_the_fantasy.ui.components +import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -10,7 +11,9 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.* @@ -18,10 +21,10 @@ import androidx.compose.material3.BottomAppBar import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.IconButtonColors -import androidx.compose.material3.IconToggleButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBar import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment @@ -32,20 +35,24 @@ import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp +import androidx.lifecycle.viewmodel.compose.viewModel +import coil.compose.rememberAsyncImagePainter +import coil.compose.rememberImagePainter import com.example.what_the_fantasy.R -import com.example.what_the_fantasy.ui.theme.* +import com.example.what_the_fantasy.ui.states.CurrentUserState +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel @Composable -fun NavBar(onProfile : Boolean = false , - onFavorite : Boolean = false , - onAccueil : Boolean = false , - onQuiz : Boolean = false , - index:Int, +fun NavBar(onProfile : Boolean = false, + onFavorite : Boolean = false, + onAccueil : Boolean = false, + onQuiz : Boolean = false, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState, navControllerProfil: (Int) -> Unit, navControllerFavorite:(Int) -> Unit, navControllerAccueil: (Int) -> Unit, navControllerQuiz: (Int) -> Unit, - content : @Composable ()-> Unit ) { var theme by remember { mutableStateOf(true) } @@ -64,7 +71,7 @@ fun NavBar(onProfile : Boolean = false , Arrangement.SpaceBetween, verticalAlignment = Alignment.Bottom ) { - ButtonIconVectorInt(Icons.Rounded.AccountCircle,"Profile",navControllerProfil,index,onProfile) + ButtonIconVectorInt(currentUserState.imagePath,"Profile",navControllerProfil,currentUserState.id,onProfile) IconButton(onClick = { theme=!theme}, @@ -100,17 +107,17 @@ fun NavBar(onProfile : Boolean = false , ButtonIconPainterInt(painterResource( if(onFavorite)R.drawable.favorite_button_full else R.drawable.favorite_button_empty - ),"Favorite",navControllerFavorite,index,onFavorite) + ),"Favorite",navControllerFavorite,currentUserState.id,onFavorite) ButtonIconPainterInt(painterResource( if(onAccueil)R.drawable.home_button_full else R.drawable.home_button_empty - ),"Accueil",navControllerAccueil,index,onAccueil) + ),"Accueil",navControllerAccueil,currentUserState.id,onAccueil) ButtonIconPainterInt(painterResource( if(onQuiz)R.drawable.quiz_button_full else R.drawable.quiz_button_empty - ),"Quiz",navControllerQuiz,index,onQuiz) + ),"Quiz",navControllerQuiz,currentUserState.id,onQuiz) } } @@ -118,7 +125,7 @@ fun NavBar(onProfile : Boolean = false , } @Composable -fun ButtonIconVectorInt(img : ImageVector, name : String, nav : (Int)->Unit ,index: Int,onPage : Boolean){ +fun ButtonIconVectorInt(img : String, name : String, nav : (Int)->Unit ,index: Int,onPage : Boolean){ IconButton(onClick = {nav(index)}, enabled = !onPage, colors = IconButtonColors(Color.Transparent, MaterialTheme.colorScheme.onBackground,//couleur quand il n'est pas selectionné @@ -126,10 +133,13 @@ fun ButtonIconVectorInt(img : ImageVector, name : String, nav : (Int)->Unit ,ind modifier = Modifier .size(60.dp) ) { - Icon(img, + + Image( + painter = rememberAsyncImagePainter(img), contentDescription = name, modifier = Modifier .fillMaxSize() + .clip(CircleShape) // Pour rendre l'image circulaire ) } } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt index e80ecf9..8b4f148 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt @@ -105,7 +105,6 @@ fun AppNavigator() { composable { val accueil: Accueil = it.toRoute() AccueilPage( - index = accueil.userIndex, navFavorite = { navController.navigate(Favorite(accueil.userIndex)) }, navQuiz = { navController.navigate(QuizMenu(accueil.userIndex)) }, navProfil = { navController.navigate(Profil(accueil.userIndex)) }, @@ -117,7 +116,9 @@ fun AppNavigator() { ) ) }, - services = services + services = services, + currentUserVM = currentUserVM, + currentUserState = currentUserState, ) } composable { @@ -135,7 +136,9 @@ fun AppNavigator() { ) ) }, - services = services + services = services, + currentUserVM = currentUserVM, + currentUserState = currentUserState, ) } composable { @@ -163,7 +166,9 @@ fun AppNavigator() { navQuiz = { navController.navigate(QuizMenu(quote.userIndex)) }, navProfil = { navController.navigate(Profil(quote.userIndex)) }, navFavorite = { navController.navigate(Favorite(quote.userIndex)) }, - service = services + service = services, + currentUserVM = currentUserVM, + currentUserState = currentUserState, ) } composable { SearchPage() } @@ -197,7 +202,9 @@ fun AppNavigator() { source ) ) - } + }, + currentUserVM = currentUserVM, + currentUserState = currentUserState, ) } composable { @@ -209,20 +216,24 @@ fun AppNavigator() { source = recapSubmit.source, navAccueil = { navController.navigate(Accueil(recapSubmit.userIndex)) }, navFavorite = { navController.navigate(Favorite(recapSubmit.userIndex)) }, - navProfil = { navController.navigate(Profil(recapSubmit.userIndex)) } + navProfil = { navController.navigate(Profil(recapSubmit.userIndex)) }, + currentUserVM = currentUserVM, + currentUserState = currentUserState, ) } composable { val quizMenu: QuizMenu = it.toRoute() QuizMenu( - index = quizMenu.userIndex, + currentUserVM = currentUserVM, + currentUserState = currentUserState, navAccueil = { navController.navigate(Accueil(quizMenu.userIndex)) }, navFavorite = { navController.navigate(Favorite(quizMenu.userIndex)) }, navProfil = { navController.navigate(Profil(quizMenu.userIndex)) }, navControllerQuiz = { idQuiz -> navController.navigate(Quiz(quizMenu.userIndex, idQuiz)) - } + }, + ) } composable { @@ -236,7 +247,9 @@ fun AppNavigator() { navControllerQuizEnd = { idQuiz, pts -> navController.navigate(QuizEnd(quiz.userIndex, idQuiz, pts)) }, - idQuiz = quiz.idQuiz + idQuiz = quiz.idQuiz, + currentUserVM = currentUserVM, + currentUserState = currentUserState, ) } composable { @@ -248,7 +261,9 @@ fun AppNavigator() { navAccueil = { navController.navigate(Accueil(quizEnd.userIndex)) }, navFavorite = { navController.navigate(Favorite(quizEnd.userIndex)) }, navProfil = { navController.navigate(Profil(quizEnd.userIndex)) }, - navQuiz = { navController.navigate(QuizMenu(quizEnd.userIndex)) } + navQuiz = { navController.navigate(QuizMenu(quizEnd.userIndex)) }, + currentUserVM = currentUserVM, + currentUserState = currentUserState, ) } } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt index 6161a81..0b7016c 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt @@ -21,28 +21,31 @@ import com.example.what_the_fantasy.data.local.DailyQuoteStub import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.NavBar import com.example.what_the_fantasy.ui.components.QuoteLittle +import com.example.what_the_fantasy.ui.states.CurrentUserState import com.example.what_the_fantasy.ui.theme.colorBackground +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel @Composable fun AccueilPage( - index: Int, navFavorite: (Int) -> Unit, navQuiz: (Int) -> Unit, navProfil: (Int) -> Unit, navQuote: (Int) -> Unit, - services: IServices + services: IServices, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState, -) { + ) { var itemCount by remember { mutableStateOf(15) } val dailyQuote = DailyQuoteStub.dailyQuote val quotes = services.getAllQuote().take(itemCount) - val user = services.getUserById(index) ?: return val titleDalyQuote = stringResource(R.string.TitleHomeDailyQuote) val titleSuggestion = stringResource(R.string.TitleHomeSuggestion) NavBar( onAccueil = true, - index = index, + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = navFavorite, navControllerAccueil = { }, navControllerProfil = navProfil, @@ -82,7 +85,7 @@ fun AccueilPage( Column(Modifier.clickable {navQuote(quote.id)} ) { - if(quote.language == user.langage){ + if(quote.language == currentUserState.langage){ QuoteLittle(quote) Spacer(modifier = Modifier.height(16.dp)) } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt index 647aab2..2ec1e50 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt @@ -21,7 +21,9 @@ import com.example.what_the_fantasy.data.local.FavoriteStub import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.NavBar import com.example.what_the_fantasy.ui.components.QuoteLittle +import com.example.what_the_fantasy.ui.states.CurrentUserState import com.example.what_the_fantasy.ui.theme.colorBackground +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel @Composable fun FavoritePage( @@ -30,7 +32,9 @@ fun FavoritePage( navQuiz: (Int) -> Unit, navProfil: (Int) -> Unit, navQuote: (Int) -> Unit, - services: IServices + services: IServices, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState, ) { val user = services.getUserById(index) ?: return @@ -38,7 +42,8 @@ fun FavoritePage( val TitlePage = stringResource(R.string.TitleFavorite) NavBar(onFavorite = true, - index = index, + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = { }, navControllerAccueil = navAccueil, navControllerProfil = navProfil, diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt index 5447e63..a910941 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt @@ -28,7 +28,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -46,7 +45,6 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import androidx.lifecycle.viewmodel.compose.viewModel import coil.compose.AsyncImage import com.example.what_the_fantasy.Logs.LogsUsers import com.example.what_the_fantasy.R @@ -67,11 +65,10 @@ fun ProfilPage(navFavorite: (Int) -> Unit, currentUserVM : CurrentUserViewModel, currentUserState : CurrentUserState, ) { -// val currentUserVM : CurrentUserViewModel = viewModel() -// val currentUserState by currentUserVM.currentUserState.collectAsState() - Log.e("Profil","${currentUserState.id}") + NavBar(onProfile = true, - index = currentUserState.id, + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = navFavorite, navControllerAccueil = navAccueil, navControllerProfil = {}, diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt index bad6590..fa27756 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt @@ -17,6 +17,8 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.example.what_the_fantasy.data.local.QuizStub import com.example.what_the_fantasy.ui.components.NavBar +import com.example.what_the_fantasy.ui.states.CurrentUserState +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel val gradient = Brush.linearGradient( colors = listOf(Color(0xFF7B1FA2), Color(0xFF311B92)), @@ -33,8 +35,12 @@ fun QuizEndPage( navAccueil: (Int) -> Unit, navProfil:(Int) -> Unit, navQuiz: (Int) -> Unit, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState, ) { - NavBar(index = index, + NavBar( + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = navFavorite, navControllerAccueil = navAccueil, navControllerProfil = navProfil, diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizMenu.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizMenu.kt index 35509ac..52b5778 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizMenu.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizMenu.kt @@ -31,17 +31,22 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.example.what_the_fantasy.data.local.QuizStub import com.example.what_the_fantasy.ui.components.NavBar +import com.example.what_the_fantasy.ui.states.CurrentUserState +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel @Composable fun QuizMenu( - index: Int, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState, navFavorite: (Int) -> Unit, navAccueil: (Int) -> Unit, navProfil:(Int) -> Unit, - navControllerQuiz: (Int) -> Unit + navControllerQuiz: (Int) -> Unit, + ) { NavBar(onQuiz = true, - index = index, + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = navFavorite, navControllerAccueil = navAccueil, navControllerProfil = navProfil, diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizPage.kt index 14048e4..2899fa2 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizPage.kt @@ -19,10 +19,14 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.example.what_the_fantasy.data.local.QuizStub import com.example.what_the_fantasy.ui.components.NavBar +import com.example.what_the_fantasy.ui.states.CurrentUserState +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel @Composable fun QuizPage( index: Int, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState, navFavorite: (Int) -> Unit, navAccueil: (Int) -> Unit, navProfil:(Int) -> Unit, @@ -56,7 +60,9 @@ fun QuizPage( if (idCurrentQuestion < questions.size - 1) idCurrentQuestion++ else navControllerQuizEnd(idQuiz, pts) // Retour menu } - NavBar(index = index, + NavBar( + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = navFavorite, navControllerAccueil = navAccueil, navControllerProfil = navProfil, diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt index 16dcfac..11ba5d3 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt @@ -35,11 +35,13 @@ import com.example.what_the_fantasy.R import coil.compose.AsyncImage import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.NavBar +import com.example.what_the_fantasy.ui.states.CurrentUserState import com.example.what_the_fantasy.ui.theme.colorBackground import com.example.what_the_fantasy.ui.theme.gradienBox import com.example.what_the_fantasy.ui.theme.iconText import com.example.what_the_fantasy.ui.theme.likeIcon import com.example.what_the_fantasy.ui.theme.whiteBackcgroundText +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel @Composable fun QuotePage( @@ -49,12 +51,15 @@ fun QuotePage( navAccueil: (Int) -> Unit, navFavorite:(Int) -> Unit, navQuiz: (Int) -> Unit, - navProfil:(Int) -> Unit) + navProfil:(Int) -> Unit, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState,) { var quote = service.getQuote(quoteId) ?: return val context = LocalContext.current NavBar(onProfile = true, - index = index, + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = navFavorite, navControllerAccueil = navAccueil, navControllerProfil = navProfil, diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/RecapSubmitPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/RecapSubmitPage.kt index 1c7a3db..fe3404a 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/RecapSubmitPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/RecapSubmitPage.kt @@ -39,6 +39,8 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import com.example.what_the_fantasy.data.model.Character +import com.example.what_the_fantasy.ui.states.CurrentUserState +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel @Composable @@ -49,10 +51,13 @@ fun RecapSubmitPage( navProfil:(Int) -> Unit, quoteContent : String, character: String, - source: String + source: String, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState, ) { NavBar(onQuiz = true, - index = index, + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = navFavorite, navControllerAccueil = navAccueil, navControllerProfil = navProfil, diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SubmitQuotePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SubmitQuotePage.kt index 675dfac..48d9c06 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SubmitQuotePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SubmitQuotePage.kt @@ -34,8 +34,10 @@ import com.example.what_the_fantasy.ui.components.ErrorMessageSubmitQuoteCompone import com.example.what_the_fantasy.ui.components.NavBar import com.example.what_the_fantasy.ui.components.SpaceHeightComponent import com.example.what_the_fantasy.ui.components.TitlePageComponent +import com.example.what_the_fantasy.ui.states.CurrentUserState import com.example.what_the_fantasy.ui.theme.colorBackground import com.example.what_the_fantasy.ui.theme.gradienBox +import com.example.what_the_fantasy.ui.viewModels.CurrentUserViewModel @Composable fun SubmitQuotePage( @@ -44,10 +46,13 @@ fun SubmitQuotePage( navAccueil: (Int) -> Unit, navProfil:(Int) -> Unit, navControllerQuiz: (Int) -> Unit, - navRecap: (String, String, String) -> Unit + navRecap: (String, String, String) -> Unit, + currentUserVM : CurrentUserViewModel, + currentUserState : CurrentUserState, ) { NavBar( - index = index, + currentUserVM = currentUserVM, + currentUserState = currentUserState, navControllerFavorite = navFavorite, navControllerAccueil = navAccueil, navControllerProfil = navProfil,