Skip to content

Commit

Permalink
Match sorting on the changelog page to the cc members page
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavberi committed Nov 9, 2024
1 parent 030b6d2 commit 8917a35
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/app/changelog/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ export default async function Changelog({ searchParams }) {
})
?.filter((member) => {
return member.roles.length > 0;
})
?.sort((a, b) => {
const roleNameA = a.roles[0]?.name.toLowerCase();
const roleNameB = b.roles[0]?.name.toLowerCase();
if (roleNameA.includes("lead") && !roleNameB.includes("lead")) {
return -1;
}
if (roleNameB.includes("lead") && !roleNameA.includes("lead")) {
return 1;
}
if (roleNameA.includes("advisor") && !roleNameB.includes("advisor")) {
return 1;
}
if (roleNameB.includes("advisor") && !roleNameA.includes("advisor")) {
return -1;
}

return 0;
});

const status = await fetch(getNginxFile("json/status.json"), {
Expand Down Expand Up @@ -140,7 +158,7 @@ const filterRoles = (roles, filterWords) => {
const { name, endYear } = role;
const lowercaseName = name.toLowerCase();
return filterWords.some(
(word) => lowercaseName.includes(word) && endYear === null,
(word) => lowercaseName.includes(word) && endYear === null
);
});
if (filteredRoles?.length > 0)
Expand Down

0 comments on commit 8917a35

Please sign in to comment.