Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/app/(main)/community/events/events-list.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ describe(categorizeEvent.name, () => {

assert.equal(categorizeEvent(event), "working-group")
})

it("categorizes virtual meetups as meetups", () => {
const event = {
id: "virtual-meetup",
summary: "GraphQL Virtual Meetup",
start: "2026-12-08T18:00:00.000Z",
end: "2026-12-08T19:00:00.000Z",
htmlLink: "https://calendar.google.com/event?eid=virtual-meetup",
updated: "2026-10-20T15:13:22.000Z",
} satisfies CalendarEvent

assert.equal(categorizeEvent(event), "meetup")
})
})
2 changes: 1 addition & 1 deletion src/app/(main)/community/events/events-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function categorizeEvent(
return "foundation-meeting"
} else if (/\bConference\s+Planning\b/i.test(summary)) {
return "working-group"
} else if (/\bLocal\b/i.test(summary)) {
} else if (/\b(Local|Virtual\s+Meetup)\b/i.test(summary)) {
return "meetup"
} else if (/\bGraphQLConf[0-9]*\b/i.test(summary)) {
// Handled elsewhere
Expand Down
10 changes: 5 additions & 5 deletions src/app/(main)/community/events/get-all-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { events, type Event } from "./events"

type AnyEvent = Event | CalendarEvent

const WORKING_GROUP_MEETINGS_FILE = join(
const CALENDAR_EVENTS_FILE = join(
process.cwd(),
"scripts/sync-calendar-events/calendar-events.ndjson",
)

export const getAllEvents = cache(async () => {
const workingGroupMeetings = await loadWorkingGroupMeetings()
const workingGroupMeetings = await loadCalendarEvents()

let pastEvents: AnyEvent[] = []
let upcomingEvents: AnyEvent[] = []
Expand Down Expand Up @@ -53,16 +53,16 @@ export const getAllEvents = cache(async () => {
return { pastEvents, upcomingEvents }
})

export const loadWorkingGroupMeetings = cache(async () => {
export const loadCalendarEvents = cache(async () => {
try {
const raw = (await readFile(WORKING_GROUP_MEETINGS_FILE, "utf8")).trim()
const raw = (await readFile(CALENDAR_EVENTS_FILE, "utf8")).trim()
if (!raw) return []
return raw
.split("\n")
.filter(Boolean)
.map(line => JSON.parse(line) as CalendarEvent)
} catch (error) {
console.error("Failed to read working group meetings", error)
console.error("Failed to read calendar events", error)
return []
}
})
12 changes: 7 additions & 5 deletions src/app/(main)/resources/[category]/category-working-groups.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { clsx } from "clsx"
import { EventCard } from "@/app/(main)/community/events/event-card"
import { EventsScrollview } from "@/app/(main)/community/events/events-scrollview"
import { loadWorkingGroupMeetings } from "@/app/(main)/community/events/get-all-events"
import { loadCalendarEvents } from "@/app/(main)/community/events/get-all-events"
import type { Topic } from "@/resources/types"

import { categoriesConfig, sectionIds } from "./categories-config"
Expand All @@ -19,17 +19,19 @@ export async function CategoryWorkingGroups({
if (!predicate) return null
const { heading, text } = categoriesConfig[category].sections.event || {}

const meetings = await loadWorkingGroupMeetings()
const matchingMeetings = meetings.filter(predicate)
const calendarEvents = await loadCalendarEvents()
const matchingCalendarEvents = calendarEvents.filter(predicate)

const futureEvents = matchingMeetings.filter(
const futureEvents = matchingCalendarEvents.filter(
event => new Date(event.start).getTime() >= Date.now(),
)

const hasFutureEvents = futureEvents.length > 0

// soonest/most recent first
const events = hasFutureEvents ? futureEvents : matchingMeetings.reverse()
const events = hasFutureEvents
? futureEvents
: matchingCalendarEvents.reverse()

if (events.length === 0) return null

Expand Down
2 changes: 1 addition & 1 deletion src/app/(main)/resources/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { DocsSection } from "./docs-section"
import { LookingForMore } from "@/components/looking-for-more"
import { unsafeKeys } from "@/app/conf/_design-system/utils/unsafe-keys"
import { CategoryWorkingGroups } from "./category-working-groups"
import { loadWorkingGroupMeetings } from "../../community/events/get-all-events"
import { loadCalendarEvents } from "../../community/events/get-all-events"

interface PageParams {
category: string
Expand Down
Loading