Skip to content

Commit

Permalink
order integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed Feb 5, 2025
1 parent 0196614 commit 1166cf4
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ export async function IntegrationsCards({
{} as Record<string, IntegrationsWithInstallations>,
);

// Sort integrations within each category
Object.keys(groupedIntegrations).forEach((category) => {
groupedIntegrations[category].sort((a, b) => {
// Put "coming soon" integrations at the end
if (a.comingSoon && !b.comingSoon) return 1;
if (!a.comingSoon && b.comingSoon) return -1;
// Sort by installation count in descending order
return (b._count.installations || 0) - (a._count.installations || 0);
});
});

const categories = Object.keys(groupedIntegrations).sort(
(a, b) =>
CATEGORY_ORDER.indexOf(a as any) - CATEGORY_ORDER.indexOf(b as any),
Expand Down

0 comments on commit 1166cf4

Please sign in to comment.