From 930b460e565f64964f745cbbf0b6f8d98b399dfc Mon Sep 17 00:00:00 2001 From: Sebastien Duquette Date: Fri, 9 Oct 2026 17:11:06 -0400 Subject: [PATCH 1/2] Adjust the catalog section to follow the standard style --- .../Assets/Styles/Styles.Common.axaml | 33 ++++ .../SoftwarePages/SoftwareCatalogViewModel.cs | 32 +++- .../SoftwarePages/AbstractPackagesPage.axaml | 32 ---- .../SoftwarePages/SoftwareCatalogPage.axaml | 151 ++++++++++++++---- .../SoftwareCatalogPage.axaml.cs | 48 ++++++ 5 files changed, 231 insertions(+), 65 deletions(-) diff --git a/src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml b/src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml index 00e7acbae2..b001dc1cc8 100644 --- a/src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml +++ b/src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml @@ -495,6 +495,39 @@ + + + + + - - - diff --git a/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml b/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml index 73579cf2e3..63dc60051b 100644 --- a/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml +++ b/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml @@ -25,16 +25,61 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + - - + + + + + + - + @@ -93,7 +162,7 @@ - + @@ -101,11 +170,21 @@ - - - - + + + + + + - + - + - - - - - - + + + + + @@ -340,9 +432,8 @@ - - - + diff --git a/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml.cs b/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml.cs index 3b26bef9f8..c5049ad177 100644 --- a/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml.cs +++ b/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml.cs @@ -1,6 +1,10 @@ +using System.ComponentModel; +using Avalonia; using Avalonia.Controls; using Avalonia.Threading; +using UniGetUI.Avalonia.Extensions; using UniGetUI.Avalonia.ViewModels.Pages; +using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.PackageLoader; @@ -8,9 +12,12 @@ namespace UniGetUI.Avalonia.Views.Pages; public partial class SoftwareCatalogPage : UserControl, IEnterLeaveListener, ISearchBoxPage { + private const string FilterPaneWidthKey = "SoftwareCatalog"; + private const double DefaultFilterPaneWidth = 220; private readonly SoftwareCatalogViewModel _viewModel = new(); private readonly DispatcherTimer _stateTimer = new() { Interval = TimeSpan.FromSeconds(2) }; private InstalledPackagesLoader? _loader; + private double _savedFilterPaneWidth = DefaultFilterPaneWidth; public string QueryBackup { @@ -27,6 +34,47 @@ public SoftwareCatalogPage() InitializeComponent(); DataContext = _viewModel; _stateTimer.Tick += (_, _) => _viewModel.UpdateStates(); + + // Restore the per-page filter pane width from settings. + var savedWidth = Settings.GetDictionaryItem(Settings.K.SidepanelWidths, FilterPaneWidthKey); + if (savedWidth >= 100) _savedFilterPaneWidth = savedWidth; + _viewModel.TrackedFilterPaneWidth = _savedFilterPaneWidth; + + // Persist the dragged width and snap the pane closed when it is dragged below the minimum. + FilteringPanel.ColumnDefinitions[0] + .GetObservable(ColumnDefinition.WidthProperty) + .SubscribeValue(width => + { + if (!_viewModel.IsFilterPaneOpen) return; + if (width.IsAbsolute && width.Value >= 100) + { + _savedFilterPaneWidth = width.Value; + _viewModel.TrackedFilterPaneWidth = width.Value; + Settings.SetDictionaryItem(Settings.K.SidepanelWidths, FilterPaneWidthKey, (int)width.Value); + } + else if (width.IsAbsolute && width.Value < 100) + { + _savedFilterPaneWidth = DefaultFilterPaneWidth; + _viewModel.TrackedFilterPaneWidth = DefaultFilterPaneWidth; + _viewModel.IsFilterPaneOpen = false; + } + }); + + _viewModel.PropertyChanged += OnViewModelPropertyChanged; + UpdateFilterPaneColumn(_viewModel.IsFilterPaneOpen); + } + + private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(SoftwareCatalogViewModel.IsFilterPaneOpen)) + UpdateFilterPaneColumn(_viewModel.IsFilterPaneOpen); + } + + private void UpdateFilterPaneColumn(bool open) + { + if (FilteringPanel.ColumnDefinitions.Count < 2) return; + FilteringPanel.ColumnDefinitions[0].Width = open ? new GridLength(_savedFilterPaneWidth) : new GridLength(0); + FilteringPanel.ColumnDefinitions[1].Width = open ? new GridLength(12) : new GridLength(0); } public void OnEnter() From 5909d3c1b7016d5f6ebf1dba1d2c4463361424db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Duquette?= Date: Fri, 9 Oct 2026 17:42:06 -0400 Subject: [PATCH 2/2] Display messages in the content pane. --- .../SoftwarePages/SoftwareCatalogViewModel.cs | 23 +++++++++++++++---- .../SoftwarePages/SoftwareCatalogPage.axaml | 15 ++++++------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/UniGetUI.Avalonia/ViewModels/SoftwarePages/SoftwareCatalogViewModel.cs b/src/UniGetUI.Avalonia/ViewModels/SoftwarePages/SoftwareCatalogViewModel.cs index 961bcd9693..0bb4ca8bad 100644 --- a/src/UniGetUI.Avalonia/ViewModels/SoftwarePages/SoftwareCatalogViewModel.cs +++ b/src/UniGetUI.Avalonia/ViewModels/SoftwarePages/SoftwareCatalogViewModel.cs @@ -109,12 +109,25 @@ public bool HasHiddenPackages public bool IsEmpty => !IsLoading && !HasError && Packages.Count == 0; - public bool HasStatusMessage => IsLoading || HasError || IsEmpty || HasHiddenPackages; + public string BackgroundText => HasError + ? ErrorMessage + : !IsEmpty ? "" + : HasHiddenPackages + ? CoreTools.Translate("Packages with unavailable sources are hidden. Change Filters to show them.") + : EmptyMessage; + + public bool HasBackgroundText => BackgroundText.Length > 0; partial void OnIsLoadingChanged(bool value) { OnPropertyChanged(nameof(IsEmpty)); - OnPropertyChanged(nameof(HasStatusMessage)); + NotifyBackgroundTextChanged(); + } + + private void NotifyBackgroundTextChanged() + { + OnPropertyChanged(nameof(BackgroundText)); + OnPropertyChanged(nameof(HasBackgroundText)); } partial void OnSelectedCatalogChanged(CatalogDefinition? value) @@ -134,7 +147,7 @@ partial void OnSelectedCatalogChanged(CatalogDefinition? value) } UpdateStates(); OnPropertyChanged(nameof(IsEmpty)); - OnPropertyChanged(nameof(HasStatusMessage)); + NotifyBackgroundTextChanged(); } [ObservableProperty] @@ -149,7 +162,7 @@ partial void OnErrorMessageChanged(string value) { OnPropertyChanged(nameof(HasError)); OnPropertyChanged(nameof(IsEmpty)); - OnPropertyChanged(nameof(HasStatusMessage)); + NotifyBackgroundTextChanged(); if (value.Length > 0) Avalonia.Infrastructure.AccessibilityAnnouncementService.Announce( value, global::Avalonia.Automation.AutomationLiveSetting.Assertive); @@ -359,7 +372,7 @@ internal void ApplyAvailabilityFilter() OnPropertyChanged(nameof(HasHiddenPackages)); OnPropertyChanged(nameof(EmptyMessage)); OnPropertyChanged(nameof(IsEmpty)); - OnPropertyChanged(nameof(HasStatusMessage)); + NotifyBackgroundTextChanged(); } private bool MatchesQuery(CatalogEntry entry, string query) => query.Length == 0 || SearchMode switch diff --git a/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml b/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml index 63dc60051b..4187f29c79 100644 --- a/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml +++ b/src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareCatalogPage.axaml @@ -162,14 +162,7 @@ - - - - - - + +