diff --git a/src/lib/components/ActivitySheet.svelte b/src/lib/components/ActivitySheet.svelte
index 8f9e3e1..c645620 100644
--- a/src/lib/components/ActivitySheet.svelte
+++ b/src/lib/components/ActivitySheet.svelte
@@ -8,15 +8,18 @@
import { clipOverlaySignal, openCommentsSignal } from '$lib/stores/toasts';
import { createSafeTimeout } from '$lib/safeTimeout';
import BellIcon from 'phosphor-svelte/lib/BellIcon';
+ import XIcon from 'phosphor-svelte/lib/XIcon';
+ import { fetchUnwatchedCount } from '$lib/stores/notifications';
const { ondismiss }: { ondismiss: () => void } = $props();
interface Notification {
id: string;
- type: 'reaction' | 'comment' | 'reply' | 'mention';
+ type: 'reaction' | 'comment' | 'reply' | 'mention' | 'new_clip';
clipId: string;
emoji: string | null;
commentPreview: string | null;
+ clipContentType: string;
actorUsername: string;
actorAvatar: string | null;
clipThumbnail: string | null;
@@ -129,13 +132,17 @@
safeTimeout(() => {
ondismiss();
clipOverlaySignal.set(n.clipId);
- if (n.type !== 'reaction') {
+ if (n.type !== 'reaction' && n.type !== 'new_clip') {
openCommentsSignal.set(n.clipId);
}
}, 300);
}
function description(n: Notification): string {
+ if (n.type === 'new_clip') {
+ const label = n.clipContentType === 'music' ? 'a song' : 'a video';
+ return `added ${label}`;
+ }
if (n.type === 'reaction') {
return `reacted ${n.emoji} to your clip`;
}
@@ -148,6 +155,15 @@
return 'commented on your clip';
}
+ async function dismissNotification(e: Event, n: Notification) {
+ e.preventDefault();
+ e.stopPropagation();
+ items = items.filter((item) => item.id !== n.id);
+ await fetch(`/api/notifications/${n.id}`, { method: 'DELETE' });
+ fetchUnreadCount();
+ fetchUnwatchedCount();
+ }
+
onDestroy(clearAll);
@@ -165,7 +181,7 @@
No activity yet
-Reactions and comments on your clips will show up here
+New clips, reactions, and comments will show up here
{:else} {#each grouped as section (section.label)} @@ -204,6 +220,13 @@