Skip to content

Commit

Permalink
feat(jobs): Sort team members in the correct order when the interface…
Browse files Browse the repository at this point in the history
… language is Hebrew
  • Loading branch information
relyks committed Nov 1, 2023
1 parent 08ceea5 commit 3e92cfc
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions static/js/StaticPages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2640,10 +2640,13 @@ const ConditionalLink = ({ link, children }) =>
* Team Page
*/

const byLastName = (a, b) => {
const lastNameA = a.teamMemberDetails.teamName.en.split(" ").pop();
const lastNameB = b.teamMemberDetails.teamName.en.split(" ").pop();
return lastNameA.localeCompare(lastNameB);
const byLastName = () => {
const locale = Sefaria.interfaceLang === "hebrew" ? "he" : "en";
return (a, b) => {
const lastNameA = a.teamMemberDetails.teamName[locale].split(" ").pop();
const lastNameB = b.teamMemberDetails.teamName[locale].split(" ").pop();
return lastNameA.localeCompare(lastNameB, locale);
};
};

const partition = (arr, prop) =>
Expand Down Expand Up @@ -2741,7 +2744,7 @@ const BoardMembers = ({ boardMembers }) => {
{cofounderBoardMembers.map((boardMember) => (
<BoardMember key={boardMember.id} boardMember={boardMember} />
))}
{regularBoardMembers.sort(byLastName).map((boardMember) => (
{regularBoardMembers.sort(byLastName()).map((boardMember) => (
<BoardMember key={boardMember.id} boardMember={boardMember} />
))}
</>
Expand Down Expand Up @@ -2869,7 +2872,7 @@ const TeamMembersPage = memo(() => {
<>
<section className="main-text team-members">
<TeamMembers
teamMembers={ordinaryTeamMembers.sort(byLastName)}
teamMembers={ordinaryTeamMembers.sort(byLastName())}
/>
<Placeholders
teamMembersCount={ordinaryTeamMembers.length}
Expand Down

0 comments on commit 3e92cfc

Please sign in to comment.