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

View File

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

View File

@ -331,6 +331,11 @@ export const displayProfileByPubkey = (pk: string) => {
export const deriveProfileDisplay = (pk: string) => export const deriveProfileDisplay = (pk: string) =>
derived(deriveProfile(pk), () => displayProfileByPubkey(pk)) 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 const profilesWithName = derived(profiles, $profiles => $profiles.filter(profileHasName))
export class ProfileSearch extends SearchHelper<PublishedProfile, string> { export class ProfileSearch extends SearchHelper<PublishedProfile, string> {