Fix discover social proof

This commit is contained in:
Jon Staab
2025-12-01 10:26:43 -08:00
parent bb6e7495f5
commit 6709c91779
4 changed files with 17 additions and 10 deletions
+5 -1
View File
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import {getProfile} from "@welshman/app"
import ProfileCircle from "@app/components/ProfileCircle.svelte" import ProfileCircle from "@app/components/ProfileCircle.svelte"
type Props = { type Props = {
@@ -10,7 +11,10 @@
</script> </script>
<div class="flex pr-3"> <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"> <div class="z-feature -mr-3 inline-block">
<ProfileCircle class="h-8 w-8 bg-base-300" {pubkey} {size} /> <ProfileCircle class="h-8 w-8 bg-base-300" {pubkey} {size} />
</div> </div>
+5 -5
View File
@@ -5,7 +5,7 @@
import RelayIcon from "@app/components/RelayIcon.svelte" import RelayIcon from "@app/components/RelayIcon.svelte"
import RelayDescription from "@app/components/RelayDescription.svelte" import RelayDescription from "@app/components/RelayDescription.svelte"
import ProfileCircles from "@app/components/ProfileCircles.svelte" import ProfileCircles from "@app/components/ProfileCircles.svelte"
import {deriveSpaceMembers, deriveUserRooms} from "@app/core/state" import {deriveGroupListPubkeys, deriveUserRooms} from "@app/core/state"
type Props = { type Props = {
url: string url: string
@@ -13,7 +13,7 @@
const {url}: Props = $props() const {url}: Props = $props()
const rooms = deriveUserRooms(url) const rooms = deriveUserRooms(url)
const members = deriveSpaceMembers(url) const favorited = deriveGroupListPubkeys(url)
</script> </script>
<div class="col-4 text-left"> <div class="col-4 text-left">
@@ -43,10 +43,10 @@
</div> </div>
<RelayDescription {url} /> <RelayDescription {url} />
</div> </div>
{#if $members.length > 0} {#if $favorited.size > 0}
<div class="row-2 card2 card2-sm bg-alt"> <div class="row-2 card2 card2-sm bg-alt">
Members: Favorited By:
<ProfileCircles pubkeys={$members} /> <ProfileCircles pubkeys={Array.from($favorited)} />
</div> </div>
{/if} {/if}
</div> </div>
+4 -1
View File
@@ -565,7 +565,7 @@ export const loadGroupList = makeLoadItem(makeOutboxLoader(ROOMS), getGroupList)
export const deriveGroupList = makeDeriveItem(groupListsByPubkey, loadGroupList) 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>>() const result = new Map<string, Set<string>>()
for (const list of $groupListsByPubkey.values()) { for (const list of $groupListsByPubkey.values()) {
@@ -587,6 +587,9 @@ export const groupListsPubkeysByUrl = derived(groupListsByPubkey, $groupListsByP
return result return result
}) })
export const deriveGroupListPubkeys = (url: string) =>
derived(groupListPubkeysByUrl, $groupListPubkeysByUrl => new Set($groupListPubkeysByUrl.get(url)))
export const getSpaceUrlsFromGroupList = (groupList: List | undefined) => { export const getSpaceUrlsFromGroupList = (groupList: List | undefined) => {
const tags = getListTags(groupList) const tags = getListTags(groupList)
const urls = getRelayTagValues(tags) const urls = getRelayTagValues(tags)
+3 -3
View File
@@ -27,7 +27,7 @@
bootstrapPubkeys, bootstrapPubkeys,
loadGroupList, loadGroupList,
getSpaceUrlsFromGroupList, getSpaceUrlsFromGroupList,
groupListsPubkeysByUrl, groupListPubkeysByUrl,
parseInviteLink, parseInviteLink,
} from "@app/core/state" } from "@app/core/state"
import {pushModal} from "@app/util/modal" import {pushModal} from "@app/util/modal"
@@ -59,13 +59,13 @@
const relaySearch = $derived( const relaySearch = $derived(
createSearch( 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, getValue: (relay: RelayProfile) => relay.url,
sortFn: ({score, item}) => { sortFn: ({score, item}) => {
if (score && score > 0.1) return -score! 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 return score ? dec(score) * wotScore : -wotScore
}, },