Skip to content

Commit 63b9deb

Browse files
authored
Adjust the catalog section to follow the standard style (#5502)
The software catalog section was reworked to follow more closely the standard style of the other sections. The style for the filter-pane drag handle was moved to Styles.Common.axaml, the catalog is not an AbstractPackagesPage because it has some elements that are currently unique to it: The tile card sizing in addition to grid/icon. Per-tile Install / Installed button The HideUnavailablePackages option and "unavailable source" filtering, which isn't part of the shared filter pane. The catalog section is likely to change in the coming days. We can integrate those elements back into AbstractPackagesPage once we have settled on a design.
1 parent 752de8f commit 63b9deb

5 files changed

Lines changed: 250 additions & 72 deletions

File tree

‎src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,39 @@
495495
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorTertiaryBrush}"/>
496496
</Style>
497497

498+
<!-- Filter-pane drag handle. The full splitter track is interactive; its subtle rounded hover
499+
surface sits beneath the persistent grip, matching WinUI's pane-resize affordance. -->
500+
<Style Selector="GridSplitter.winui-vertical-splitter">
501+
<Setter Property="Background" Value="Transparent"/>
502+
<Setter Property="Transitions">
503+
<Transitions>
504+
<BrushTransition Property="Background" Duration="0:0:0.083"/>
505+
</Transitions>
506+
</Setter>
507+
<Setter Property="Template">
508+
<ControlTemplate>
509+
<!-- Match the visible splitter track to the package-list container on the
510+
right, whose outer card is inset 6 DIPs vertically. -->
511+
<Border Background="{TemplateBinding Background}"
512+
Margin="0,6"
513+
CornerRadius="6">
514+
<Border Width="4" Height="22"
515+
CornerRadius="2"
516+
HorizontalAlignment="Center"
517+
VerticalAlignment="Center"
518+
Background="{DynamicResource TextFillColorTertiaryBrush}"
519+
IsHitTestVisible="False"/>
520+
</Border>
521+
</ControlTemplate>
522+
</Setter>
523+
</Style>
524+
<Style Selector="GridSplitter.winui-vertical-splitter:pointerover">
525+
<Setter Property="Background" Value="{DynamicResource SubtleFillColorSecondaryBrush}"/>
526+
</Style>
527+
<Style Selector="GridSplitter.winui-vertical-splitter:pressed">
528+
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTertiaryBrush}"/>
529+
</Style>
530+
498531
<!-- Standard non-accent action button. Keep this semantic style separate from the
499532
framework's default Button so icon, toolbar, dialog, and accent buttons retain
500533
their purpose-specific appearances. Reusable controls such as ButtonCard opt in

‎src/UniGetUI.Avalonia/ViewModels/SoftwarePages/SoftwareCatalogViewModel.cs‎

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ public partial class SoftwareCatalogViewModel : ViewModelBase
4040
[ObservableProperty]
4141
private bool _isFilterPaneOpen;
4242

43+
// Live width of the filter pane, kept in sync by the page so the toolbar's Filters button
44+
// reserves the pane's width and the remaining buttons align with the package list.
45+
private double _trackedFilterPaneWidth = 220.0;
46+
public double TrackedFilterPaneWidth
47+
{
48+
get => _trackedFilterPaneWidth;
49+
set
50+
{
51+
if (Math.Abs(_trackedFilterPaneWidth - value) < 0.5) return;
52+
_trackedFilterPaneWidth = value;
53+
if (IsFilterPaneOpen) OnPropertyChanged(nameof(FilterPaneColumnWidth));
54+
}
55+
}
56+
57+
public double FilterPaneColumnWidth => IsFilterPaneOpen ? _trackedFilterPaneWidth : 0.0;
58+
59+
partial void OnIsFilterPaneOpenChanged(bool value) =>
60+
OnPropertyChanged(nameof(FilterPaneColumnWidth));
61+
4362
[ObservableProperty]
4463
private SearchMode _searchMode = SearchMode.Both;
4564

@@ -84,14 +103,32 @@ public bool HasHiddenPackages
84103
&& MatchesQuery(p.Entry, query));
85104
}
86105
}
87-
public string PackageCountText => CoreTools.Translate("{0} packages found", Packages.Count);
88106
public string EmptyMessage => CoreTools.Translate(_allPackages.Count > 0
89107
? "No packages are available with the current filters."
90108
: "This catalog contains no packages.");
91109

