<?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"
             x:Class="Qwirkle.Pages.Leaderboard"
             xmlns:controls="clr-namespace:Qwirkle.Views"
             Title="Leaderboard"
             x:Name="root">

    <ScrollView>
        <VerticalStackLayout Spacing="25" Padding="5, 5, 5, 10">
            <Grid Style="{StaticResource GridMain}">
                <controls:GoBack></controls:GoBack>
                <Label Text="Leaderboard"
                       Style="{StaticResource Title}" />
            </Grid>

            <Border Style="{StaticResource TabBorder}">

                <Border.Shadow>
                    <Shadow />
                </Border.Shadow>
                <Border.StrokeShape>
                    <RoundRectangle CornerRadius="3" />
                </Border.StrokeShape>

                <StackLayout>
                    <Grid ColumnDefinitions="4*, auto, 2*, auto, 2*, auto, 2*"
                          RowDefinitions="50">
                        <Label
                            Text="Player tag"
                            Style="{StaticResource ContentTab}" />
                        <Rectangle
                            Style="{StaticResource RectangleTab}"
                            Grid.Column="1" />
                        <Label
                            Grid.Column="2"
                            Text="Date"
                            Style="{StaticResource ContentTab}" />
                        <Rectangle
                            Style="{StaticResource RectangleTab}"
                            Grid.Column="3" />
                        <Label
                            Grid.Column="4"
                            Text="Points"
                            Style="{StaticResource ContentTab}" />
                        <Rectangle
                            Style="{StaticResource RectangleTab}"
                            Grid.Column="5" />
                        <Label
                            Grid.Column="6"
                            Style="{StaticResource ContentTab}"
                            Text="Victories" />
                    </Grid>

                    <CollectionView ItemsSource="{Binding Lb}">
                        <CollectionView.ItemsLayout>
                            <GridItemsLayout Orientation="Vertical" />
                        </CollectionView.ItemsLayout>
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <controls:LeaderboardLine PlayerName="{Binding PlayerName}" Date="{Binding Date}"
                                                          Points="{Binding Points}" Victories="{Binding Victories}" />
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                    </CollectionView>

                </StackLayout>
            </Border>

        </VerticalStackLayout>
    </ScrollView>
</ContentPage>