Use new ALIAS kind

This commit is contained in:
Jon Staab
2025-04-15 15:45:48 -07:00
parent 374ca7f265
commit f3debe6c02
12 changed files with 67 additions and 87 deletions
+12 -6
View File
@@ -2,7 +2,13 @@
import {type Instance} from "tippy.js"
import {hash} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
import {thunks, formatTimestampAsTime, pubkey} from "@welshman/app"
import {
thunks,
formatTimestampAsTime,
pubkey,
deriveProfile,
deriveProfileDisplay,
} from "@welshman/app"
import {isMobile} from "@lib/html"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
@@ -15,7 +21,7 @@
import ProfileDetail from "@app/components/ProfileDetail.svelte"
import ChatMessageMenu from "@app/components/ChatMessageMenu.svelte"
import ChatMessageMenuMobile from "@app/components/ChatMessageMenuMobile.svelte"
import {colors, deriveAlias, deriveAliasDisplay} from "@app/state"
import {colors} from "@app/state"
import {makeDelete, makeReaction, sendWrapped} from "@app/commands"
import {pushModal} from "@app/modal"
@@ -30,8 +36,8 @@
const thunk = $thunks[event.id]
const isOwn = event.pubkey === $pubkey
const alias = deriveAlias(event.pubkey)
const aliasDisplay = deriveAliasDisplay(event.pubkey)
const profile = deriveProfile(event.pubkey)
const profileDisplay = deriveProfileDisplay(event.pubkey)
const [_, colorValue] = colors[parseInt(hash(event.pubkey)) % colors.length]
const reply = () => replyTo(event)
@@ -101,12 +107,12 @@
{#if !isOwn}
<Button onclick={openProfile} class="flex items-center gap-1">
<Avatar
src={$alias?.profile?.picture}
src={$profile?.picture}
class="border border-solid border-base-content"
size={4} />
<div class="flex items-center gap-2">
<Button onclick={openProfile} class="text-sm font-bold" style="color: {colorValue}">
{$aliasDisplay}
{$profileDisplay}
</Button>
</div>
</Button>