Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix events page (#47089)

Prashant Sridharan4dd3a0aacfee
diff --git a/apps/www/app/api-v2/luma-events/route.tsx b/apps/www/app/api-v2/luma-events/route.tsx
index 6104bebc476..54fedfd6613 100644
--- a/apps/www/app/api-v2/luma-events/route.tsx
+++ b/apps/www/app/api-v2/luma-events/route.tsx
@@ -52,20 +52,18 @@ export interface LumaHost {
avatar_url: string
}
+export interface LumaTag {
+ api_id?: string
+ name: string
+}
+
interface LumaResponse {
- entries: { event: LumaPayloadEvent }[]
+ entries: { event: LumaPayloadEvent; tags?: (string | LumaTag)[] }[]
has_more: boolean
next_cursor?: string
}
-export type LumaCalendar = 'community' | 'hackathon'
-
-async function fetchLumaCalendar(
- apiKey: string,
- calendar: LumaCalendar,
- after: string | null,
- before: string | null
-) {
+async function fetchLumaCalendar(apiKey: string, after: string | null, before: string | null) {
const lumaUrl = new URL('https://public-api.lu.ma/public/v1/calendar/list-events')
if (after) lumaUrl.searchParams.append('after', after)
if (before) lumaUrl.searchParams.append('before', before)
@@ -79,16 +77,18 @@ async function fetchLumaCalendar(
})
if (!response.ok) {
- throw new Error(`Luma API error (${calendar}): ${response.status} ${response.statusText}`)
+ throw new Error(`Luma API error: ${response.status} ${response.statusText}`)
}
const data: LumaResponse = await response.json()
return data.entries
.filter(({ event }) => event.visibility === 'public')
- .map(({ event }) => ({
+ .map(({ event, tags }) => ({
id: event.api_id,
- calendar,
+ tags: (tags ?? [])
+ .map((tag) => (typeof tag === 'string' ? tag : tag?.name))
+ .filter((name): name is string => Boolean(name)),
start_at: event.start_at,
end_at: event.end_at,
name: event.name,
@@ -104,11 +104,10 @@ async function fetchLumaCalendar(
export async function GET(request: NextRequest) {
try {
- const communityKey = process.env.LUMA_API_KEY
- const hackathonKey = process.env.LUMA_HACKATHONS_API_KEY
+ const apiKey = process.env.LUMA_API_KEY
- if (!communityKey && !hackathonKey) {
- console.error('No Luma API keys configured (LUMA_API_KEY / LUMA_HACKATHONS_API_KEY)')
+ if (!apiKey) {
+ console.error('No Luma API key configured (LUMA_API_KEY)')
return NextResponse.json({ error: 'API configuration error' }, { status: 500 })
}
@@ -116,22 +115,9 @@ export async function GET(request: NextRequest) {
const after = searchParams.get('after')
const before = searchParams.get('before')
- const calendarFetches: Array<Promise<Awaited<ReturnType<typeof fetchLumaCalendar>>>> = []
- if (communityKey)
- calendarFetches.push(fetchLumaCalendar(communityKey, 'community', after, before))
- if (hackathonKey)
- calendarFetches.push(fetchLumaCalendar(hackathonKey, 'hackathon', after, before))
-
- const results = await Promise.allSettled(calendarFetches)
-
- const events = results
- .flatMap((result) => {
- if (result.status === 'fulfilled') return result.value
- Sentry.captureException(result.reason)
- console.error(result.reason)
- return []
- })
- .sort((a, b) => new Date(a.start_at).getTime() - new Date(b.start_at).getTime())
+ const events = (await fetchLumaCalendar(apiKey, after, before)).sort(
+ (a, b) => new Date(a.start_at).getTime() - new Date(b.start_at).getTime()
+ )
return NextResponse.json({
success: true,
diff --git a/apps/www/app/events/context.tsx b/apps/www/app/events/context.tsx
index d89c1c67869..81ec9e83820 100644
--- a/apps/www/app/events/context.tsx
+++ b/apps/www/app/events/context.tsx
@@ -15,6 +15,14 @@ interface EventsContextValue {
categories: { [key: string]: number }
}
+// Maps Luma event tags to the app's category vocabulary. Keys are lowercased
+// for case-insensitive matching against the tag names returned by Luma.
+const LUMA_TAG_CATEGORY_MAP: Record<string, string> = {
+ hackathons: 'hackathon',
+ meetups: 'meetup',
+ events: 'conference',
+}
+
const EventsContext = createContext<EventsContextValue | undefined>(undefined)
interface EventsProviderProps {
@@ -49,12 +57,14 @@ export function EventsProvider({
if (data.success) {
const transformedEvents: SupabaseEvent[] = data.events.map((event: any) => {
- // Categorize by the originating Luma calendar: events from the
- // Supabase Hackathons calendar → `hackathon`; everything from the
- // Supabase Community Events calendar → `community`.
- const categories: string[] = [
- event?.calendar === 'hackathon' ? 'hackathon' : 'community',
- ]
+ // Categorize by the event's Luma tags: `Hackathons` → hackathon,
+ // `Meetups` → meetup, `Events` → conference. Untagged or unrecognized
+ // events fall back to the generic `conference` bucket.
+ const mappedCategories: string[] = (Array.isArray(event?.tags) ? event.tags : [])
+ .map((tag: string) => LUMA_TAG_CATEGORY_MAP[String(tag).trim().toLowerCase()])
+ .filter(Boolean)
+ const categories: string[] =
+ mappedCategories.length > 0 ? Array.from(new Set(mappedCategories)) : ['conference']
const rawUrl = event?.url || ''
let safeUrl: string | undefined
diff --git a/apps/www/components/Events/new/EventBanner.tsx b/apps/www/components/Events/new/EventBanner.tsx
index a90104694a3..c259a9f9d4b 100644
--- a/apps/www/components/Events/new/EventBanner.tsx
+++ b/apps/www/components/Events/new/EventBanner.tsx
@@ -2,7 +2,7 @@
import { useEvents } from '~/app/events/context'
import { formatHosts } from '~/lib/eventsUtils'
-import { ArrowRightIcon, CalendarIcon, MapPinIcon } from 'lucide-react'
+import { ArrowRightIcon, CalendarIcon, MapPinIcon, VideoIcon } from 'lucide-react'
import Link from 'next/link'
import { Badge, Button } from 'ui'
@@ -46,7 +46,10 @@ export function EventBanner() {
<div className="flex flex-col justify-between gap-8">
<div className="flex flex-row gap-6">
<DateWidget date={featuredEvent.date} endDate={featuredEvent.end_date} />
- <LocationWidget location={featuredEvent.location} />
+ <LocationWidget
+ location={featuredEvent.location}
+ categories={featuredEvent.categories}
+ />
</div>
<div className="flex items-center md:justify-end gap-2">
@@ -130,7 +133,22 @@ const DateWidget = ({ date, endDate }: { date: string; endDate?: string }) => {
)
}
-const LocationWidget = ({ location }: { location?: string }) => {
+const LocationWidget = ({ location, categories }: { location?: string; categories?: string[] }) => {
+ // Webinars have no physical location; show a camera icon and the format instead.
+ if (categories?.includes('webinar')) {
+ return (
+ <div className="flex items-center gap-4">
+ <div className="bg-surface-100 w-10 h-10 flex items-center justify-center border rounded-md">
+ <VideoIcon className="size-5" strokeWidth={1.5} />
+ </div>
+
+ <div className="flex flex-col gap-0">
+ <p>Supabase Live</p>
+ </div>
+ </div>
+ )
+ }
+
const hasLocation = location && location.length > 0
const locationText = hasLocation ? location : 'Unknown'
diff --git a/apps/www/components/Events/new/EventList.tsx b/apps/www/components/Events/new/EventList.tsx
index aadbe2a9386..caa20d147f7 100644
--- a/apps/www/components/Events/new/EventList.tsx
+++ b/apps/www/components/Events/new/EventList.tsx
@@ -2,7 +2,7 @@
import { useEvents } from '~/app/events/context'
import { formatHosts } from '~/lib/eventsUtils'
-import { Rows3Icon } from 'lucide-react'
+import { MapPinIcon, Rows3Icon, VideoIcon } from 'lucide-react'
import Link from 'next/link'
import { Badge, Button, cn } from 'ui'
@@ -106,7 +106,12 @@ export function EventList() {
)}
</div>
- {event.hosts.length > 0 && (
+ {event.categories?.includes('webinar') ? (
+ <div className="flex gap-2 items-center text-sm text-foreground-light">
+ <VideoIcon className="size-4 shrink-0" strokeWidth={1.5} />
+ Supabase Live
+ </div>
+ ) : event.hosts.length > 0 ? (
<div className="flex gap-2 items-center text-sm text-foreground-light">
<div className="size-5 rounded-full border bg-linear-to-br from-background-surface-100 to-background-surface-200 relative">
{event.hosts[0]?.avatar_url && (
@@ -119,7 +124,12 @@ export function EventList() {
</div>
Hosted by {formatHosts(event.hosts).displayText}
</div>
- )}
+ ) : event.source === 'notion' && event.location ? (
+ <div className="flex gap-2 items-center text-sm text-foreground-light">
+ <MapPinIcon className="size-4 shrink-0" strokeWidth={1.5} />
+ {event.location}
+ </div>
+ ) : null}
</div>
<div className="flex flex-wrap items-center justify-end gap-2 shrink-0 relative z-10">
diff --git a/apps/www/lib/events.ts b/apps/www/lib/events.ts
index 1bbd7752739..72f5db708ab 100644
--- a/apps/www/lib/events.ts
+++ b/apps/www/lib/events.ts
@@ -73,12 +73,6 @@ function getMultiSelect(page: any, name: string): string[] {
return prop.multi_select.map((s: any) => s.name)
}
-function getSelect(page: any, name: string): string {
- const prop = page.properties[name]
- if (!prop || prop.type !== 'select') return ''
- return prop.select?.name ?? ''
-}
-
function getFormulaString(page: any, name: string): string {
const prop = page.properties[name]
if (!prop || prop.type !== 'formula' || prop.formula?.type !== 'string') return ''
@@ -122,10 +116,6 @@ export const getNotionEvents = async (): Promise<SupabaseEvent[]> => {
const rawMeetingLink = getUrl(page, 'Book Meeting Link')
const meetingLink = isSafeHttpUrl(rawMeetingLink) ? rawMeetingLink : ''
const location = getRichText(page, 'Location')
- const notionType = getSelect(page, 'Type')
- // "Conference" events are third-party — we attend but don't host, so no
- // "Hosted by" line. "Supabase event" → host = Supabase.
- const isConferenceType = notionType.toLowerCase() === 'conference'
const categories = ['conference']
const speakingAnswers = getMultiSelect(page, 'Are you speaking at this event?')
const isSpeaking = speakingAnswers.includes('Yes')
@@ -145,7 +135,9 @@ export const getNotionEvents = async (): Promise<SupabaseEvent[]> => {
categories,
timezone: '',
location,
- hosts: isConferenceType ? [] : [SUPABASE_HOST],
+ // Notion events are third-party — Supabase attends but does not host,
+ // so no "Hosted by" line. Only Luma events are Supabase-hosted.
+ hosts: [],
source: 'notion',
disable_page_build: true,
isSpeaking,