<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:model="clr-namespace:CanYouBuildIt.Model"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="CanYouBuildIt.Views.Acceuil"
             Title="Can You Build It"
             BackgroundColor="#26B4BE">

    <VerticalStackLayout>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            
            
            <Image  Source="logoapp.png"
                    Grid.Row="0"  Grid.Column="1"
                    MaximumHeightRequest="150"/>

            <Button BackgroundColor="DimGrey"
                    Clicked="NavLogin"
                    Grid.Row="0" Grid.Column="2"
                    HorizontalOptions="End"
                    Margin="0,0,75,0"
                    MaximumHeightRequest="50"
                    Text="Login"
                    TextColor="Snow"
                    x:Name="Log"/>

        </Grid>


        <Grid 
            Margin="10,50,10,0"
            BindingContext="{Binding manager.listBuild}"
            x:Name="gridacc">

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="1"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

        </Grid>


        <Grid Margin="0,150">

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Button BackgroundColor="DimGrey"
                    Clicked="NavFav"
                    Grid.Row="0" Grid.Column="5"
                    HorizontalOptions="Center"
                    Text="Favoris"
                    TextColor="Snow"
                    x:Name="Fav"/>

            <Label Text="{Binding listUtil[user].username}"/>

            <Button BackgroundColor="DimGrey"
                    Clicked="ToQuit"
                    Grid.Row="1" Grid.Column="1"
                    HorizontalOptions="Center"
                    Text="Quitter"
                    TextColor="Snow"
                    x:Name="Quit"/>

            <Button BackgroundColor="DimGrey"
                    Clicked="NavCreds"
                    Grid.Row="1" Grid.Column="6"
                    HorizontalOptions="Center"
                    Text="Credits"
                    TextColor="Snow"
                    x:Name="Creds"/>

        </Grid>
        
        <Label  BackgroundColor="Red"
                FontAttributes="Bold"
                HorizontalOptions="Center"
                IsVisible="false"
                Margin="0,-125"
                Text="WARNING ! Vous devez vous connecter pour acceder au favoris."
                WidthRequest="500"
                x:Name="aConnecter"/>
    </VerticalStackLayout>
</ContentPage>