@@ -2,16 +2,26 @@ import Image from "next/image";
22import { coChairs , otherPeople } from "@/lib/config/about/iiasa-members" ;
33
44export const MembersPictureModule = ( ) => {
5- const getLastName = ( name : string ) => name . split ( " " ) . at ( - 1 ) ?? name ;
5+ const getLastName = ( name : string ) => {
6+ const parts = name . split ( " " ) ;
7+ // Handle prefixed surnames like "van Vuuren", "van Ruijven"
8+ const prefixes = [ "van" , "de" , "von" , "den" , "der" ] ;
9+ const prefixIndex = parts . findIndex ( ( p ) => prefixes . includes ( p . toLowerCase ( ) ) ) ;
10+ if ( prefixIndex > 0 ) {
11+ return parts . slice ( prefixIndex ) . join ( " " ) ;
12+ }
13+ return parts . at ( - 1 ) ?? name ;
14+ } ;
615
7- const sortedOthers = [ ...otherPeople ] . sort ( ( a , b ) => {
8- const aIsLead = ! ! a . role ;
9- const bIsLead = ! ! b . role ;
10- if ( aIsLead !== bIsLead ) return aIsLead ? - 1 : 1 ;
11- return getLastName ( a . name ) . localeCompare ( getLastName ( b . name ) ) ;
12- } ) ;
16+ const leads = [ ...otherPeople ]
17+ . filter ( ( m ) => ! ! m . role )
18+ . sort ( ( a , b ) => getLastName ( a . name ) . localeCompare ( getLastName ( b . name ) ) ) ;
1319
14- const members = [ ...coChairs , ...sortedOthers ] ;
20+ const nonLeads = [ ...otherPeople ]
21+ . filter ( ( m ) => ! m . role )
22+ . sort ( ( a , b ) => getLastName ( a . name ) . localeCompare ( getLastName ( b . name ) ) ) ;
23+
24+ const members = [ ...coChairs , ...leads , ...nonLeads ] ;
1525
1626 return (
1727 < div className = "content-container grid w-full grid-cols-2 flex-col gap-x-6 gap-y-10 sm:grid-cols-3 md:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6" >
0 commit comments