Fix user display on menu

This commit is contained in:
Jon Staab 2024-06-05 09:04:53 -07:00
parent 2f869bc143
commit 8d76bb1808
3 changed files with 7 additions and 3 deletions

View File

@ -19,7 +19,7 @@
hasNewMessages,
hasNewNotifications,
sessions,
displayProfileByPubkey,
userDisplay,
publishes,
} from "src/engine"
@ -220,7 +220,7 @@
<Anchor class="flex items-center gap-2" on:click={() => setSubMenu("account")}>
<PersonCircle class="h-10 w-10" pubkey={$pubkey} />
<div class="flex min-w-0 flex-col">
<span>@{displayProfileByPubkey($pubkey)}</span>
<span>@{$userDisplay}</span>
<PersonHandle class="text-sm" pubkey={$pubkey} />
</div>
</Anchor>

View File

@ -103,7 +103,6 @@
{:else if !isEllipsis(parsed)}
{renderParsed(parsed)}
{/if}
{" "}
{/each}
</div>
{#if showMedia && extraLinks.length > 0}

View File

@ -331,6 +331,11 @@ export const displayProfileByPubkey = (pk: string) => {
export const deriveProfileDisplay = (pk: string) =>
derived(deriveProfile(pk), () => displayProfileByPubkey(pk))
export const userDisplay = derived(
[pubkey, profilesByPubkey],
([$pk, $p]) => $pk ? displayProfileByPubkey($pk) : ""
)
export const profilesWithName = derived(profiles, $profiles => $profiles.filter(profileHasName))
export class ProfileSearch extends SearchHelper<PublishedProfile, string> {