From d3021946389fa4e0f7bca663e93075ddf10cd13c Mon Sep 17 00:00:00 2001 From: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> Date: Mon, 14 Jul 2025 12:14:51 -0400 Subject: [PATCH] fix: sort lw15 meetups by city name (#37113) --- .../components/LaunchWeek/15/LW15Meetups.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/www/components/LaunchWeek/15/LW15Meetups.tsx b/apps/www/components/LaunchWeek/15/LW15Meetups.tsx index e9b09d30349..c01dfbd66a4 100644 --- a/apps/www/components/LaunchWeek/15/LW15Meetups.tsx +++ b/apps/www/components/LaunchWeek/15/LW15Meetups.tsx @@ -91,10 +91,9 @@ const LW15Meetups = ({ className, meetups = [] }: PropsWithChildren) => { setShowOverlay(false) } - // Keep this for OG image generation - const meetupsFilteredByUniqueCountries = meetups - .filter((meetup, index, self) => index === self.findIndex((t) => t.country === meetup.country)) - .sort((a, b) => a.country.localeCompare(b.country)) + const meetupsSortedByCity = meetups.sort((a, b) => + getMeetupCity(a).localeCompare(getMeetupCity(b)) + ) return ( <> @@ -127,8 +126,8 @@ const LW15Meetups = ({ className, meetups = [] }: PropsWithChildren) => { activeMeetup && 'text-foreground-muted' )} > - {meetups && - meetups?.map((meetup: LumaEvent, i: number) => { + {meetupsSortedByCity && + meetupsSortedByCity?.map((meetup: LumaEvent, i: number) => { const startAt = new Date(meetup.start_at) const endAt = addHours(new Date(meetup.start_at), 3) const after = now > startAt @@ -160,7 +159,7 @@ const LW15Meetups = ({ className, meetups = [] }: PropsWithChildren) => { {i !== meetups.length - 1 && ( / @@ -283,8 +282,8 @@ const getMeetupCity = (meetup: LumaEvent) => { if (!meetup) return '' return ( meetup.city ?? - meetup.name.split(',')[0].split('-')[1] ?? - meetup.name.split(',')[0].split(' ')[1] ?? + meetup.name.split(',')[0].split('-')[1].trim() ?? + meetup.name.split(',')[0].split(' ')[1].trim() ?? meetup.name ) }