<UserControl x:Class="UniGetUI.Avalonia.Views.Pages.AboutPages.Translators"
             xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:automation="clr-namespace:Avalonia.Automation;assembly=Avalonia.Controls"
             xmlns:vm="using:UniGetUI.Avalonia.ViewModels.Pages.AboutPages"
             xmlns:t="using:UniGetUI.Avalonia.MarkupExtensions"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:DataType="vm:TranslatorsViewModel">

    <ScrollViewer HorizontalScrollBarVisibility="Disabled">
        <StackPanel Orientation="Vertical" Spacing="4" Margin="16,8">

            <TextBlock Text="{t:Translate Translators}"
                       FontFamily="Segoe UI Variable Display"
                       FontSize="24"
                       FontWeight="Bold"/>

            <TextBlock Text="{Binding ThanksText}"
                       FontSize="14"
                       TextWrapping="Wrap"/>

            <Button Click="BecomeTranslatorButton_Click"
                    Background="Transparent"
                    BorderThickness="0"
                    Padding="0"
                    HorizontalAlignment="Left"
                    Margin="0,4,0,8"
                    automation:AutomationProperties.Name="{t:Translate Become a translator}">
                <TextBlock Classes="hyperlink"
                           FontSize="14"
                           Text="{t:Translate Become a translator}"
                           automation:AutomationProperties.AccessibilityView="Raw"/>
            </Button>

            <ItemsControl ItemsSource="{Binding TranslatorList}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate x:DataType="vm:TranslatorEntry">
                        <Grid ColumnDefinitions="3*,Auto,2*,67"
                              Margin="0,3"
                              ColumnSpacing="8">

                            <TextBlock Grid.Column="0"
                                       Text="{Binding Language}"
                                       FontSize="14"
                                       VerticalAlignment="Center"/>

                            <!-- Avatar -->
                            <Border Grid.Column="1"
                                    Width="32" Height="32"
                                    CornerRadius="16"
                                    ClipToBounds="True">
                                <Panel>
                                    <Border Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"/>
                                    <Image Source="{Binding ProfilePicture}"
                                           Stretch="UniformToFill"/>
                                </Panel>
                            </Border>

                            <TextBlock Grid.Column="2"
                                       Text="{Binding Name}"
                                       FontSize="14"
                                       VerticalAlignment="Center"/>

                            <Button Grid.Column="3"
                                    Tag="{Binding GitHubUrl}"
                                    IsVisible="{Binding HasGitHubProfile}"
                                    Click="GitHubButton_Click"
                                    Background="Transparent"
                                    BorderThickness="0"
                                    Padding="4,0"
                                    automation:AutomationProperties.Name="{Binding Name}">
                                <TextBlock Classes="hyperlink"
                                           FontSize="14"
                                           Text="GitHub"
                                           automation:AutomationProperties.AccessibilityView="Raw"/>
                            </Button>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

        </StackPanel>
    </ScrollViewer>

</UserControl>
