Remove aliases, their time has not yet come

This commit is contained in:
Jon Staab
2025-04-16 10:36:21 -07:00
parent f3debe6c02
commit 303b8967e9
10 changed files with 41 additions and 93 deletions
+6 -4
View File
@@ -7,6 +7,8 @@
formatTimestampAsDate,
formatTimestampAsTime,
thunkIsComplete,
deriveProfile,
deriveProfileDisplay,
} from "@welshman/app"
import {isMobile} from "@lib/html"
import TapTarget from "@lib/components/TapTarget.svelte"
@@ -20,7 +22,7 @@
import ChannelMessageEmojiButton from "@app/components/ChannelMessageEmojiButton.svelte"
import ChannelMessageMenuButton from "@app/components/ChannelMessageMenuButton.svelte"
import ChannelMessageMenuMobile from "@app/components/ChannelMessageMenuMobile.svelte"
import {colors, deriveAliasedProfile, deriveAliasDisplay} from "@app/state"
import {colors} from "@app/state"
import {publishDelete, publishReaction} from "@app/commands"
import {pushModal} from "@app/modal"
@@ -37,8 +39,8 @@
const thunk = $thunks[event.id]
const today = formatTimestampAsDate(now())
const profile = deriveAliasedProfile(event.pubkey, url)
const aliasDisplay = deriveAliasDisplay(event.pubkey, url)
const profile = deriveProfile(event.pubkey, [url])
const profileDisplay = deriveProfileDisplay(event.pubkey, [url])
const [_, colorValue] = colors[parseInt(hash(event.pubkey)) % colors.length]
const hideMenuButton = $derived($thunk && !thunkIsComplete($thunk))
@@ -75,7 +77,7 @@
{#if showPubkey}
<div class="flex items-center gap-2">
<Button onclick={openProfile} class="text-sm font-bold" style="color: {colorValue}">
{$aliasDisplay}
{$profileDisplay}
</Button>
<span class="text-xs opacity-50">
{#if formatTimestampAsDate(event.created_at) === today}
+3 -2
View File
@@ -1,10 +1,11 @@
<script lang="ts">
import {removeNil} from "@welshman/lib"
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 {deriveAliasedProfile} from "@app/state"
type Props = {
value: ProfilePointer
@@ -13,7 +14,7 @@
const {value, url}: Props = $props()
const profile = deriveAliasedProfile(value.pubkey, url)
const profile = deriveProfile(value.pubkey, removeNil([url]))
const openProfile = () => pushModal(ProfileDetail, {pubkey: value.pubkey, url})
</script>
+7 -4
View File
@@ -1,4 +1,5 @@
<script lang="ts">
import {removeNil} from "@welshman/lib"
import {displayPubkey, getPubkeyTagValues, getListTags} from "@welshman/util"
import {
session,
@@ -6,13 +7,14 @@
deriveUserWotScore,
deriveHandleForPubkey,
displayHandle,
deriveProfile,
deriveProfileDisplay,
} from "@welshman/app"
import Button from "@lib/components/Button.svelte"
import Avatar from "@lib/components/Avatar.svelte"
import WotScore from "@lib/components/WotScore.svelte"
import ProfileDetail from "@app/components/ProfileDetail.svelte"
import {pushModal} from "@app/modal"
import {deriveAliasedProfile, deriveAliasDisplay} from "@app/state"
type Props = {
pubkey: string
@@ -21,8 +23,9 @@
const {pubkey, url}: Props = $props()
const profile = deriveAliasedProfile(pubkey, url)
const aliasDisplay = deriveAliasDisplay(pubkey, url)
const relays = removeNil([url])
const profile = deriveProfile(pubkey, relays)
const profileDisplay = deriveProfileDisplay(pubkey, relays)
const handle = deriveHandleForPubkey(pubkey)
const score = deriveUserWotScore(pubkey)
@@ -40,7 +43,7 @@
<div class="flex min-w-0 flex-col">
<div class="flex items-center gap-2">
<Button onclick={openProfile} class="text-bold overflow-hidden text-ellipsis">
{$aliasDisplay}
{$profileDisplay}
</Button>
<WotScore score={$score} active={following} />
</div>
+3 -2
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import Avatar from "@lib/components/Avatar.svelte"
import {deriveAliasedProfile} from "@app/state"
import {removeNil} from "@welshman/lib"
import {deriveProfile} from "@welshman/app"
type Props = {
pubkey: string
@@ -9,7 +10,7 @@
const {pubkey, url, ...props}: Props = $props()
const profile = deriveAliasedProfile(pubkey, url)
const profile = deriveProfile(pubkey, removeNil([url]))
</script>
<Avatar src={$profile?.picture} icon="user-circle" {...props} />
+7 -3
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import {goto} from "$app/navigation"
import {removeNil} from "@welshman/lib"
import {displayPubkey, getPubkeyTagValues, getListTags} from "@welshman/util"
import {
session,
@@ -7,6 +8,8 @@
deriveUserWotScore,
deriveHandleForPubkey,
displayHandle,
deriveProfile,
deriveProfileDisplay,
} from "@welshman/app"
import Icon from "@lib/components/Icon.svelte"
import Link from "@lib/components/Link.svelte"
@@ -16,7 +19,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, deriveAliasedProfile, deriveAliasDisplay} from "@app/state"
import {canDecrypt, pubkeyLink} from "@app/state"
import {pushModal} from "@app/modal"
import {makeChatPath} from "@app/routes"
@@ -27,8 +30,9 @@
const {pubkey, url}: Props = $props()
const profile = deriveAliasedProfile(pubkey, url)
const display = deriveAliasDisplay(pubkey, url)
const relays = removeNil([url])
const profile = deriveProfile(pubkey, relays)
const display = deriveProfileDisplay(pubkey, relays)
const handle = deriveHandleForPubkey(pubkey)
const score = deriveUserWotScore(pubkey)
+3 -2
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import {removeNil} from "@welshman/lib"
import {deriveProfile} from "@welshman/app"
import Content from "@app/components/Content.svelte"
import {deriveAliasedProfile} from "@app/state"
export type Props = {
pubkey: string
@@ -9,7 +10,7 @@
const {pubkey, url}: Props = $props()
const profile = deriveAliasedProfile(pubkey, url)
const profile = deriveProfile(pubkey, removeNil([url]))
</script>
{#if $profile}
+4 -3
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import {deriveAliasDisplay} from "@app/state"
import {removeNil} from "@welshman/lib"
import {deriveProfileDisplay} from "@welshman/app"
type Props = {
pubkey: string
@@ -8,7 +9,7 @@
const {pubkey, url}: Props = $props()
const aliasDisplay = deriveAliasDisplay(pubkey, url)
const profileDisplay = deriveProfileDisplay(pubkey, removeNil([url]))
</script>
{$aliasDisplay}
{$profileDisplay}