2024-09-24 21:12:38 +00:00
|
|
|
<script lang="ts">
|
2024-10-08 18:39:16 +00:00
|
|
|
import {displayPubkey, getPubkeyTagValues, getListTags} from "@welshman/util"
|
|
|
|
|
import {
|
2024-10-23 21:20:24 +00:00
|
|
|
session,
|
2024-10-08 18:39:16 +00:00
|
|
|
userFollows,
|
|
|
|
|
deriveUserWotScore,
|
|
|
|
|
deriveHandleForPubkey,
|
|
|
|
|
displayHandle,
|
|
|
|
|
} from "@welshman/app"
|
2024-12-16 20:54:17 +00:00
|
|
|
import Button from "@lib/components/Button.svelte"
|
2024-09-24 21:12:38 +00:00
|
|
|
import Avatar from "@lib/components/Avatar.svelte"
|
2024-10-01 21:55:33 +00:00
|
|
|
import WotScore from "@lib/components/WotScore.svelte"
|
2024-12-16 20:54:17 +00:00
|
|
|
import ProfileDetail from "@app/components/ProfileDetail.svelte"
|
|
|
|
|
import {pushModal} from "@app/modal"
|
2025-04-15 22:45:48 +00:00
|
|
|
import {deriveAliasedProfile, deriveAliasDisplay} from "@app/state"
|
2024-09-24 21:12:38 +00:00
|
|
|
|
2025-04-15 18:03:27 +00:00
|
|
|
type Props = {
|
|
|
|
|
pubkey: string
|
|
|
|
|
url?: string
|
|
|
|
|
}
|
2024-09-24 21:12:38 +00:00
|
|
|
|
2025-04-15 18:03:27 +00:00
|
|
|
const {pubkey, url}: Props = $props()
|
|
|
|
|
|
2025-04-15 22:45:48 +00:00
|
|
|
const profile = deriveAliasedProfile(pubkey, url)
|
2025-04-15 18:03:27 +00:00
|
|
|
const aliasDisplay = deriveAliasDisplay(pubkey, url)
|
2024-09-24 23:30:32 +00:00
|
|
|
const handle = deriveHandleForPubkey(pubkey)
|
2024-10-01 21:55:33 +00:00
|
|
|
const score = deriveUserWotScore(pubkey)
|
2024-10-09 19:45:13 +00:00
|
|
|
|
2025-04-15 18:03:27 +00:00
|
|
|
const openProfile = () => pushModal(ProfileDetail, {pubkey, url})
|
2024-12-16 20:54:17 +00:00
|
|
|
|
2025-02-04 01:21:46 +00:00
|
|
|
const following = $derived(
|
2025-02-04 00:37:14 +00:00
|
|
|
pubkey === $session!.pubkey || getPubkeyTagValues(getListTags($userFollows)).includes(pubkey),
|
|
|
|
|
)
|
2024-09-24 21:12:38 +00:00
|
|
|
</script>
|
|
|
|
|
|
2024-10-08 18:39:16 +00:00
|
|
|
<div class="flex max-w-full gap-3">
|
2025-02-04 01:21:46 +00:00
|
|
|
<Button onclick={openProfile} class="py-1">
|
2025-04-15 22:45:48 +00:00
|
|
|
<Avatar src={$profile?.picture} size={10} />
|
2024-12-16 20:54:17 +00:00
|
|
|
</Button>
|
2024-10-08 18:39:16 +00:00
|
|
|
<div class="flex min-w-0 flex-col">
|
|
|
|
|
<div class="flex items-center gap-2">
|
2025-02-04 01:21:46 +00:00
|
|
|
<Button onclick={openProfile} class="text-bold overflow-hidden text-ellipsis">
|
2025-04-15 18:03:27 +00:00
|
|
|
{$aliasDisplay}
|
2024-12-16 20:54:17 +00:00
|
|
|
</Button>
|
2024-10-01 21:55:33 +00:00
|
|
|
<WotScore score={$score} active={following} />
|
2024-09-24 23:30:32 +00:00
|
|
|
</div>
|
2024-10-08 18:39:16 +00:00
|
|
|
<div class="overflow-hidden text-ellipsis text-sm opacity-75">
|
2024-09-24 23:30:32 +00:00
|
|
|
{$handle ? displayHandle($handle) : displayPubkey(pubkey)}
|
|
|
|
|
</div>
|
2024-09-24 21:12:38 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|