Skip to content

Commit

Permalink
feat: sort pipes by downloads count and creation date (#1462)
Browse files Browse the repository at this point in the history
  • Loading branch information
m13v authored Feb 22, 2025
1 parent 2670314 commit 15788e2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions screenpipe-app-tauri/components/pipe-store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,18 @@ export const PipeStore: React.FC = () => {
(pipe) =>
pipe.id.toLowerCase().includes(searchQuery.toLowerCase()) &&
(!showInstalledOnly || pipe.is_installed) &&
!pipe.is_installing
!pipe.is_installing,
)
.sort((a, b) => Number(b.is_paid) - Number(a.is_paid));
.sort((a, b) => {
// Sort by downloads count first
const downloadsA = a.plugin_analytics?.downloads_count || 0;
const downloadsB = b.plugin_analytics?.downloads_count || 0;
if (downloadsB !== downloadsA) {
return downloadsB - downloadsA;
}
// Then by creation date
return new Date(b.created_at).getTime() - new Date(a.created_at).getTime();
});

// Add debounced search tracking
useEffect(() => {
Expand Down

0 comments on commit 15788e2

Please sign in to comment.