From d68597e8047e4f056685e19883d317470d02a4ff Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 27 Mar 2026 20:26:04 -0700 Subject: [PATCH] fix: small cleanups --- app/pages/calendar/[slug].vue | 71 +++++++++++++++++++++++++++++ app/pages/dashboard/[guildId].vue | 74 +++++++++++++++++++++++++++++-- app/pages/event/[id].vue | 2 +- server/api/calendar/[slug].get.ts | 5 +-- 4 files changed, 145 insertions(+), 7 deletions(-) diff --git a/app/pages/calendar/[slug].vue b/app/pages/calendar/[slug].vue index b7385c6..f22d9ae 100644 --- a/app/pages/calendar/[slug].vue +++ b/app/pages/calendar/[slug].vue @@ -6,6 +6,9 @@ const { data: guildData } = await useFetch(`/api/calendar/${route.params.slug}` const guild = computed(() => guildData.value?.guild) const events = computed(() => guildData.value?.events ?? []) +const pastEvents = computed(() => guildData.value?.pastEvents ?? []) + +const showPastEvents = ref(false) const calendarUrl = computed(() => { if (!guild.value) return '' @@ -127,6 +130,74 @@ useSeoMeta({ + + +
+ +
+ +
+
+

+ {{ ev.name }} +

+
+ + completed +
+

+ {{ ev.description }} +

+
+ +
+
+
+
diff --git a/app/pages/dashboard/[guildId].vue b/app/pages/dashboard/[guildId].vue index 24d7941..df2eb32 100644 --- a/app/pages/dashboard/[guildId].vue +++ b/app/pages/dashboard/[guildId].vue @@ -6,8 +6,16 @@ const { data, refresh, status } = useLazyFetch(`/api/guilds/${route.params.guild const guild = computed(() => data.value?.guild) const events = computed(() => data.value?.events ?? []) +const pastEvents = computed(() => data.value?.pastEvents ?? []) const atprotoSessionValid = computed(() => data.value?.atprotoSessionValid ?? false) +const showPastEvents = ref(false) + +const EVENT_STATUS_LABEL: Record = { + 3: 'completed', + 4: 'canceled', +} + const calendarUrl = computed(() => { if (!guild.value) return '' return `${config.public.appUrl}/calendar/${guild.value.calendarSlug}.ics` @@ -290,15 +298,15 @@ async function disconnectAtproto() { - +

- events + upcoming events ({{ events.length }})

@@ -345,6 +353,66 @@ async function disconnectAtproto() {
+ + +
+ +
+ +
+
+ {{ ev.name }} +
+ + {{ EVENT_STATUS_LABEL[ev.status] }} +
+
+ +
+
+
+
diff --git a/app/pages/event/[id].vue b/app/pages/event/[id].vue index 77b66e3..a91233d 100644 --- a/app/pages/event/[id].vue +++ b/app/pages/event/[id].vue @@ -31,7 +31,7 @@ const activeRsvpStatus = computed(() => { // The server returns raw AT Proto status like "community.lexicon.calendar.rsvp#going" // Extract just the status part const parts = serverStatus.split('#') - return parts[parts.length - 1] as 'going' | 'interested' | 'notgoing' | null + return rsvpStatusLabel[parts[parts.length - 1] as string] as 'going' | 'interested' | 'notgoing' | null }) const rsvpStatusLabel: Record = { diff --git a/server/api/calendar/[slug].get.ts b/server/api/calendar/[slug].get.ts index 3ef2541..09ae218 100644 --- a/server/api/calendar/[slug].get.ts +++ b/server/api/calendar/[slug].get.ts @@ -11,14 +11,13 @@ export default defineEventHandler(async (event) => { const events = await getGuildEvents(guild.id) - const now = Date.now() const activeEvents = events .filter(e => e.status === 1 || e.status === 2) .sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime()) const pastEvents = events - .filter(e => e.status === 3 || (e.status !== 4 && new Date(e.startTime).getTime() < now)) + .filter(e => e.status === 3) .sort((a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime()) - .slice(0, 20) // Only show the 20 most recent past events + .slice(0, 20) // Only show the 20 most recent completed events return { guild: { -- knotmirror 0.0.1