From 2d0f550d514b936afb884d23813e9f8357dda436 Mon Sep 17 00:00:00 2001 From: Florian <45694132+flo-bit@users.noreply.github.com> Date: Sun, 22 Feb 2026 15:50:39 +0100 Subject: [PATCH] add subscribe button, show upcoming or past events --- .../[[actor=actor]]/events/+page.svelte | 71 ++++++++++++++----- 1 file changed, 55 insertions(+), 16 deletions(-) diff --git a/src/routes/[[actor=actor]]/events/+page.svelte b/src/routes/[[actor=actor]]/events/+page.svelte index d69df22..80f5f3f 100644 --- a/src/routes/[[actor=actor]]/events/+page.svelte +++ b/src/routes/[[actor=actor]]/events/+page.svelte @@ -2,7 +2,8 @@ import type { EventData } from '$lib/cards/social/EventCard'; import { getCDNImageBlobUrl } from '$lib/atproto'; import { user } from '$lib/atproto/auth.svelte'; - import { Avatar as FoxAvatar, Badge, Button } from '@foxui/core'; + import { Avatar as FoxAvatar, Badge, Button, toast } from '@foxui/core'; + import { page } from '$app/state'; import Avatar from 'svelte-boring-avatars'; import * as TID from '@atcute/tid'; import { goto } from '$app/navigation'; @@ -78,6 +79,16 @@ } let isOwner = $derived(user.isLoggedIn && user.did === did); + + let showPast: boolean = $state(false); + let now = $derived(new Date()); + let filteredEvents = $derived( + events.filter((e) => { + const endOrStart = e.endsAt || e.startsAt; + const eventDate = new Date(endOrStart); + return showPast ? eventDate < now : eventDate >= now; + }) + ); @@ -96,7 +107,7 @@

- Upcoming events + {showPast ? 'Past' : 'Upcoming'} events

Hosted by @@ -111,26 +122,54 @@
- {#if isOwner} +
+ {#if isOwner} + + {/if} { + const calendarUrl = `${page.url.origin}${page.url.pathname.replace(/\/$/, '')}/calendar`; + await navigator.clipboard.writeText(calendarUrl); + toast.success('Subscription link copied to clipboard'); + }}>Subscribe - {/if} +
+
+ + +
+ +
- {#if events.length === 0} -

No events found.

+ {#if filteredEvents.length === 0} +

+ No {showPast ? 'past' : 'upcoming'} events. +

{:else}
- {#each events as event (event.rkey)} + {#each filteredEvents as event (event.rkey)} {@const thumbnail = getThumbnail(event)} {@const location = getLocationString(event.locations)} {@const rkey = event.rkey} -- 2.54.0