Switch to new relays store

This commit is contained in:
Jon Staab
2025-10-24 09:38:57 -07:00
parent e163286dd4
commit 3dff1fcb4d
11 changed files with 53 additions and 45 deletions
+2 -3
View File
@@ -61,7 +61,6 @@
const userRooms = deriveUserRooms(url)
const otherRooms = deriveOtherRooms(url)
const members = deriveSpaceMembers(url)
const owner = $derived($relay?.profile?.pubkey)
const hasAlerts = $derived($alerts.some(a => getTagValue("feed", a.tags)?.includes(url)))
const spaceKinds = derived(
@@ -149,9 +148,9 @@
View Members ({$members.length})
</Button>
</li>
{#if owner}
{#if $relay?.pubkey}
<li>
<Link href={makeChatPath([owner])}>
<Link href={makeChatPath([$relay.pubkey])}>
<Icon icon={Letter} />
Contact Owner
</Link>
+2 -2
View File
@@ -6,6 +6,6 @@
const relay = deriveRelay(props.url)
</script>
{#if $relay?.profile?.description}
<p class={props.class}>{$relay?.profile.description}</p>
{#if $relay?.description}
<p class={props.class}>{$relay.description}</p>
{/if}
+11 -11
View File
@@ -4,13 +4,13 @@
import Link from "@lib/components/Link.svelte"
import {displayUrl} from "@welshman/lib"
import {displayRelayUrl} from "@welshman/util"
import {deriveRelay} from "@welshman/app"
import {deriveRelay, deriveRelayStats} from "@welshman/app"
const {url, children} = $props()
const relay = deriveRelay(url)
const connections = $derived($relay?.stats?.open_count || 0)
const relayStats = deriveRelayStats(url)
const connections = $derived($relayStats?.open_count || 0)
</script>
<div class="card2 card2-sm bg-alt column gap-2">
@@ -21,20 +21,20 @@
</div>
{@render children?.()}
</div>
{#if $relay?.profile?.description}
<p class="ellipsize">{$relay?.profile.description}</p>
{#if $relay?.description}
<p class="ellipsize">{$relay.description}</p>
{/if}
<span class="flex items-center gap-1 whitespace-nowrap text-sm">
{#if $relay?.profile?.contact}
<Link external class="ellipsize underline" href={$relay.profile.contact}
>{displayUrl($relay.profile.contact)}</Link>
{#if $relay?.contact}
<Link external class="ellipsize underline" href={$relay.contact}
>{displayUrl($relay.contact)}</Link>
&bull;
{/if}
{#if Array.isArray($relay?.profile?.supported_nips)}
{#if Array.isArray($relay?.supported_nips)}
<span
class="tooltip cursor-pointer underline"
data-tip="NIPs supported: {$relay.profile.supported_nips.join(', ')}">
{$relay.profile.supported_nips.length} NIPs
data-tip="NIPs supported: {$relay.supported_nips.join(', ')}">
{$relay.supported_nips.length} NIPs
</span>
&bull;
{/if}
+2 -2
View File
@@ -25,8 +25,8 @@
<div class="avatar relative">
<div
class="center !flex h-12 w-12 min-w-12 rounded-full border-2 border-solid border-base-300 bg-base-300">
{#if $relay?.profile?.icon}
<img alt="" src={$relay.profile.icon} />
{#if $relay?.icon}
<img alt="" src={$relay.icon} />
{:else}
<Icon icon={Ghost} size={5} />
{/if}
+1 -1
View File
@@ -17,4 +17,4 @@
icon={RemoteControllerMinimalistic}
class="!h-10 !w-10"
alt={displayRelayUrl(url)}
src={$relay?.profile?.icon} />
src={$relay?.icon} />
+8 -8
View File
@@ -19,7 +19,7 @@
const {url}: Props = $props()
const relay = deriveRelay(url)
const owner = $derived($relay?.profile?.pubkey)
const owner = $derived($relay?.pubkey)
const back = () => history.back()
</script>
@@ -30,8 +30,8 @@
<div class="avatar relative">
<div
class="center !flex h-16 w-16 min-w-16 rounded-full border-2 border-solid border-base-300 bg-base-300">
{#if $relay?.profile?.icon}
<img alt="" src={$relay.profile.icon} />
{#if $relay?.icon}
<img alt="" src={$relay.icon} />
{:else}
<Icon icon={Ghost} size={6} />
{/if}
@@ -46,16 +46,16 @@
</div>
</div>
<RelayDescription {url} />
{#if $relay?.profile?.terms_of_service || $relay?.profile?.privacy_policy}
{#if $relay?.terms_of_service || $relay?.privacy_policy}
<div class="flex gap-3">
{#if $relay.profile.terms_of_service}
<Link href={$relay.profile.terms_of_service} class="badge badge-neutral flex gap-2">
{#if $relay.terms_of_service}
<Link href={$relay.terms_of_service} class="badge badge-neutral flex gap-2">
<Icon icon={BillList} size={4} />
Terms of Service
</Link>
{/if}
{#if $relay.profile.privacy_policy}
<Link href={$relay?.profile?.privacy_policy} class="badge badge-neutral flex gap-2">
{#if $relay.privacy_policy}
<Link href={$relay.privacy_policy} class="badge badge-neutral flex gap-2">
<Icon icon={ShieldUser} size={4} />
Privacy Policy
</Link>
+6 -7
View File
@@ -12,7 +12,6 @@
const {url}: Props = $props()
const relay = deriveRelay(url)
const owner = $derived($relay?.profile?.pubkey)
</script>
<div class="card2 bg-alt flex flex-col gap-4">
@@ -23,17 +22,17 @@
</h3>
<SocketStatusIndicator {url} />
</div>
{#if $relay?.profile}
{@const {software, version, supported_nips, limitation} = $relay.profile}
{#if $relay}
{@const {pubkey, software, version, supported_nips, limitation} = $relay}
<div class="flex flex-wrap gap-1">
{#if owner}
{#if pubkey}
<div class="badge badge-neutral">
<span class="ellipsize">Administrator: <ProfileLink unstyled pubkey={owner} /></span>
<span class="ellipsize">Administrator: <ProfileLink unstyled {pubkey} /></span>
</div>
{/if}
{#if $relay?.profile?.contact}
{#if $relay?.contact}
<div class="badge badge-neutral">
<span class="ellipsize">Contact: {$relay.profile.contact}</span>
<span class="ellipsize">Contact: {$relay.contact}</span>
</div>
{/if}
{#if software}