From 3f0357207d05868a6b1c85b98b7a628876111847 Mon Sep 17 00:00:00 2001 From: Hol <79064972+TrainerHol@users.noreply.github.com> Date: Thu, 3 Sep 2026 15:47:40 -0700 Subject: [PATCH 1/5] feat: add responsive repository layout --- src/Views/Launcher.axaml | 2 +- src/Views/Repository.axaml | 66 ++++++++++++++++-- src/Views/Repository.axaml.cs | 123 +++++++++++++++++++++++++++++++++ src/Views/StashesPage.axaml | 4 +- src/Views/StashesPage.axaml.cs | 2 +- src/Views/Welcome.axaml | 2 +- src/Views/WorkingCopy.axaml | 14 ++-- src/Views/WorkingCopy.axaml.cs | 2 +- 8 files changed, 196 insertions(+), 19 deletions(-) diff --git a/src/Views/Launcher.axaml b/src/Views/Launcher.axaml index 00aa09a228..cd016e99d0 100644 --- a/src/Views/Launcher.axaml +++ b/src/Views/Launcher.axaml @@ -11,7 +11,7 @@ x:Name="ThisControl" Icon="/App.ico" Title="{Binding Title}" - MinWidth="1024" MinHeight="600"> + MinWidth="720" MinHeight="480"> diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index 8c9557e53d..bbabde53cb 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -9,17 +9,58 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SourceGit.Views.Repository" x:DataType="vm:Repository"> - + + + + + + + + + + + + + - + - + + - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -770,8 +659,19 @@ Focusable="False"/> - - + + + + + + @@ -875,7 +775,7 @@ Click="OnAbortInProgress"/> - - + @@ -1020,7 +920,7 @@ VerticalAlignment="Center" Filter="{Binding Mode=OneWay}" IsFilterValid="{Binding IsValid, Mode=OneWay}"/> - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Views/RepositoryViewSwitcher.axaml.cs b/src/Views/RepositoryViewSwitcher.axaml.cs new file mode 100644 index 0000000000..61946f2da6 --- /dev/null +++ b/src/Views/RepositoryViewSwitcher.axaml.cs @@ -0,0 +1,67 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.VisualTree; + +namespace SourceGit.Views +{ + public partial class RepositoryViewSwitcher : UserControl + { + public static readonly StyledProperty OrientationProperty = + AvaloniaProperty.Register(nameof(Orientation), Orientation.Vertical); + + public Orientation Orientation + { + get => GetValue(OrientationProperty); + set => SetValue(OrientationProperty, value); + } + + public static readonly StyledProperty ShowInlineActionsProperty = + AvaloniaProperty.Register(nameof(ShowInlineActions), true); + + public bool ShowInlineActions + { + get => GetValue(ShowInlineActionsProperty); + set => SetValue(ShowInlineActionsProperty, value); + } + + public static readonly StyledProperty ItemMinWidthProperty = + AvaloniaProperty.Register(nameof(ItemMinWidth)); + + public double ItemMinWidth + { + get => GetValue(ItemMinWidthProperty); + set => SetValue(ItemMinWidthProperty, value); + } + + public RepositoryViewSwitcher() + { + InitializeComponent(); + ViewSelector.AddHandler(PointerPressedEvent, OnViewSelectorPointerPressed, RoutingStrategies.Tunnel); + } + + private void OnViewSelectorPointerPressed(object sender, PointerPressedEventArgs e) + { + if (e.GetCurrentPoint(ViewSelector).Properties.PointerUpdateKind == PointerUpdateKind.RightButtonPressed) + e.Handled = true; + } + + private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + this.FindAncestorOfType()?.CloseCompactSidebar(); + e.Handled = true; + } + + private void OnRepositoryViewContextRequested(object sender, ContextRequestedEventArgs e) + { + this.FindAncestorOfType()?.OpenRepositoryViewContextMenu(sender, e, !ShowInlineActions); + } + + private void OnOpenAdvancedHistoriesOption(object sender, RoutedEventArgs e) + { + this.FindAncestorOfType()?.OpenAdvancedHistoriesOption(sender, e); + } + } +}