<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
             xmlns:views="clr-namespace:GameAtlas.Views.Composants"
             x:Class="GameAtlas.Views.PageAcceuil"
             Title="ACCUEIL">
             <!--  WidthRequest="390" HeightRequest="844"> -->



    <Grid x:Name="outerGrid">

        <Grid.Background>
            <LinearGradientBrush EndPoint="1,0">
                <GradientStop Color="#DFE4FF"
                          Offset="0.1" />
                <GradientStop Color="#FDF7E6"
                          Offset="1.0" />
            </LinearGradientBrush>
        </Grid.Background>

        <ScrollView VerticalScrollBarVisibility="Never">

            <Grid
                RowDefinitions="auto, auto, auto, auto, auto, auto, *">


                <HorizontalStackLayout>
                    <Frame Margin="10"
                    BorderColor="DarkViolet"
                    CornerRadius="50"
                    HeightRequest="50"
                    WidthRequest="50"
                    IsClippedToBounds="True"
                    HorizontalOptions="Start"
                    VerticalOptions="Center"
                    Grid.Row="1"
                />

                    <Label
                        Text="Pseudonyme"
                        FontFamily="AladinRegular"
                        FontSize="18"
                        Grid.Row="1"
                        HorizontalOptions="Start"
                        VerticalOptions="Center">
                        <Label.GestureRecognizers>
                            <TapGestureRecognizer Tapped="OnProfil_Tapped"/>
                        </Label.GestureRecognizers>
                    </Label>

                </HorizontalStackLayout>

                <StackLayout HorizontalOptions="Center" VerticalOptions="Center" Grid.Row="2">
                    <SearchBar Placeholder="Rechercher" BackgroundColor="#D9D9D9" TextColor="Black"/>
                </StackLayout>

                <Label
                Text="Parcourir les jeux"
                FontFamily="PTSansCaption-Bold"
                FontSize="24"
                Grid.Row="3"
                Padding="25,20,0,0"
                />

                <ScrollView Orientation="Horizontal" Grid.Row="4" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalScrollBarVisibility="Never">
                    <HorizontalStackLayout BindableLayout.ItemsSource="{Binding ListJeux}">
                        <BindableLayout.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <ImageButton Source="{Binding Image}" CornerRadius="15" HeightRequest="160" WidthRequest="290" Clicked="OnButtonClicked"/>
                                    <HorizontalStackLayout Margin="25,95,0,0" Spacing="5">
                                        <Image Style="{StaticResource Stars}"/>
                                        <Image Style="{StaticResource Stars}"/>
                                        <Image Style="{StaticResource Stars}"/>
                                        <Image Style="{StaticResource Stars}"/>
                                        <Image Style="{StaticResource Stars}"/>
                                    </HorizontalStackLayout>
                                    <Label Text="{Binding Nom}"
                                           TextColor="White"
                                           FontFamily="PTSansCaption-Bold"
                                           FontSize="12"
                                           Padding="25,110,0,0"/>
                                    <Image Source="download.png"
                                           HorizontalOptions="Start"
                                           HeightRequest="20"
                                           WidthRequest="20"
                                           Margin="23,120,0,0"/>
                                    <Label Text="{Binding NbTelechargement}"
                                           TextColor="White"
                                           FontFamily="PTSansCaption-Bold"
                                           FontSize="8"
                                           Padding="44,135,0,0"/>
                                </Grid>
                            </DataTemplate>
                        </BindableLayout.ItemTemplate>
                    </HorizontalStackLayout>
                </ScrollView>

                <Label
                Text="Jeux les mieux notés"
                FontFamily="PTSansCaption-Bold"
                FontSize="24"
                Grid.Row="5"
                Padding="25,25,0,25"
                />

                <Grid Grid.Row="6" ColumnDefinitions="auto,auto,auto">

                    <VerticalStackLayout Spacing="40" BindableLayout.ItemsSource="{Binding ListJeux}">
                        <BindableLayout.ItemTemplate>
                            <DataTemplate>
                                <HorizontalStackLayout Grid.Row="0" Spacing="20">
                                    <Image Source="{Binding Image}" HeightRequest="60" WidthRequest="100" Margin="25,0,0,0"/>
                                    <VerticalStackLayout Spacing="15">
                                        <Label Text="{Binding Nom}" FontFamily="PTSansNarrow-Bold" FontSize="15"/>
                                        <HorizontalStackLayout>
                                            <Image Style="{StaticResource Star}"/>
                                            <Label Text="{Binding Note}"
                                           TextColor="#7C7C7C"
                                           FontFamily="PTSansNarrow-Bold"
                                           FontSize="12"
                                           Margin="6,0,15,0"/>
                                            <Image Source="download_blue.png"
                                           HeightRequest="20"
                                           WidthRequest="20"
                                           HorizontalOptions="Start"
                                           VerticalOptions="Start"/>
                                            <Label Text="{Binding NbTelechargement}"
                                           TextColor="#7C7C7C"
                                           FontFamily="PTSansNarrow-Bold"
                                           FontSize="12"
                                           Margin="6,0,0,0"/>
                                        </HorizontalStackLayout>
                                    </VerticalStackLayout>

                                    <views:BoutonVoir/>
                                </HorizontalStackLayout>
                            </DataTemplate>
                        </BindableLayout.ItemTemplate>

                    </VerticalStackLayout>

                </Grid>

            </Grid>

        </ScrollView>
    </Grid>

</ContentPage>