Re-work relays page

This commit is contained in:
Jon Staab
2024-10-03 11:49:52 -07:00
parent 9834a31511
commit 73a9b46f91
12 changed files with 259 additions and 91 deletions
+40
View File
@@ -0,0 +1,40 @@
<script lang="ts">
import Icon from "@lib/components/Icon.svelte"
import Link from "@lib/components/Link.svelte"
import {displayUrl} from '@welshman/lib'
import {displayRelayUrl} from '@welshman/util'
import {deriveRelay} from '@welshman/app'
export let url
const relay = deriveRelay(url)
$: connections = $relay?.stats?.connect_count || 0
</script>
<div class="card2 card2-sm bg-alt column gap-2">
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<Icon icon="remote-controller-minimalistic" />
{displayRelayUrl(url)}
</div>
<slot />
</div>
{#if $relay?.profile?.description}
<p>{$relay?.profile.description}</p>
{/if}
<span class="flex items-center gap-1 text-sm">
{#if $relay?.profile?.contact}
<Link external class="underline" href={$relay.profile.contact}
>{displayUrl($relay.profile.contact)}</Link>
&bull;
{/if}
{#if $relay?.profile?.supported_nips}
<span class="cursor-pointer underline tooltip" data-tip="NIPs supported: {$relay.profile.supported_nips.join(", ")}">
{$relay.profile.supported_nips.length} NIPs
</span>
&bull;
{/if}
Connected {connections} {connections === 1 ? 'time' : 'times'}
</span>
</div>