From 0b45c3e97c3ab70c095df0f1304f7dd2a665da37 Mon Sep 17 00:00:00 2001 From: silberengel Date: Wed, 6 Aug 2025 18:05:04 +0200 Subject: [PATCH] Personal notifications added to "View Profile" --- src/lib/components/EventDetails.svelte | 4 + src/lib/components/Notifications.svelte | 451 ++++++++++++++++++++++++ 2 files changed, 455 insertions(+) create mode 100644 src/lib/components/Notifications.svelte diff --git a/src/lib/components/EventDetails.svelte b/src/lib/components/EventDetails.svelte index c14d7e6..3a8801e 100644 --- a/src/lib/components/EventDetails.svelte +++ b/src/lib/components/EventDetails.svelte @@ -14,6 +14,7 @@ import CopyToClipboard from "$lib/components/util/CopyToClipboard.svelte"; import { navigateToEvent } from "$lib/utils/nostrEventService"; import ContainingIndexes from "$lib/components/util/ContainingIndexes.svelte"; + import Notifications from "$lib/components/Notifications.svelte"; const { event, @@ -473,6 +474,9 @@ {profile} identifiers={getIdentifiers(event, profile)} /> + + + {/if} diff --git a/src/lib/components/Notifications.svelte b/src/lib/components/Notifications.svelte new file mode 100644 index 0000000..9566bcb --- /dev/null +++ b/src/lib/components/Notifications.svelte @@ -0,0 +1,451 @@ + + +{#if isOwnProfile && $userStore.signedIn} +
+
+ Notifications + + +
+ + +
+
+ + {#if loading} +
+
+ Loading notifications... +
+ {:else if error} +
+

Error loading notifications: {error}

+
+ {:else if notifications.length === 0} +
+

No notifications {notificationMode === "to-me" ? "received" : "sent"} found.

+
+ {:else} +
+
+ {#each notifications.slice(0, 10) as notification} + {@const authorProfile = authorProfiles.get(notification.pubkey)} +
+
+ +
+ {#if authorProfile?.picture} + Author avatar { + (e.target as HTMLImageElement).style.display = 'none'; + }} + /> + {:else} +
+ + {(authorProfile?.displayName || authorProfile?.name || notification.pubkey.slice(0, 1)).toUpperCase()} + +
+ {/if} +
+ + +
+
+ + {getNotificationType(notification)} + + + {notification.created_at ? formatDate(notification.created_at) : "Unknown date"} + +
+ + +
+ + {authorProfile?.displayName || authorProfile?.name || `${notification.pubkey.slice(0, 8)}...${notification.pubkey.slice(-4)}`} + + {#if authorProfile?.name && authorProfile?.displayName && authorProfile.name !== authorProfile.displayName} + + (@{authorProfile.name}) + + {/if} +
+ + {#if notification.content} +
+ {truncateContent(notification.content)} +
+ {/if} + +
+ + + {getNeventUrl(notification).slice(0, 16)}... + +
+
+
+
+ {/each} +
+ + {#if notifications.length > 10} +
+ Showing 10 of {notifications.length} notifications {notificationMode === "to-me" ? "received" : "sent"}. Scroll to see more. +
+ {/if} +
+ {/if} +
+{/if} \ No newline at end of file