mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-11 18:41:18 +10:00
Turn the Install category filters into toggle chips (#4926)
* Turn the Install category filters into toggle chips - Replace the filter buttons with toggles that show which ones are active - Add ctrl click to select more than one category - Keep the search box and the category filter independent of each other - Expand matching categories while a filter is active * Fix the filter interactions the category chips missed - Pass the selected categories to the lazy rendering batches, the old call used a parameter that no longer exists and threw while typing - Keep the category filter when switching tabs, the chips stayed checked while the filter itself was dropped - Put a category back to collapsed once the filter that expanded it is gone * Document the Install category filters - Add a guide section for the chips, ctrl click and clearing the filter - Note that search and the category chips apply together * Correct the category filter guide wording - Clearing by clicking the chip only applies when it is the only one selected - Only categories with matches expand, and only auto expanded ones re-collapse
This commit is contained in:
+32
-22
@@ -329,7 +329,7 @@ $searchBarTimer.add_Tick({
|
||||
$searchBarTimer.Stop()
|
||||
switch ($sync.currentTab) {
|
||||
"Install" {
|
||||
Find-AppsByNameOrDescription -SearchString $sync.SearchBar.Text -Category $sync.SearchBar.Tag
|
||||
Find-AppsByNameOrDescription -SearchString $sync.SearchBar.Text -Categories $sync.SelectedAppCategories.ToArray()
|
||||
}
|
||||
"Tweaks" {
|
||||
Find-TweaksByNameOrDescription -SearchString $sync.SearchBar.Text
|
||||
@@ -340,10 +340,6 @@ $searchBarTimer.add_Tick({
|
||||
}
|
||||
})
|
||||
$sync["SearchBar"].Add_TextChanged({
|
||||
if ($sync.SearchBar.Tag -ne $sync.SearchBar.Text) {
|
||||
$sync.SearchBar.Tag = $null
|
||||
}
|
||||
|
||||
if ($sync.SearchBar.Text -ne "") {
|
||||
$sync.SearchBarClearButton.Visibility = "Visible"
|
||||
$sync.SearchBarIcon.Visibility = "Collapsed"
|
||||
@@ -352,29 +348,43 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
$sync.SearchBarIcon.Visibility = "Visible"
|
||||
}
|
||||
|
||||
# Category chip handlers apply their filter immediately.
|
||||
if ($sync.SearchBar.Tag -eq $sync.SearchBar.Text) {
|
||||
return
|
||||
}
|
||||
|
||||
if ($searchBarTimer.IsEnabled) {
|
||||
$searchBarTimer.Stop()
|
||||
}
|
||||
$searchBarTimer.Start()
|
||||
})
|
||||
|
||||
# Quick Category Search Chips
|
||||
$sync["WPFSearchChipAll"].Add_Click({ Set-WinUtilAppCategoryFilter })
|
||||
$sync["WPFSearchChipBrowsers"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Browsers" })
|
||||
$sync["WPFSearchChipCommunications"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Communications" })
|
||||
$sync["WPFSearchChipDevelopment"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Development" })
|
||||
$sync["WPFSearchChipDocument"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Document" })
|
||||
$sync["WPFSearchChipGames"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Games" })
|
||||
$sync["WPFSearchChipMicrosoftTools"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Microsoft Tools" })
|
||||
$sync["WPFSearchChipMultimediaTools"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Multimedia Tools" })
|
||||
$sync["WPFSearchChipProTools"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Pro Tools" })
|
||||
$sync["WPFSearchChipSelfhostedTools"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Selfhosted Tools" })
|
||||
$sync["WPFSearchChipUtilities"].Add_Click({ Set-WinUtilAppCategoryFilter -Category "Utilities" })
|
||||
# Category filter chips. The chip carries its category in Tag, so one handler covers all of them.
|
||||
$sync.AppCategoryChips = @(
|
||||
@{ Name = "WPFSearchChipAll"; Category = "" }
|
||||
@{ Name = "WPFSearchChipBrowsers"; Category = "Browsers" }
|
||||
@{ Name = "WPFSearchChipCommunications"; Category = "Communications" }
|
||||
@{ Name = "WPFSearchChipDevelopment"; Category = "Development" }
|
||||
@{ Name = "WPFSearchChipDocument"; Category = "Document" }
|
||||
@{ Name = "WPFSearchChipGames"; Category = "Games" }
|
||||
@{ Name = "WPFSearchChipMicrosoftTools"; Category = "Microsoft Tools" }
|
||||
@{ Name = "WPFSearchChipMultimediaTools"; Category = "Multimedia Tools" }
|
||||
@{ Name = "WPFSearchChipProTools"; Category = "Pro Tools" }
|
||||
@{ Name = "WPFSearchChipSelfhostedTools"; Category = "Selfhosted Tools" }
|
||||
@{ Name = "WPFSearchChipUtilities"; Category = "Utilities" }
|
||||
)
|
||||
$sync.SelectedAppCategories = [System.Collections.Generic.List[string]]::new()
|
||||
|
||||
foreach ($appCategoryChip in $sync.AppCategoryChips) {
|
||||
$sync[$appCategoryChip.Name].Tag = $appCategoryChip.Category
|
||||
}
|
||||
|
||||
$sync["WPFSearchChipAll"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipBrowsers"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipCommunications"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipDevelopment"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipDocument"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipGames"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipMicrosoftTools"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipMultimediaTools"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipProTools"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipSelfhostedTools"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
$sync["WPFSearchChipUtilities"].Add_Click({ Invoke-WinUtilAppCategoryChip -Chip $this })
|
||||
|
||||
$sync["Form"].Add_Loaded({
|
||||
param($e)
|
||||
|
||||
Reference in New Issue
Block a user