Skip to content

Commit 8d4a16f

Browse files
committed
feat: prioritize FOSSRadar project in listings
Updated sorting logic to always show FOSSRadar first: - Modified build-index.ts to place fossradar at top of search index - Updated ProjectGrid component to prioritize fossradar in all sorting modes - Rest of projects are sorted alphabetically (or by stars/date when selected) Project order is now: 1. FOSSRadar (always first) 2. PrivacyHub 3. RDAP Lookup 4. Ubuntu Security Hardening 5. Wazuh MCP Server
1 parent 6ab4de6 commit 8d4a16f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

components/ProjectGrid.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ export function ProjectGrid({ initialProjects }: ProjectGridProps) {
8787

8888
// Apply sorting
8989
results.sort((a, b) => {
90+
// Always show fossradar first
91+
if (a.slug === "fossradar") return -1;
92+
if (b.slug === "fossradar") return 1;
93+
9094
switch (filters.sortBy) {
9195
case "stars":
9296
return (b.stars || 0) - (a.stars || 0);

scripts/build-index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ async function buildIndex() {
2727
location_indian_state: project.location_indian_state,
2828
}));
2929

30-
// Sort by name for deterministic output
31-
index.sort((a, b) => a.name.localeCompare(b.name));
30+
// Sort: fossradar first, then alphabetically by name
31+
index.sort((a, b) => {
32+
if (a.slug === "fossradar") return -1;
33+
if (b.slug === "fossradar") return 1;
34+
return a.name.localeCompare(b.name);
35+
});
3236

3337
// Write to public directory
3438
const outputPath = path.join(process.cwd(), "public", "index.json");

0 commit comments

Comments
 (0)