92110
public bool IsEmpty => !IsLoading && !HasError && Packages.Count == 0;
93111

94-
partial void OnIsLoadingChanged(bool value) => OnPropertyChanged(nameof(IsEmpty));
112+
public string BackgroundText => HasError
113+
? ErrorMessage
114+
: !IsEmpty ? ""
115+
: HasHiddenPackages
116+
? CoreTools.Translate("Packages with unavailable sources are hidden. Change Filters to show them.")
117+
: EmptyMessage;
118+
119+
public bool HasBackgroundText => BackgroundText.Length > 0;
120+
121+
partial void OnIsLoadingChanged(bool value)
122+
{
123+
OnPropertyChanged(nameof(IsEmpty));
124+
NotifyBackgroundTextChanged();
125+
}
126+
127+
private void NotifyBackgroundTextChanged()
128+
{
129+
OnPropertyChanged(nameof(BackgroundText));
130+
OnPropertyChanged(nameof(HasBackgroundText));
131+
}
95132

96133
partial void OnSelectedCatalogChanged(CatalogDefinition? value)
97134
{
@@ -110,6 +147,7 @@ partial void OnSelectedCatalogChanged(CatalogDefinition? value)
110147
}
111148
UpdateStates();
112149
OnPropertyChanged(nameof(IsEmpty));
150+
NotifyBackgroundTextChanged();
113151
}
114152

115153
[ObservableProperty]
@@ -124,6 +162,7 @@ partial void OnErrorMessageChanged(string value)
124162
{
125163
OnPropertyChanged(nameof(HasError));
126164
OnPropertyChanged(nameof(IsEmpty));
165+
NotifyBackgroundTextChanged();
127166
if (value.Length > 0)
128167
Avalonia.Infrastructure.AccessibilityAnnouncementService.Announce(
129168
value, global::Avalonia.Automation.AutomationLiveSetting.Assertive);
@@ -333,7 +372,7 @@ internal void ApplyAvailabilityFilter()
333372
OnPropertyChanged(nameof(HasHiddenPackages));
334373
OnPropertyChanged(nameof(EmptyMessage));
335374
OnPropertyChanged(nameof(IsEmpty));
336-
OnPropertyChanged(nameof(PackageCountText));
375+
NotifyBackgroundTextChanged();
337376
}
338377

339378
private bool MatchesQuery(CatalogEntry entry, string query) => query.Length == 0 || SearchMode switch

‎src/UniGetUI.Avalonia/Views/SoftwarePages/AbstractPackagesPage.axaml‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -149,38 +149,6 @@
149149
<Setter Property="Background" Value="{DynamicResource SearchBoxFocusedBackground}"/>
150150
<Setter Property="BorderBrush" Value="{DynamicResource SearchBoxFocusedBorderBrush}"/>
151151
</Style>
152-
<!-- The full splitter track is interactive. Its subtle rounded hover surface sits beneath
153-
the persistent grip, matching WinUI's pane-resize affordance. -->
154-
<Style Selector="GridSplitter.winui-vertical-splitter">
155-
<Setter Property="Background" Value="Transparent"/>
156-
<Setter Property="Transitions">
157-
<Transitions>
158-
<BrushTransition Property="Background" Duration="0:0:0.083"/>
159-
</Transitions>
160-
</Setter>
161-
<Setter Property="Template">
162-
<ControlTemplate>
163-
<!-- Match the visible splitter track to the package-list container on the
164-
right, whose outer card is inset 6 DIPs vertically. -->
165-
<Border Background="{TemplateBinding Background}"
166-
Margin="0,6"
167-
CornerRadius="6">
168-
<Border Width="4" Height="22"
169-
CornerRadius="2"
170-
HorizontalAlignment="Center"
171-
VerticalAlignment="Center"
172-
Background="{DynamicResource TextFillColorTertiaryBrush}"
173-
IsHitTestVisible="False"/>
174-
</Border>
175-
</ControlTemplate>
176-
</Setter>
177-
</Style>
178-
<Style Selector="GridSplitter.winui-vertical-splitter:pointerover">
179-
<Setter Property="Background" Value="{DynamicResource SubtleFillColorSecondaryBrush}"/>
180-
</Style>
181-
<Style Selector="GridSplitter.winui-vertical-splitter:pressed">
182-
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTertiaryBrush}"/>
183-
</Style>
184152
</UserControl.Styles>
185153

186154
<UserControl.Resources>

0 commit comments

Comments
 (0)