<commit_before>﻿<views:GenericCommentView x:Class="GitHub.VisualStudio.Views.CommentView"
             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:cache="clr-namespace:GitHub.UI.Helpers;assembly=GitHub.UI"
             xmlns:controls="clr-namespace:GitHub.VisualStudio.UI.Controls"
             xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
             xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
             xmlns:views="clr-namespace:GitHub.VisualStudio.Views"
             mc:Ignorable="d" d:DesignWidth="300">
    <d:DesignProperties.DataContext>
        <ghfvs:CommentViewModelDesigner EditState="None">
            <ghfvs:CommentViewModelDesigner.Body>
                You can use a `CompositeDisposable` type here, it's designed to handle disposables in an optimal way (you can just call `Dispose()` on it and it will handle disposing everything it holds).
            </ghfvs:CommentViewModelDesigner.Body>
        </ghfvs:CommentViewModelDesigner>
    </d:DesignProperties.DataContext>

    <FrameworkElement.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI;component/SharedDictionary.xaml" />
                <cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI.Reactive;component/SharedDictionary.xaml" />
                <cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio.UI;component/SharedDictionary.xaml" />
                <cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI;component/Assets/Markdown.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="Button" BasedOn="{StaticResource GitHubVsButton}"/>
        </ResourceDictionary>
    </FrameworkElement.Resources>

    <FrameworkElement.CommandBindings>
        <CommandBinding Command="{x:Static markdig:Commands.Hyperlink}" Executed="OpenHyperlink" />
    </FrameworkElement.CommandBindings>

    <Grid>
        <!-- Displays an existing comment-->
        <Border BorderBrush="{DynamicResource VsBrush.ScrollBarThumbBackground}" BorderThickness="0 1 0 0" HorizontalAlignment="Stretch">
            <Grid Background="{DynamicResource VsBrush.ToolWindowBackground}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="4" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Grid.Style>
                    <Style TargetType="FrameworkElement">
                        <Setter Property="Visibility" Value="Collapsed"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding EditState}" Value="None">
                                <Setter Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Style>

                <StackPanel Background="#82909e" Grid.Row="0" Grid.Column="0" Grid.RowSpan="5" Visibility="{Binding Model.AnnotationLevel, Converter={ghfvs:EqualsToVisibilityConverter Notice}}" />

                <Border Grid.Column="1" Padding="8">
                    <StackPanel>
                        <DockPanel>
                          <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" >
                            <controls:AccountAvatar Width="16" 
                                                    Height="16" 
                                                    Account="{Binding Author}"/>

                            <TextBlock Foreground="{DynamicResource GitHubVsToolWindowText}" FontWeight="SemiBold" Text="{Binding Author.Login}" Margin="4 0"/>
                            <ui:GitHubActionLink Content="{Binding CreatedAt, Converter={ui:DurationToStringConverter}}"
                                                 Command="{Binding OpenOnGitHub}"
                                                 Foreground="{DynamicResource GitHubVsToolWindowText}"
                                                 Opacity="0.75" />
                            <Border Background="{DynamicResource VsBrush.InfoBackground}"
                                    BorderBrush="{DynamicResource VsBrush.AccentPale}"
                                    BorderThickness="1"
                                    CornerRadius="3"
                                    Padding="2 1"
                                    Visibility="{Binding IsPending, Converter={ui:BooleanToVisibilityConverter}, FallbackValue=Collapsed}">
                              <TextBlock FontSize="10" Text="{x:Static ghfvs:Resources.Pending}" />
                            </Border>
                          </StackPanel>

                          <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right"
                                      Visibility="{Binding CanDelete, Converter={ui:BooleanToVisibilityConverter}}">
                            <ui:OcticonButton Command="{Binding BeginEdit}"
                                              Height="16"
                                              Width="20"
                                              Margin="0 0 4 0"
                                              Background="Transparent"
                                              Foreground="{DynamicResource GitHubVsToolWindowText}"
                                              Icon="pencil"/>
                            <ui:OcticonButton Command="{Binding Delete}"
                                              Width="16"
                                              Height="16"
                                              Margin="0"
                                              Background="Transparent"
                                              Foreground="{DynamicResource GitHubVsToolWindowText}"
                                              Icon="x"/>
                          </StackPanel>
                        </DockPanel>

                        <markdig:MarkdownViewer Grid.Column="1" Grid.Row="1" 
                                                Margin="20 2 0 0"
                                                Foreground="{DynamicResource VsBrush.WindowText}"
                                                Markdown="{Binding Body}"/>

                        <DockPanel Grid.Column="1" Grid.Row="2"
                                   Margin="0 4"
                                   HorizontalAlignment="Left" 
                                   TextBlock.Foreground="Red">
                            <DockPanel.Style>
                                <Style TargetType="FrameworkElement">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ErrorMessage}" Value="{x:Null}">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </DockPanel.Style>
                            <ui:OcticonImage DockPanel.Dock="Left" Icon="alert" Margin="0 0 4 0"/>
                            <TextBlock Text="{Binding ErrorMessage}" TextWrapping="Wrap"/>
                        </DockPanel>
                    </StackPanel>
                </Border>
            </Grid>
        </Border>

        <!-- Displays edit view or a reply placeholder-->
        <Grid>
            <Grid.Style>
                <Style TargetType="FrameworkElement">
                    <Setter Property="Visibility" Value="Collapsed"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding EditState}" Value="Placeholder">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding EditState}" Value="Editing">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <Separator Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Margin="0 0 0 4" 
                       Background="{DynamicResource GitHubButtonBorderBrush}"/>

            <ui:PromptTextBox Name="body"
                              Grid.Column="1"
                              Grid.Row="1"
                              AcceptsReturn="True"
                              AcceptsTab="True"
                              IsReadOnly="{Binding IsReadOnly}"
                              Margin="4 0"
                              Text="{Binding Body, UpdateSourceTrigger=PropertyChanged}"
                              TextWrapping="Wrap"
                              VerticalAlignment="Center"
                              GotFocus="ReplyPlaceholder_GotFocus"
                              Loaded="body_Loaded"
                              SpellCheck.IsEnabled="True">
                <ui:PromptTextBox.Style>
                    <Style TargetType="ui:PromptTextBox" BasedOn="{StaticResource RoundedPromptTextBox}">
                        <Setter Property="Foreground" Value="{DynamicResource GitHubVsToolWindowText}" />
                        <Setter Property="Background" Value="{DynamicResource VsBrush.SearchBoxBackground}" />
                        <Setter Property="Height" Value="28"/>
                        <Setter Property="PromptText" Value="Reply..."/>
                        <Setter Property="BorderBrush" Value="{DynamicResource GitHubVsBrandedUIBorder}" />

                        <Style.Triggers>
                            <DataTrigger Binding="{Binding EditState}" Value="Editing">
                                <Setter Property="MinHeight" Value="100"/>
                                <Setter Property="PromptText" Value="Leave a comment"/>
                            </DataTrigger>
                        </Style.Triggers>

                        <Style.Resources>
                            <Style TargetType="TextBlock">
                                <Setter Property="Foreground" Value="{DynamicResource GitHubVsToolWindowText}" />
                            </Style>
                        </Style.Resources>
                    </Style>
                </ui:PromptTextBox.Style>
            </ui:PromptTextBox><commit_msg>Fix bottom margin for reply textbox<commit_after>﻿<views:GenericCommentView x:Class="GitHub.VisualStudio.Views.CommentView"
             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:cache="clr-namespace:GitHub.UI.Helpers;assembly=GitHub.UI"
             xmlns:controls="clr-namespace:GitHub.VisualStudio.UI.Controls"
             xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
             xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
             xmlns:views="clr-namespace:GitHub.VisualStudio.Views"
             mc:Ignorable="d" d:DesignWidth="300">
    <d:DesignProperties.DataContext>
        <ghfvs:CommentViewModelDesigner EditState="None">
            <ghfvs:CommentViewModelDesigner.Body>
                You can use a `CompositeDisposable` type here, it's designed to handle disposables in an optimal way (you can just call `Dispose()` on it and it will handle disposing everything it holds).
            </ghfvs:CommentViewModelDesigner.Body>
        </ghfvs:CommentViewModelDesigner>
    </d:DesignProperties.DataContext>

    <FrameworkElement.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI;component/SharedDictionary.xaml" />
                <cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI.Reactive;component/SharedDictionary.xaml" />
                <cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio.UI;component/SharedDictionary.xaml" />
                <cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI;component/Assets/Markdown.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="Button" BasedOn="{StaticResource GitHubVsButton}"/>
        </ResourceDictionary>
    </FrameworkElement.Resources>

    <FrameworkElement.CommandBindings>
        <CommandBinding Command="{x:Static markdig:Commands.Hyperlink}" Executed="OpenHyperlink" />
    </FrameworkElement.CommandBindings>

    <Grid>
        <!-- Displays an existing comment-->
        <Border BorderBrush="{DynamicResource VsBrush.ScrollBarThumbBackground}" BorderThickness="0 1 0 0" HorizontalAlignment="Stretch">
            <Grid Background="{DynamicResource VsBrush.ToolWindowBackground}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="4" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Grid.Style>
                    <Style TargetType="FrameworkElement">
                        <Setter Property="Visibility" Value="Collapsed"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding EditState}" Value="None">
                                <Setter Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Style>

                <StackPanel Background="#82909e" Grid.Row="0" Grid.Column="0" Grid.RowSpan="5" Visibility="{Binding Model.AnnotationLevel, Converter={ghfvs:EqualsToVisibilityConverter Notice}}" />

                <Border Grid.Column="1" Padding="8">
                    <StackPanel>
                        <DockPanel>
                          <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" >
                            <controls:AccountAvatar Width="16" 
                                                    Height="16" 
                                                    Account="{Binding Author}"/>

                            <TextBlock Foreground="{DynamicResource GitHubVsToolWindowText}" FontWeight="SemiBold" Text="{Binding Author.Login}" Margin="4 0"/>
                            <ui:GitHubActionLink Content="{Binding CreatedAt, Converter={ui:DurationToStringConverter}}"
                                                 Command="{Binding OpenOnGitHub}"
                                                 Foreground="{DynamicResource GitHubVsToolWindowText}"
                                                 Opacity="0.75" />
                            <Border Background="{DynamicResource VsBrush.InfoBackground}"
                                    BorderBrush="{DynamicResource VsBrush.AccentPale}"
                                    BorderThickness="1"
                                    CornerRadius="3"
                                    Padding="2 1"
                                    Visibility="{Binding IsPending, Converter={ui:BooleanToVisibilityConverter}, FallbackValue=Collapsed}">
                              <TextBlock FontSize="10" Text="{x:Static ghfvs:Resources.Pending}" />
                            </Border>
                          </StackPanel>

                          <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right"
                                      Visibility="{Binding CanDelete, Converter={ui:BooleanToVisibilityConverter}}">
                            <ui:OcticonButton Command="{Binding BeginEdit}"
                                              Height="16"
                                              Width="20"
                                              Margin="0 0 4 0"
                                              Background="Transparent"
                                              Foreground="{DynamicResource GitHubVsToolWindowText}"
                                              Icon="pencil"/>
                            <ui:OcticonButton Command="{Binding Delete}"
                                              Width="16"
                                              Height="16"
                                              Margin="0"
                                              Background="Transparent"
                                              Foreground="{DynamicResource GitHubVsToolWindowText}"
                                              Icon="x"/>
                          </StackPanel>
                        </DockPanel>

                        <markdig:MarkdownViewer Grid.Column="1" Grid.Row="1" 
                                                Margin="20 2 0 0"
                                                Foreground="{DynamicResource VsBrush.WindowText}"
                                                Markdown="{Binding Body}"/>

                        <DockPanel Grid.Column="1" Grid.Row="2"
                                   Margin="0 4"
                                   HorizontalAlignment="Left" 
                                   TextBlock.Foreground="Red">
                            <DockPanel.Style>
                                <Style TargetType="FrameworkElement">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ErrorMessage}" Value="{x:Null}">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </DockPanel.Style>
                            <ui:OcticonImage DockPanel.Dock="Left" Icon="alert" Margin="0 0 4 0"/>
                            <TextBlock Text="{Binding ErrorMessage}" TextWrapping="Wrap"/>
                        </DockPanel>
                    </StackPanel>
                </Border>
            </Grid>
        </Border>

        <!-- Displays edit view or a reply placeholder-->
        <Grid>
            <Grid.Style>
                <Style TargetType="FrameworkElement">
                    <Setter Property="Visibility" Value="Collapsed"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding EditState}" Value="Placeholder">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding EditState}" Value="Editing">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <Separator Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Margin="0 0 0 4" 
                       Background="{DynamicResource GitHubButtonBorderBrush}"/>

            <ui:PromptTextBox Name="body"
                              Grid.Column="1"
                              Grid.Row="1"
                              AcceptsReturn="True"
                              AcceptsTab="True"
                              IsReadOnly="{Binding IsReadOnly}"
                              Margin="4 0 4 4"
                              Text="{Binding Body, UpdateSourceTrigger=PropertyChanged}"
                              TextWrapping="Wrap"
                              VerticalAlignment="Center"
                              GotFocus="ReplyPlaceholder_GotFocus"
                              Loaded="body_Loaded"
                              SpellCheck.IsEnabled="True">
                <ui:PromptTextBox.Style>
                    <Style TargetType="ui:PromptTextBox" BasedOn="{StaticResource RoundedPromptTextBox}">
                        <Setter Property="Foreground" Value="{DynamicResource GitHubVsToolWindowText}" />
                        <Setter Property="Background" Value="{DynamicResource VsBrush.SearchBoxBackground}" />
                        <Setter Property="Height" Value="28"/>
                        <Setter Property="PromptText" Value="Reply..."/>
                        <Setter Property="BorderBrush" Value="{DynamicResource GitHubVsBrandedUIBorder}" />

                        <Style.Triggers>
                            <DataTrigger Binding="{Binding EditState}" Value="Editing">
                                <Setter Property="MinHeight" Value="100"/>
                                <Setter Property="PromptText" Value="Leave a comment"/>
                            </DataTrigger>
                        </Style.Triggers>

                        <Style.Resources>
                            <Style TargetType="TextBlock">
                                <Setter Property="Foreground" Value="{DynamicResource GitHubVsToolWindowText}" />
                            </Style>
                        </Style.Resources>
                    </Style>
                </ui:PromptTextBox.Style>
            </ui:PromptTextBox>
{'fraction_non_alphanumeric': 0.10110791241385327, 'fraction_numerical': 0.008200296606473, 'mean_word_length': 1.3158585858585858, 'pattern_counts': {'":': 0, '<': 253, '<?xml version=': 0, '>': 253, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 22}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 110, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '523216', 'n_tokens_mistral': 5298, 'n_tokens_neox': 4709, 'n_words': 780}