2024-09-24 21:12:38 +00:00
< script lang = "ts" >
2024-10-01 21:55:33 +00:00
import { nip19 } from 'nostr-tools'
import { derived } from 'svelte/store'
import { displayPubkey , getListValues } from "@welshman/util"
import { userFollows , deriveUserWotScore , deriveProfile , deriveHandleForPubkey , displayHandle , deriveProfileDisplay , formatTimestamp , getUserWotScore , followsByPubkey } from "@welshman/app"
import Link from "@lib/components/Link.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"
import { entityLink } from '@app/state'
2024-09-24 21:12:38 +00:00
export let pubkey
2024-10-01 21:55:33 +00:00
const npub = nip19.npubEncode(pubkey)
2024-09-24 21:12:38 +00:00
const profile = deriveProfile(pubkey)
const profileDisplay = deriveProfileDisplay(pubkey)
2024-09-24 23:30:32 +00:00
const handle = deriveHandleForPubkey(pubkey)
2024-10-01 21:55:33 +00:00
const score = deriveUserWotScore(pubkey)
$: following = getListValues("p", $userFollows).includes(pubkey)
2024-09-24 21:12:38 +00:00
< / script >
2024-10-01 21:55:33 +00:00
< div class = "flex gap-3 max-w-full" >
< Link external href = { entityLink ( npub )} class="py-1" >
2024-09-24 21:12:38 +00:00
< Avatar src = { $profile ? . picture } size= { 10 } />
2024-10-01 21:55:33 +00:00
< / Link >
2024-09-24 23:30:32 +00:00
< div class = "flex flex-col min-w-0" >
2024-10-01 21:55:33 +00:00
< div class = "flex gap-2 items-center" >
< Link external class = "text-bold text-ellipsis overflow-hidden" href = { entityLink ( npub )} >
{ $profileDisplay }
< / Link >
< WotScore score = { $score } active= { following } />
2024-09-24 23:30:32 +00:00
< / div >
< div class = "text-sm opacity-75 text-ellipsis overflow-hidden" >
{ $handle ? displayHandle ( $handle ) : displayPubkey ( pubkey )}
< / div >
2024-09-24 21:12:38 +00:00
< / div >
< / div >