package com.example.what_the_fantasy.ui.screens

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.example.what_the_fantasy.R
import com.example.what_the_fantasy.data.local.QuoteStub
import com.example.what_the_fantasy.ui.components.LittleQuoteComponent
import com.example.what_the_fantasy.ui.components.NavBar
import com.example.what_the_fantasy.ui.components.TitlePageComponent
import com.example.what_the_fantasy.ui.theme.colorBackground

@Composable
fun FavoritePage(
    index: Int,
    navAccueil: (Int) -> Unit,
    navQuiz: (Int) -> Unit,
    navProfil: (Int) -> Unit,
    navQuote: (Int) -> Unit
) {
    NavBar(
        onFavorite = true,
        index = index,
        navControllerFavorite = { },
        navControllerAccueil = navAccueil,
        navControllerProfil = navProfil,
        navControllerQuiz = navQuiz ,
    ) {
        Box(
            modifier = Modifier
                .fillMaxSize()
                .background(colorBackground),
            contentAlignment = Alignment.Center
        ) {
            Column(modifier = Modifier
                .padding(top = 20.dp),
                horizontalAlignment = Alignment.CenterHorizontally) {
                TitlePageComponent(R.string.TitleFavorite, Color.White)

                LazyColumn(
                    modifier = Modifier
                        .fillMaxSize()
                        .background(Color(0xFF100C1B))
                        .padding(top = 16.dp),
                    horizontalAlignment = Alignment.CenterHorizontally
                ) {
                    items(QuoteStub.allQuotes) { quote ->
                        Column (Modifier.clickable {  navQuote(quote.id)}){
                            LittleQuoteComponent(quote)

                            Spacer(modifier = Modifier.height(16.dp))
                        }

                    }
                }
            }
        }
    }
}



