Skip to content

Commit 2dd1249

Browse files
committed
Improve the script
1 parent 3bc5472 commit 2dd1249

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

scripts/sync-working-groups/sync-working-groups.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ const Instant = type({
2424

2525
const calendarEventSchema = type({
2626
id: "string",
27-
"title?": "string",
27+
"summary?": "string",
2828
"status?": "string",
2929
"description?": "string",
3030
"location?": "string",
3131
start: Instant,
3232
end: Instant,
33-
htmlLink: "string",
33+
htmlLink: "string.url",
3434
updated: "string",
3535
})
3636

src/app/(main)/community/events/event-card.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function EventCard({
7474
<a
7575
href={href}
7676
className={clsx(
77-
"gql-focus-visible group flex min-h-[214px] min-w-[260px] flex-col overflow-hidden border border-neu-200 text-left text-current no-underline ring-neu-400 hover:ring-1 hover:ring-offset-1 hover:ring-offset-neu-0 dark:border-neu-50 dark:ring-neu-100 xs:min-w-[352px]",
77+
"gql-focus-visible group flex min-h-[214px] min-w-[260px] flex-col overflow-hidden border border-neu-200 text-left text-current no-underline ring-neu-400 hover:ring-1 hover:ring-offset-1 hover:ring-offset-neu-0 dark:border-neu-50 dark:ring-neu-100 xs:min-w-[352px] lg:w-[408px]",
7878
"[--bg-opacity:0.05] hover:[--bg-opacity:0.07] dark:[--bg-opacity:0.03] hover:dark:[--bg-opacity:0.06]",
7979

8080
"z-[4]",
@@ -99,7 +99,16 @@ export function EventCard({
9999
>
100100
<Tag color={eventTagColors[kind]}>{kind}</Tag>
101101
{meta ? (
102-
<span className="typography-body-md">{meta}</span>
102+
<span
103+
className={clsx(
104+
String(meta).length < 22
105+
? "typography-body-md"
106+
: "typography-body-sm",
107+
"overflow-hidden text-ellipsis whitespace-pre",
108+
)}
109+
>
110+
{meta}
111+
</span>
103112
) : (
104113
<span className="sr-only">Official GraphQL Local</span>
105114
)}
@@ -121,7 +130,15 @@ export function EventCard({
121130
<div className="typography-body-sm flex items-center gap-1 px-2 py-1.5 text-neu-800 dark:text-neu-600 xs:gap-1.5 xs:px-4 xs:py-2.5">
122131
<CalendarIcon className="size-4 shrink-0 translate-y-[-.5px] text-neu-800 dark:text-neu-500 xs:size-5" />
123132
{parsedDate ? (
124-
<time dateTime={parsedDate.toISOString()}>{dateLabel}</time>
133+
<time dateTime={parsedDate.toISOString()}>
134+
{kind === "working-group"
135+
? parsedDate.toLocaleString(undefined, {
136+
dateStyle: "medium",
137+
timeStyle: "short",
138+
hour12: false,
139+
})
140+
: dateLabel}
141+
</time>
125142
) : (
126143
<span>{dateLabel}</span>
127144
)}

src/app/(main)/community/events/events-list.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function EventsList({
7575

7676
const tags: Set<EventKind> = new Set()
7777
events.forEach(event => {
78-
// todo: add working groups
78+
if ("start" in event) tags.add("working-group")
7979
if ("node" in event) tags.add("meetup")
8080
else tags.add("conference")
8181
})
@@ -124,8 +124,8 @@ export function EventsList({
124124
key={event.id}
125125
href={event.htmlLink}
126126
date={new Date(event.start)}
127-
name={event.title ?? "Working Group"}
128-
city={event.location ?? "Online"}
127+
name={event.summary ?? "Working Group"}
128+
city="Online" // event.location is a zoom link, we could potentially use but we'd have to refactor the event-card to avoid nested anchors
129129
kind="working-group"
130130
/>
131131
) : (

0 commit comments

Comments
 (0)