feature: add a button to see which branches and tags that contains selected commit (#388)

This commit is contained in:
leo 2024-08-23 16:52:55 +08:00
parent fcc8a41ad1
commit 6ab0900b20
No known key found for this signature in database
14 changed files with 171 additions and 18 deletions

View file

@ -1,3 +1,5 @@
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Collections;
using Avalonia.Controls;
@ -17,6 +19,15 @@ namespace SourceGit.Views
set => SetValue(MessageProperty, value);
}
public static readonly StyledProperty<bool> SupportsContainsInProperty =
AvaloniaProperty.Register<CommitBaseInfo, bool>(nameof(SupportsContainsIn));
public bool SupportsContainsIn
{
get => GetValue(SupportsContainsInProperty);
set => SetValue(SupportsContainsInProperty, value);
}
public static readonly StyledProperty<AvaloniaList<Models.CommitLink>> WebLinksProperty =
AvaloniaProperty.Register<CommitBaseInfo, AvaloniaList<Models.CommitLink>>(nameof(WebLinks));
@ -74,6 +85,19 @@ namespace SourceGit.Views
e.Handled = true;
}
private void OnOpenContainsIn(object sender, RoutedEventArgs e)
{
if (DataContext is ViewModels.CommitDetail detail && sender is Button button)
{
var tracking = new CommitRelationTracking(detail);
var flyout = new Flyout();
flyout.Content = tracking;
flyout.ShowAt(button);
}
e.Handled = true;
}
private void OnParentSHAPressed(object sender, PointerPressedEventArgs e)
{
if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha })