<UserControl x:Class="GitHub.VisualStudio.Views.Documents.CommitListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ghfvs="https://github.com/github/VisualStudio"
             xmlns:v="clr-namespace:GitHub.VisualStudio.Views"
             xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.14.0"
             mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800">
    <Control.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ghfvs:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio.UI;component/SharedDictionary.xaml" />
                <ghfvs:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI;component/SharedDictionary.xaml" />
                <ghfvs:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI.Reactive;component/SharedDictionary.xaml" />
                <ghfvs:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Styles/Markdown.xaml" />
                <StaticResource ResourceKey="ThemedDialogDefaultStylesKey"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Control.Resources>

    <Grid Margin="0,8">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="45" /> 
            <ColumnDefinition Width="*" /> 
        </Grid.ColumnDefinitions>

        <StackPanel Orientation="Vertical" Grid.Column="1">
            <StackPanel Orientation="Horizontal">
                <Canvas Width="28"
                        Height="28"
                        HorizontalAlignment="Center"
                        Grid.Column="0">
                    <Ellipse Height="28"
                             Width="28"
                             Fill="{DynamicResource GitHubTimelineEventBackgroundBrush}" /> 

                    <ghfvs:OcticonImage DockPanel.Dock="Left"
                                    Foreground="{DynamicResource VsBrush.WindowText}"
                                    Margin="6 7 6 6"
                                    Width="16"
                                    Icon="repo_push"
                                    HorizontalAlignment="Center" />
                </Canvas>

                <v:ActorAvatarView  
                    VerticalAlignment="Center"
                    Width="16" 
                    Height="16" 
                    Margin="4 0"
                    ViewModel="{Binding Author}"/>

                <TextBlock Foreground="{DynamicResource VsBrush.WindowText}" VerticalAlignment="Center">
                    <Run FontWeight="SemiBold" Text="{Binding AuthorName, Mode=OneWay}" />
                    <Run Text="{Binding AuthorCaption, Mode=OneWay}" />
                </TextBlock>
            </StackPanel>

            <ItemsControl ItemsSource="{Binding Commits}">
                <Control.Resources>
                    <DataTemplate DataType="{x:Type ghfvs:CommitSummaryViewModel}">
                        <Border Padding="32 0 8 0">
                            <DockPanel>
                                <ghfvs:OcticonImage DockPanel.Dock="Left"
                                                Foreground="{DynamicResource VsBrush.GrayText}"
                                                Margin="0,0,2,0"
                                                Icon="git_commit"/>
                                <v:ActorAvatarView DockPanel.Dock="Left"
                                               Width="16"
                                               Height="16"
                                               Margin="2"
                                               ViewModel="{Binding Author}"/>
                                <TextBlock DockPanel.Dock="Right"
                                       FontFamily="Consolas"
                                       Margin="0,0,0,2"
                                       VerticalAlignment="Center">
                                    <Hyperlink Command="{Binding DataContext.ShowCommit, ElementName=timeline}"
                                               CommandParameter="{Binding Oid}"
                                               Style="{StaticResource {x:Static vsfx:VsResourceKeys.ThemedDialogHyperlinkStyleKey}}">
                                        <Run Text="{Binding AbbreviatedOid, Mode=OneWay}"/>
                                    </Hyperlink>
                                </TextBlock>
                                <TextBlock Margin="0,0,0,2"
                                       Foreground="{DynamicResource VsBrush.WindowText}"
                                       Text="{Binding Header}" 
                                       VerticalAlignment="Center"/>
                            </DockPanel>
                        </Border>
                    </DataTemplate>
                </Control.Resources>
            </ItemsControl>
        </StackPanel>
    </Grid>
</UserControl>
