[Feature] Add sorting modes to the plugin store#4398
[Feature] Add sorting modes to the plugin store#4398DavidGBrett wants to merge 2 commits intoFlow-Launcher:devfrom
Conversation
- Added new row in header - Added dropdown menu to that new row - Added localized options: "Name", "Release Date," "Updated Date" as well as a localized label "Sorting Mode:" No functionality added, only ui changes.
- Add GetSortedPlugins to handle different sorts based on the SelectedSortMode - Show only "None"/"Plugins" & "Installed" categories for sort modes other than default
|
🥷 Code experts: Jack251970 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
|
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 WalkthroughWalkthroughThis PR implements a sorting feature for the Plugin Store, enabling users to sort plugins by name, release date, updated date, or the default categorization. Changes include new localization entries, a sort mode enum with dropdown UI binding, refactored category properties on plugin items, and dynamic grouping logic that adjusts based on the selected sort mode. Changes
Sequence DiagramsequenceDiagram
participant User
participant UI as ComboBox (Sort Mode)
participant VM as SettingsPanePluginStoreViewModel
participant CodeBehind as SettingsPanePluginStore.xaml.cs
participant CVS as CollectionViewSource
participant Items as PluginStoreItemViewModel List
User->>UI: Select sort mode
UI->>VM: SelectedSortMode = new value
VM->>VM: Raise PropertyChanged("SelectedSortMode")<br/>Raise PropertyChanged("ExternalPlugins")
CodeBehind->>CodeBehind: ViewModel_PropertyChanged triggered
CodeBehind->>CodeBehind: UpdateCategoryGrouping()
CodeBehind->>CVS: Clear GroupDescriptions
alt SelectedSortMode == Default
CodeBehind->>CVS: Group by DefaultCategory
else SelectedSortMode != Default
CodeBehind->>CVS: Group by InstallCategory
end
VM->>Items: GetSortedPlugins(SelectedSortMode)
Items->>Items: Sort by Name/ReleaseDate/UpdatedDate<br/>or by DefaultCategory
CodeBehind->>CVS: Refresh collection view
CVS->>UI: Update displayed items
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs (1)
44-64:⚠️ Potential issue | 🟠 MajorPotential null reference issue with nullable DateTime arithmetic.
_newPlugin.LatestReleaseDateand_newPlugin.DateAddedareDateTime?(perUserPlugin.cslines 68-73). Subtracting a nullableDateTime?fromDateTime.Nowwithout null checks can cause runtime exceptions or undefined behavior when these values are null.🛠️ Proposed fix with null checks
public string DefaultCategory { get { string category = None; - if (DateTime.Now - _newPlugin.LatestReleaseDate < TimeSpan.FromDays(7)) + if (_newPlugin.LatestReleaseDate.HasValue && + DateTime.Now - _newPlugin.LatestReleaseDate.Value < TimeSpan.FromDays(7)) { category = RecentlyUpdated; } - if (DateTime.Now - _newPlugin.DateAdded < TimeSpan.FromDays(7)) + if (_newPlugin.DateAdded.HasValue && + DateTime.Now - _newPlugin.DateAdded.Value < TimeSpan.FromDays(7)) { category = NewRelease; } if (_oldPluginPair != null) { category = Installed; } return category; } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs` around lines 44 - 64, The DefaultCategory getter performs DateTime.Now - _newPlugin.LatestReleaseDate and DateTime.Now - _newPlugin.DateAdded where those fields are nullable (DateTime?); guard these uses by checking _newPlugin.LatestReleaseDate.HasValue and _newPlugin.DateAdded.HasValue (or using GetValueOrDefault with an existence check) before doing the subtraction, and only assign RecentlyUpdated/NewRelease when the corresponding nullable has a value; keep the existing logic around _oldPluginPair and the returned category intact.
🧹 Nitpick comments (1)
Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs (1)
88-105: Minor formatting inconsistency.Line 102:
else{is missing a space before the brace.🔧 Suggested fix
// Otherwise we only split by installed or not - else{ + else + { groupDescriptions.Add(new PropertyGroupDescription(nameof(PluginStoreItemViewModel.InstallCategory))); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs` around lines 88 - 105, The method UpdateCategoryGrouping has a formatting inconsistency: change the `else{` to `else {` to match project style; update the else block in UpdateCategoryGrouping (which currently adds a PropertyGroupDescription for PluginStoreItemViewModel.InstallCategory when _viewModel.SelectedSortMode is not PluginStoreSortMode.Default) so the brace spacing is corrected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs`:
- Around line 44-64: The DefaultCategory getter performs DateTime.Now -
_newPlugin.LatestReleaseDate and DateTime.Now - _newPlugin.DateAdded where those
fields are nullable (DateTime?); guard these uses by checking
_newPlugin.LatestReleaseDate.HasValue and _newPlugin.DateAdded.HasValue (or
using GetValueOrDefault with an existence check) before doing the subtraction,
and only assign RecentlyUpdated/NewRelease when the corresponding nullable has a
value; keep the existing logic around _oldPluginPair and the returned category
intact.
---
Nitpick comments:
In `@Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs`:
- Around line 88-105: The method UpdateCategoryGrouping has a formatting
inconsistency: change the `else{` to `else {` to match project style; update the
else block in UpdateCategoryGrouping (which currently adds a
PropertyGroupDescription for PluginStoreItemViewModel.InstallCategory when
_viewModel.SelectedSortMode is not PluginStoreSortMode.Default) so the brace
spacing is corrected.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 64000be2-df6c-4096-9f7e-77ba3461f3b4
📒 Files selected for processing (5)
Flow.Launcher/Languages/en.xamlFlow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.csFlow.Launcher/SettingPages/Views/SettingsPanePluginStore.xamlFlow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.csFlow.Launcher/ViewModel/PluginStoreItemViewModel.cs
This is unrelated to my change, this is an issue in the existing code. |
Summary
Add dropdown with sorting modes to the plugin store panel of the settings window.
Added the following modes:
Default matches the current way it lists plugins, included the recently added / recently updated categories.
The other modes hide those categories as they no longer make sense / are needed, leaving only "Plugins" and "Installed".
Related to this request:
https://www.reddit.com/r/FlowLauncher/comments/1s8gcrm/plugin_sort_by_date_created_or_updated/
Closes #2845
UI
Summary by cubic
Adds sorting to the Plugin Store (Default, Name, Release Date, Updated Date) with a new dropdown. Non‑default sorts group plugins into only “Installed” and “Plugins”.
Summary of changes
Written for commit c6da34b. Summary will update on new commits.