sourcegit/src/Views/CommitDetail.axaml
Dmitrij D. Czarkoff cc5bb5f6d4
Show the list of children in the commit details (#710)
* feature: add children list to the commit base info view

Useful for navigation between the commits.

* feature: use repository filters to limit children search
* feature: execute children search asynchronously
* feature: respect global commit limit for a good measure
* fix: input lines may contain several commits

The first commit is always the immediate child, so take only 40 initial characters of the line

* fix: hide children behind the preference
* feature: make parents and children scrollable
2024-11-20 09:17:36 +08:00

89 lines
3.9 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.CommitDetail"
x:DataType="vm:CommitDetail">
<TabControl SelectedIndex="{Binding ActivePageIndex, Mode=TwoWay}" Padding="4">
<!-- Information Page -->
<TabItem>
<TabItem.Header>
<TextBlock Classes="tab_header" Text="{DynamicResource Text.CommitDetail.Info}"/>
</TabItem.Header>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical">
<!-- Base Information -->
<v:CommitBaseInfo Content="{Binding Commit}"
Message="{Binding FullMessage}"
SignInfo="{Binding SignInfo}"
SupportsContainsIn="True"
WebLinks="{Binding WebLinks}"
Children="{Binding Children}"
IssueTrackerRules="{Binding IssueTrackerRules}"/>
<!-- Line -->
<Rectangle Height=".65" Margin="8" Fill="{DynamicResource Brush.Border2}"/>
<!-- Change List -->
<ListBox Background="Transparent"
Margin="64,0,8,4"
SelectionMode="Single"
ItemsSource="{Binding Changes, Converter={x:Static c:ListConverters.Top100Changes}}">
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="MinHeight" Value="24"/>
<Setter Property="CornerRadius" Value="4"/>
</Style>
</ListBox.Styles>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate DataType="m:Change">
<Grid Background="Transparent" Height="24" ColumnDefinitions="36,*" ContextRequested="OnChangeContextRequested" DoubleTapped="OnChangeDoubleTapped">
<v:ChangeStatusIcon Grid.Column="0"
Width="14" Height="14"
HorizontalAlignment="Left"
Margin="16,0,0,0"
Change="{Binding}"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Path}" Margin="8,0" TextTrimming="CharacterEllipsis"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- Only Top100 Tip -->
<TextBlock Margin="108,0,0,16"
Text="{DynamicResource Text.CommitDetail.Info.GotoChangesPage}"
Foreground="{DynamicResource Brush.FG2}"
IsVisible="{Binding Changes, Converter={x:Static c:ListConverters.IsOnlyTop100Shows}}"/>
</StackPanel>
</ScrollViewer>
</TabItem>
<TabItem>
<TabItem.Header>
<TextBlock Classes="tab_header" Text="{DynamicResource Text.CommitDetail.Changes}"/>
</TabItem.Header>
<v:CommitChanges/>
</TabItem>
<TabItem>
<TabItem.Header>
<TextBlock Classes="tab_header" Text="{DynamicResource Text.CommitDetail.Files}"/>
</TabItem.Header>
<v:RevisionFiles/>
</TabItem>
</TabControl>
</UserControl>