Redesign and update 'Meet the Team' data #452

Merged
j285he merged 17 commits from j285he-meet-the-team-s22 into main 2022-06-17 19:53:16 -04:00
1 changed files with 15 additions and 16 deletions
Showing only changes of commit ddf6ac4b9b - Show all commits

View File

@ -207,23 +207,22 @@ async function getTeamWithImages(team: TeamMember[]) {
);
}
function memberComparer(a: Metadata, b: Metadata) {
return a.name.localeCompare(b.name);
}
function sortTeam(team: Metadata[]): Metadata[] {
const teamLeads: Metadata[] = [];
const teamMembers: Metadata[] = [];
const teamOthers: Metadata[] = [];
for (const member of team) {
if (!Object.prototype.hasOwnProperty.call(member, "role")) {
teamMembers.push(member);
} else if (member.role === "Team Lead") {
teamLeads.push(member);
} else {
teamOthers.push(member);
}
}
teamLeads.sort((a, b) => a.name.localeCompare(b.name));
teamMembers.sort((a, b) => a.name.localeCompare(b.name));
teamOthers.sort((a, b) => a.name.localeCompare(b.name));
return [...teamLeads, ...teamMembers, ...teamOthers];
const leads = team
.filter(({ role }) => role === "Team Lead")
.sort(memberComparer);
const general = team
.filter(({ role }) => role == null || role === "")
j285he marked this conversation as resolved
Review

Would role == null || role === "" be equivalent to !role here? (and also a couple lines below)

Would `role == null || role === ""` be equivalent to `!role` here? (and also a couple lines below)
.sort(memberComparer);
const others = team
.filter(({ role }) => role != null && role !== "" && role !== "Team Lead")
.sort(memberComparer);
return [...leads, ...general, ...others];
}
export const getStaticProps: GetStaticProps<Props> = async () => {