Fix discover social proof
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import {getProfile} from "@welshman/app"
|
||||
import ProfileCircle from "@app/components/ProfileCircle.svelte"
|
||||
|
||||
type Props = {
|
||||
@@ -10,7 +11,10 @@
|
||||
</script>
|
||||
|
||||
<div class="flex pr-3">
|
||||
{#each pubkeys.toSorted().slice(0, 15) as pubkey (pubkey)}
|
||||
{#each pubkeys
|
||||
.filter(p => getProfile(p)?.picture)
|
||||
.toSorted()
|
||||
.slice(0, 15) as pubkey (pubkey)}
|
||||
<div class="z-feature -mr-3 inline-block">
|
||||
<ProfileCircle class="h-8 w-8 bg-base-300" {pubkey} {size} />
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import RelayIcon from "@app/components/RelayIcon.svelte"
|
||||
import RelayDescription from "@app/components/RelayDescription.svelte"
|
||||
import ProfileCircles from "@app/components/ProfileCircles.svelte"
|
||||
import {deriveSpaceMembers, deriveUserRooms} from "@app/core/state"
|
||||
import {deriveGroupListPubkeys, deriveUserRooms} from "@app/core/state"
|
||||
|
||||
type Props = {
|
||||
url: string
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
const {url}: Props = $props()
|
||||
const rooms = deriveUserRooms(url)
|
||||
const members = deriveSpaceMembers(url)
|
||||
const favorited = deriveGroupListPubkeys(url)
|
||||
</script>
|
||||
|
||||
<div class="col-4 text-left">
|
||||
@@ -43,10 +43,10 @@
|
||||
</div>
|
||||
<RelayDescription {url} />
|
||||
</div>
|
||||
{#if $members.length > 0}
|
||||
{#if $favorited.size > 0}
|
||||
<div class="row-2 card2 card2-sm bg-alt">
|
||||
Members:
|
||||
<ProfileCircles pubkeys={$members} />
|
||||
Favorited By:
|
||||
<ProfileCircles pubkeys={Array.from($favorited)} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -565,7 +565,7 @@ export const loadGroupList = makeLoadItem(makeOutboxLoader(ROOMS), getGroupList)
|
||||
|
||||
export const deriveGroupList = makeDeriveItem(groupListsByPubkey, loadGroupList)
|
||||
|
||||
export const groupListsPubkeysByUrl = derived(groupListsByPubkey, $groupListsByPubkey => {
|
||||
export const groupListPubkeysByUrl = derived(groupListsByPubkey, $groupListsByPubkey => {
|
||||
const result = new Map<string, Set<string>>()
|
||||
|
||||
for (const list of $groupListsByPubkey.values()) {
|
||||
@@ -587,6 +587,9 @@ export const groupListsPubkeysByUrl = derived(groupListsByPubkey, $groupListsByP
|
||||
return result
|
||||
})
|
||||
|
||||
export const deriveGroupListPubkeys = (url: string) =>
|
||||
derived(groupListPubkeysByUrl, $groupListPubkeysByUrl => new Set($groupListPubkeysByUrl.get(url)))
|
||||
|
||||
export const getSpaceUrlsFromGroupList = (groupList: List | undefined) => {
|
||||
const tags = getListTags(groupList)
|
||||
const urls = getRelayTagValues(tags)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
bootstrapPubkeys,
|
||||
loadGroupList,
|
||||
getSpaceUrlsFromGroupList,
|
||||
groupListsPubkeysByUrl,
|
||||
groupListPubkeysByUrl,
|
||||
parseInviteLink,
|
||||
} from "@app/core/state"
|
||||
import {pushModal} from "@app/util/modal"
|
||||
@@ -59,13 +59,13 @@
|
||||
|
||||
const relaySearch = $derived(
|
||||
createSearch(
|
||||
$relays.filter(r => $groupListsPubkeysByUrl.has(r.url) && r.url !== inviteData?.url),
|
||||
$relays.filter(r => $groupListPubkeysByUrl.has(r.url) && r.url !== inviteData?.url),
|
||||
{
|
||||
getValue: (relay: RelayProfile) => relay.url,
|
||||
sortFn: ({score, item}) => {
|
||||
if (score && score > 0.1) return -score!
|
||||
|
||||
const wotScore = $groupListsPubkeysByUrl.get(item.url)!.size
|
||||
const wotScore = $groupListPubkeysByUrl.get(item.url)!.size
|
||||
|
||||
return score ? dec(score) * wotScore : -wotScore
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user