feat: add sorting options to plugins page#74
feat: add sorting options to plugins page#74DavidGBrett wants to merge 6 commits intoFlow-Launcher:masterfrom
Conversation
- Reduce row gap to match padding - Reduce column gap to match plugin grid gap
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/pages/plugins/index.astro (1)
170-191: Consider omitting the default sort from the query string.Right now
/pluginsrewrites itself to/plugins?sort=name-ascon first load even before the user changes anything. Deleting the param when the selection is the default keeps the clean route canonical.♻️ Suggested cleanup
- url.searchParams.set("sort", sortValue); + if (sortValue === DEFAULT_PLUGIN_SORT) { + url.searchParams.delete("sort"); + } else { + url.searchParams.set("sort", sortValue); + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/plugins/index.astro` around lines 170 - 191, The updateUrlParams function currently always writes the sort query param; change it to omit the sort param when the current selection is the default so the canonical URL stays clean. In updateUrlParams (using sortSelect and sortValue) compare sortValue against the default sort (use sortSelect.defaultValue or the literal "name-asc" if that's the default) and only call url.searchParams.set("sort", sortValue) when it differs; otherwise call url.searchParams.delete("sort") before calling history.replaceState.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/pages/plugins/index.astro`:
- Around line 170-191: The updateUrlParams function currently always writes the
sort query param; change it to omit the sort param when the current selection is
the default so the canonical URL stays clean. In updateUrlParams (using
sortSelect and sortValue) compare sortValue against the default sort (use
sortSelect.defaultValue or the literal "name-asc" if that's the default) and
only call url.searchParams.set("sort", sortValue) when it differs; otherwise
call url.searchParams.delete("sort") before calling history.replaceState.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0c2df1c0-a2b0-4acb-b8f8-08148622a91b
📒 Files selected for processing (2)
src/pages/plugins/index.astrosrc/pages/plugins/pluginSortOptions.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/pages/plugins/index.astro (1)
188-192: Use strict equality and consistent spacing.Minor style inconsistencies: the comparison uses
!=instead of!==(unlike line 56 which uses===), and spacing around braces is inconsistent with the rest of the file.✨ Suggested fix for consistency
- if (sortValue != DEFAULT_PLUGIN_SORT){ + if (sortValue !== DEFAULT_PLUGIN_SORT) { url.searchParams.set("sort", sortValue); - } else{ + } else { url.searchParams.delete("sort"); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/plugins/index.astro` around lines 188 - 192, The comparison should use strict equality and brace spacing must match the file style: change the condition to compare with !== (use sortValue !== DEFAULT_PLUGIN_SORT) and adjust the else block spacing to `} else {` so the branches call url.searchParams.set("sort", sortValue) and url.searchParams.delete("sort") respectively; update the snippet around sortValue, DEFAULT_PLUGIN_SORT, and url.searchParams.set/delete for consistent formatting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/pages/plugins/index.astro`:
- Around line 188-192: The comparison should use strict equality and brace
spacing must match the file style: change the condition to compare with !== (use
sortValue !== DEFAULT_PLUGIN_SORT) and adjust the else block spacing to `} else
{` so the branches call url.searchParams.set("sort", sortValue) and
url.searchParams.delete("sort") respectively; update the snippet around
sortValue, DEFAULT_PLUGIN_SORT, and url.searchParams.set/delete for consistent
formatting.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d3a0643c-92bd-4761-b397-ad04ca388a5b
📒 Files selected for processing (1)
src/pages/plugins/index.astro
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/pages/plugins/index.astro (2)
188-192: Prefer strict equality for consistency.Same style issue as line 156: use
!==instead of!=for string comparison.✨ Suggested fix
- if (sortValue != DEFAULT_PLUGIN_SORT){ + if (sortValue !== DEFAULT_PLUGIN_SORT) { url.searchParams.set("sort", sortValue); - } else{ + } else { url.searchParams.delete("sort"); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/plugins/index.astro` around lines 188 - 192, The condition comparing sortValue to DEFAULT_PLUGIN_SORT uses loose equality; update the if statement that checks "if (sortValue != DEFAULT_PLUGIN_SORT)" to use strict inequality (===/!==), i.e., change to "!==", so the comparison in the block handling url.searchParams.set/delete uses strict equality between sortValue and DEFAULT_PLUGIN_SORT.
156-156: Use strict equality and consistent formatting.This line has inconsistent formatting and uses loose equality. For string comparisons, strict equality (
!==) is preferred.✨ Suggested formatting fix
-if(sortParam != DEFAULT_PLUGIN_SORT){applySort();} +if (sortParam !== DEFAULT_PLUGIN_SORT) { + applySort(); +}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/plugins/index.astro` at line 156, Replace the loose inequality and cramped formatting in the conditional that checks sortParam by using strict inequality and consistent spacing; update the expression comparing sortParam to DEFAULT_PLUGIN_SORT to use !== and add spaces and braces for readability, ensuring the block calling applySort() (referenced by sortParam, DEFAULT_PLUGIN_SORT, applySort) follows the project's formatting style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/pages/plugins/index.astro`:
- Around line 188-192: The condition comparing sortValue to DEFAULT_PLUGIN_SORT
uses loose equality; update the if statement that checks "if (sortValue !=
DEFAULT_PLUGIN_SORT)" to use strict inequality (===/!==), i.e., change to "!==",
so the comparison in the block handling url.searchParams.set/delete uses strict
equality between sortValue and DEFAULT_PLUGIN_SORT.
- Line 156: Replace the loose inequality and cramped formatting in the
conditional that checks sortParam by using strict inequality and consistent
spacing; update the expression comparing sortParam to DEFAULT_PLUGIN_SORT to use
!== and add spaces and braces for readability, ensuring the block calling
applySort() (referenced by sortParam, DEFAULT_PLUGIN_SORT, applySort) follows
the project's formatting style.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c7b93f97-bdc6-4e93-8bab-729ad0f4d95f
📒 Files selected for processing (1)
src/pages/plugins/index.astro
f8bad3a to
d1c7a68
Compare
Add sorting dropdown to plugin page, with the following options:
defined in pluginSortOptions.ts
Modified index.astro to add the dropdown and the clientside sorting functionality to match the existing filtering functionality
Related to this request:
https://www.reddit.com/r/FlowLauncher/comments/1s8gcrm/plugin_sort_by_date_created_or_updated/
UI Change