From ecde9f867f76993df27886f42bea4eb19d89a80a Mon Sep 17 00:00:00 2001 From: Francesco Sansalvadore Date: Fri, 11 Jul 2025 18:31:14 +0200 Subject: [PATCH] cleanup --- .../components/LaunchWeek/15/LW15Meetups.tsx | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/apps/www/components/LaunchWeek/15/LW15Meetups.tsx b/apps/www/components/LaunchWeek/15/LW15Meetups.tsx index d7fedc643ac..706dbde601f 100644 --- a/apps/www/components/LaunchWeek/15/LW15Meetups.tsx +++ b/apps/www/components/LaunchWeek/15/LW15Meetups.tsx @@ -58,15 +58,6 @@ const LW15Meetups = ({ className, meetups = [] }: PropsWithChildren) => { }, } - const getMeetupCity = (meetup: LumaEvent) => { - return ( - meetup.city ?? - meetup.name.split(',')[0].split('-')[1] ?? - meetup.name.split(',')[0].split(' ')[1] ?? - meetup.name - ) - } - const handleMouseMove = useCallback((e: MouseEvent) => { // Global mouse position for overlay setGlobalMousePosition({ @@ -100,6 +91,11 @@ 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)) + return ( <> ) => { ) } +const handleCountry = (country: string) => { + if (country === 'United States') return 'USA' + if (country === 'United Kingdom') return 'UK' + if (country === 'United Arab Emirates') return 'UAE' + if (country === 'Democratic Republic of the Congo') return 'Congo' + return country +} + const MeetupOverlayCard = ({ meetup, mousePosition, visible }: MeetupOverlayCardProps) => { const show = !(!meetup || !visible) - const handleCountry = (country: string) => { - if (country === 'United States') return 'USA' - if (country === 'United Kingdom') return 'UK' - if (country === 'United Arab Emirates') return 'UAE' - if (country === 'Democratic Republic of the Congo') return 'DR. of Congo' - return country - } - // Calculate if overlay should appear to the left of cursor - const overlayWidth = 320 // max-w-xs is approximately 320px + const overlayWidth = 320 const distanceToRightEdge = typeof window !== 'undefined' ? window.innerWidth - mousePosition.x : 1000 const shouldPositionLeft = distanceToRightEdge < overlayWidth @@ -274,7 +270,7 @@ const MeetupOverlayCard = ({ meetup, mousePosition, visible }: MeetupOverlayCard
Meetup
- {meetup?.city}, {handleCountry(meetup?.country ?? '')} + {getMeetupCity(meetup!)}, {getMeetupCountry(meetup!)}
@@ -289,4 +285,15 @@ function addHours(start_at: Date, hours: number) { return dateCopy } +const getMeetupCity = (meetup: LumaEvent) => { + if (!meetup) return '' + return ( + meetup.city ?? + meetup.name.split(',')[0].split('-')[1] ?? + meetup.name.split(',')[0].split(' ')[1] ?? + meetup.name + ) +} +const getMeetupCountry = (meetup: LumaEvent) => handleCountry(meetup?.country ?? '') + export default LW15Meetups