Add the profile page for users

This commit is contained in:
dtonon 2026-08-26 14:48:41 +01:00
parent bcbc70ecb8
commit f40680cbf9
13 changed files with 517 additions and 76 deletions

View file

@ -1,6 +1,7 @@
<script lang="ts">
import { loadNostrUser, type NostrUser } from "$lib/gadgets";
import { tokenizeChat } from "$lib/linkify";
import { profilePath } from "$lib/forum/profiles";
import {
resolveThreadRef,
threadRefHref,
@ -39,9 +40,7 @@
<span class="break-words whitespace-pre-wrap"
>{#each tokens as t (t)}{#if t.type === "mention"}{@const u =
profiles[t.pubkey] ?? resolvedUsers[t.pubkey]}<a
href="https://njump.me/{t.entity}"
target="_blank"
rel="noopener noreferrer"
href={profilePath(t.pubkey)}
class="text-accent hover:underline">@{u?.shortName ?? t.fallback}</a
>{:else if t.type === "entity"}{@const ref = t.id
? resolvedThreads[t.id]

View file

@ -20,6 +20,7 @@
ensureMembershipChecked,
} from "$lib/join.svelte";
import { activeGroup } from "$lib/active.svelte";
import { profilePath } from "$lib/forum/profiles";
import type { NostrUser } from "@nostr/gadgets/metadata";
import MentionAutocomplete from "$lib/components/MentionAutocomplete.svelte";
import ChatContent from "$lib/components/ChatContent.svelte";
@ -348,21 +349,30 @@
{/if}
<div>
<div class="mb-1 flex items-center gap-2">
{#if author.picture}
<img
src={author.picture}
alt=""
class="h-6 w-6 shrink-0 rounded-full object-cover"
/>
{:else}
<span
class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-neutral-200 text-xs font-semibold text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400"
>
{author.name[0].toUpperCase()}
</span>
{/if}
<span class="font-medium text-neutral-500 dark:text-neutral-400"
>{author.name}</span
<a
href={profilePath(msg.pubkey)}
class="shrink-0"
aria-hidden="true"
tabindex="-1"
>
{#if author.picture}
<img
src={author.picture}
alt=""
class="h-6 w-6 rounded-full object-cover"
/>
{:else}
<span
class="flex h-6 w-6 items-center justify-center rounded-full bg-neutral-200 text-xs font-semibold text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400"
>
{author.name[0].toUpperCase()}
</span>
{/if}
</a>
<a
href={profilePath(msg.pubkey)}
class="hover:text-accent truncate font-medium text-neutral-500 dark:text-neutral-400"
>{author.name}</a
>
<div class="ml-auto flex items-center gap-1">
<div class="relative">

View file

@ -1,6 +1,7 @@
<script lang="ts">
import { loadNostrUser, type NostrUser } from "$lib/gadgets";
import * as nip19 from "@nostr/tools/nip19";
import { profilePath } from "$lib/forum/profiles";
import {
resolveThreadRef,
threadRefHref,
@ -611,11 +612,8 @@
>
{:else if inline.type === "mention"}
{@const u = profiles[inline.pubkey] ?? resolvedUsers[inline.pubkey]}
<a
href="https://njump.me/{inline.entity}"
target="_blank"
rel="noopener noreferrer"
class="text-accent hover:underline">@{u?.shortName ?? inline.fallback}</a
<a href={profilePath(inline.pubkey)} class="text-accent hover:underline"
>@{u?.shortName ?? inline.fallback}</a
>
{:else if inline.type === "thread-quote"}
{@const u = profiles[inline.pubkey] ?? resolvedUsers[inline.pubkey]}
@ -700,7 +698,7 @@
src={block.src}
alt={block.alt}
loading="lazy"
class="block mx-auto w-full max-h-[80vh] object-contain rounded"
class="mx-auto block max-h-[80vh] w-full rounded object-contain"
/>
{:else if block.type === "blockquote"}
<blockquote