From 106a7665e529646a81b4294f51e8bce5c1562b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Mon, 18 Aug 2025 18:39:51 +0200 Subject: [PATCH] Profile page --- src/lib/a/forms/ACommentForm.svelte | 67 +- src/routes/profile/+page.svelte | 914 ++++------------------------ 2 files changed, 149 insertions(+), 832 deletions(-) diff --git a/src/lib/a/forms/ACommentForm.svelte b/src/lib/a/forms/ACommentForm.svelte index 5509dcc..de55ff1 100644 --- a/src/lib/a/forms/ACommentForm.svelte +++ b/src/lib/a/forms/ACommentForm.svelte @@ -1,17 +1,19 @@ -
+ -
+ +
+ {#if preview} + {@html preview} + {:else} +

Preview will appear here...

+ {/if} +
\ No newline at end of file diff --git a/src/routes/profile/+page.svelte b/src/routes/profile/+page.svelte index e8a45d1..0a23444 100644 --- a/src/routes/profile/+page.svelte +++ b/src/routes/profile/+page.svelte @@ -1,36 +1,19 @@ -
-
- -
-
-
- Events - {#if showSidePanel} - - {/if} -
- -

- Search and view any event on the Nostr network. Enter an npub, nprofile, nevent, naddr, note, - pubkey, or eventID. You can also search for events by d-tag using the - format "d:tag-name", t-tags with "t:tag-name", or profiles by name with "n:name". -

- -

Visit the - Compose page to create new events. -

- - - - {#if secondOrderSearchMessage} -
- {secondOrderSearchMessage} +{#if !user || !user.signedIn} +
+ Please log in to view your profile. +
+{:else} +
+
+
+ {#if profile?.banner} +
+ Banner (e.target as HTMLImageElement).style.display='none'} /> + {#if profile?.picture} + Avatar (e.target as HTMLImageElement).style.display='none'} /> + {/if}
{/if} - - {#if searchResults.length > 0} -
- - {#if searchType === "n"} - Search Results for name: "{searchTerm && searchTerm.length > 50 ? searchTerm.slice(0, 50) + '...' : searchTerm || ''}" ({searchResults.length} profiles) - {:else if searchType === "t"} - Search Results for t-tag: "{searchTerm && searchTerm.length > 50 ? searchTerm.slice(0, 50) + '...' : searchTerm || ''}" ({searchResults.length} - events) - {:else} - Search Results for d-tag: "{(() => { - const term = searchTerm || dTagValue?.toLowerCase() || ''; - return term.length > 50 ? term.slice(0, 50) + '...' : term; - })()}" ({searchResults.length} events) +
+ {#if !profile?.banner && profile?.picture} + Avatar (e.target as HTMLImageElement).style.display='none'} /> + {/if} +
+ {displayName()} +
+ {#if user.npub} + + {/if} + {#if profile?.nip05} + {profile.nip05} + {/if} + {#if profile?.lud16} + ⚡ {profile.lud16} {/if} - -
- {#each searchResults as result, index} - - - {@const profileData = parseProfileContent(result)} - {/each}
- {/if} - - {#if secondOrderResults.length > 0} -
- - Second-Order Events (References, Replies, Quotes) ({secondOrderResults.length} - events) - - {#if (searchType === "n" || searchType === "d") && secondOrderResults.length === 100} -

- Showing the 100 newest events. More results may be available. -

+ {#if profile?.about} +

{profile.about}

+ {/if} +
+ {#if profile?.website} + {profile.website} {/if} -

- Events that reference, reply to, highlight, or quote the original - events. -

-
- {#each secondOrderResults as result, index} - {@const profileData = parseProfileContent(result)} - - {/each} -
-
- {/if} - - {#if tTagResults.length > 0} -
- - Search Results for t-tag: "{searchTerm || - dTagValue?.toLowerCase()}" ({tTagResults.length} events) - -

- Events that are tagged with the t-tag. -

-
- {#each tTagResults as result, index} - {@const profileData = parseProfileContent(result)} - - {/each} -
- {/if} - -
-
- - - {#if showSidePanel && event} -
-
- Event Details - + {#if loading} +
Loading profile…
+ {/if} + {#if error} +
{error}
+ {/if}
+
- {#if event.kind !== 0} -
- - {#if isAddressableEvent(event)} - {@const naddrAddress = getViewPublicationNaddr(event)} - {#if naddrAddress} - -
- -
- {/if} - {/if} -
- {/if} - - - - - - -
- Add Comment - + {#if profileEvent} +
+ +
-
- {/if} + {:else if !loading} + No profile event (kind 0) found for this user. + {/if} +
-
+{/if}