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
+3 -6
View File
@@ -20,7 +20,7 @@
import ChannelMessageEmojiButton from "@app/components/ChannelMessageEmojiButton.svelte"
import ChannelMessageMenuButton from "@app/components/ChannelMessageMenuButton.svelte"
import ChannelMessageMenuMobile from "@app/components/ChannelMessageMenuMobile.svelte"
import {colors, deriveAlias, deriveAliasDisplay} from "@app/state"
import {colors, deriveAliasedProfile, deriveAliasDisplay} from "@app/state"
import {publishDelete, publishReaction} from "@app/commands"
import {pushModal} from "@app/modal"
@@ -37,7 +37,7 @@
const thunk = $thunks[event.id]
const today = formatTimestampAsDate(now())
const alias = deriveAlias(event.pubkey, url)
const profile = deriveAliasedProfile(event.pubkey, url)
const aliasDisplay = deriveAliasDisplay(event.pubkey, url)
const [_, colorValue] = colors[parseInt(hash(event.pubkey)) % colors.length]
const hideMenuButton = $derived($thunk && !thunkIsComplete($thunk))
@@ -66,10 +66,7 @@
<div class="flex w-full gap-3 overflow-auto">
{#if showPubkey}
<Button onclick={openProfile} class="flex items-start">
<Avatar
src={$alias?.profile?.picture}
class="border border-solid border-base-content"
size={8} />
<Avatar src={$profile?.picture} class="border border-solid border-base-content" size={8} />
</Button>
{:else}
<div class="w-8 min-w-8 max-w-8"></div>
+7 -3
View File
@@ -2,12 +2,10 @@
import type {Snippet} from "svelte"
import {onMount} from "svelte"
import {int, nthNe, MINUTE, sortBy, remove} from "@welshman/lib"
import {load} from "@welshman/net"
import type {TrustedEvent, EventContent} from "@welshman/util"
import {createEvent, DIRECT_MESSAGE, INBOX_RELAYS} from "@welshman/util"
import {
pubkey,
Router,
tagPubkey,
loadUsingOutbox,
formatTimestampAsDate,
@@ -28,7 +26,13 @@
import ChatMessage from "@app/components/ChatMessage.svelte"
import ChatCompose from "@app/components/ChannelCompose.svelte"
import ChatComposeParent from "@app/components/ChannelComposeParent.svelte"
import {INDEXER_RELAYS, userSettingValues, deriveChat, splitChatId, PLATFORM_NAME} from "@app/state"
import {
INDEXER_RELAYS,
userSettingValues,
deriveChat,
splitChatId,
PLATFORM_NAME,
} from "@app/state"
import {pushModal} from "@app/modal"
import {sendWrapped, prependParent} from "@app/commands"
+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>
+3 -4
View File
@@ -1,11 +1,10 @@
<script lang="ts">
import type {ProfilePointer} from "@welshman/content"
import {displayProfile} from "@welshman/util"
import {deriveProfile} from "@welshman/app"
import Button from "@lib/components/Button.svelte"
import ProfileDetail from "@app/components/ProfileDetail.svelte"
import {pushModal} from "@app/modal"
import {deriveAlias} from "@app/state"
import {deriveAliasedProfile} from "@app/state"
type Props = {
value: ProfilePointer
@@ -14,11 +13,11 @@
const {value, url}: Props = $props()
const alias = deriveAlias(value.pubkey, url)
const profile = deriveAliasedProfile(value.pubkey, url)
const openProfile = () => pushModal(ProfileDetail, {pubkey: value.pubkey, url})
</script>
<Button onclick={openProfile} class="link-content">
@{displayProfile($alias?.profile)}
@{displayProfile($profile)}
</Button>
+3 -3
View File
@@ -12,7 +12,7 @@
import WotScore from "@lib/components/WotScore.svelte"
import ProfileDetail from "@app/components/ProfileDetail.svelte"
import {pushModal} from "@app/modal"
import {deriveAlias, deriveAliasDisplay} from "@app/state"
import {deriveAliasedProfile, deriveAliasDisplay} from "@app/state"
type Props = {
pubkey: string
@@ -21,7 +21,7 @@
const {pubkey, url}: Props = $props()
const alias = deriveAlias(pubkey, url)
const profile = deriveAliasedProfile(pubkey, url)
const aliasDisplay = deriveAliasDisplay(pubkey, url)
const handle = deriveHandleForPubkey(pubkey)
const score = deriveUserWotScore(pubkey)
@@ -35,7 +35,7 @@
<div class="flex max-w-full gap-3">
<Button onclick={openProfile} class="py-1">
<Avatar src={$alias?.profile?.picture} size={10} />
<Avatar src={$profile?.picture} size={10} />
</Button>
<div class="flex min-w-0 flex-col">
<div class="flex items-center gap-2">
+3 -3
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import Avatar from "@lib/components/Avatar.svelte"
import {deriveAlias} from "@app/state"
import {deriveAliasedProfile} from "@app/state"
type Props = {
pubkey: string
@@ -9,7 +9,7 @@
const {pubkey, url, ...props}: Props = $props()
const alias = deriveAlias(pubkey, url)
const profile = deriveAliasedProfile(pubkey, url)
</script>
<Avatar src={$alias?.profile?.picture} icon="user-circle" {...props} />
<Avatar src={$profile?.picture} icon="user-circle" {...props} />
+5 -5
View File
@@ -16,7 +16,7 @@
import ModalFooter from "@lib/components/ModalFooter.svelte"
import ProfileInfo from "@app/components/ProfileInfo.svelte"
import ChatEnable from "@app/components/ChatEnable.svelte"
import {canDecrypt, pubkeyLink, deriveAlias, deriveAliasDisplay} from "@app/state"
import {canDecrypt, pubkeyLink, deriveAliasedProfile, deriveAliasDisplay} from "@app/state"
import {pushModal} from "@app/modal"
import {makeChatPath} from "@app/routes"
@@ -27,8 +27,8 @@
const {pubkey, url}: Props = $props()
const alias = deriveAlias(pubkey, url)
const aliasDisplay = deriveAliasDisplay(pubkey, url)
const profile = deriveAliasedProfile(pubkey, url)
const display = deriveAliasDisplay(pubkey, url)
const handle = deriveHandleForPubkey(pubkey)
const score = deriveUserWotScore(pubkey)
@@ -46,12 +46,12 @@
<div class="column gap-4">
<div class="flex max-w-full gap-3">
<span class="py-1">
<Avatar src={$alias?.profile?.picture} size={10} />
<Avatar src={$profile?.picture} size={10} />
</span>
<div class="flex min-w-0 flex-col">
<div class="flex items-center gap-2">
<span class="text-bold overflow-hidden text-ellipsis">
{$aliasDisplay}
{$display}
</span>
<WotScore score={$score} active={following} />
</div>
+2 -2
View File
@@ -91,8 +91,8 @@
{/snippet}
{#snippet info()}
<p>
If enabled, changes will be published to the broader nostr network in addition to
spaces you are a member of.
If enabled, changes will be published to the broader nostr network in addition to spaces you
are a member of.
</p>
{/snippet}
</FieldInline>
+4 -4
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import Content from "@app/components/Content.svelte"
import {deriveAlias} from "@app/state"
import {deriveAliasedProfile} from "@app/state"
export type Props = {
pubkey: string
@@ -9,9 +9,9 @@
const {pubkey, url}: Props = $props()
const alias = deriveAlias(pubkey, url)
const profile = deriveAliasedProfile(pubkey, url)
</script>
{#if $alias?.profile}
<Content event={{content: $alias.profile.about, tags: []}} hideMediaAtDepth={0} />
{#if $profile}
<Content event={{content: $profile.about, tags: []}} hideMediaAtDepth={0} />
{/if}