2024-10-03 18:49:52 +00:00
|
|
|
<script lang="ts">
|
2025-09-10 22:26:39 +00:00
|
|
|
import Server from "@assets/icons/server.svg?dataurl"
|
2024-10-03 18:49:52 +00:00
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
2026-06-24 20:56:53 +00:00
|
|
|
import Card from "@lib/components/Card.svelte"
|
2024-10-03 18:49:52 +00:00
|
|
|
import Link from "@lib/components/Link.svelte"
|
2024-10-08 18:39:16 +00:00
|
|
|
import {displayUrl} from "@welshman/lib"
|
|
|
|
|
import {displayRelayUrl} from "@welshman/util"
|
2025-10-24 16:38:57 +00:00
|
|
|
import {deriveRelay, deriveRelayStats} from "@welshman/app"
|
2024-10-03 18:49:52 +00:00
|
|
|
|
2025-02-04 01:21:46 +00:00
|
|
|
const {url, children} = $props()
|
2024-10-03 18:49:52 +00:00
|
|
|
|
|
|
|
|
const relay = deriveRelay(url)
|
2025-10-24 16:38:57 +00:00
|
|
|
const relayStats = deriveRelayStats(url)
|
|
|
|
|
const connections = $derived($relayStats?.open_count || 0)
|
2024-10-03 18:49:52 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-06-24 20:56:53 +00:00
|
|
|
<Card sm class="flex flex-colap-2">
|
2024-10-15 19:02:11 +00:00
|
|
|
<div class="flex items-center justify-between gap-4">
|
|
|
|
|
<div class="ellipsize flex items-center gap-2">
|
2025-09-10 22:26:39 +00:00
|
|
|
<Icon icon={Server} />
|
2024-10-14 19:55:08 +00:00
|
|
|
<p class="ellipsize">{displayRelayUrl(url)}</p>
|
2024-10-03 18:49:52 +00:00
|
|
|
</div>
|
2025-02-04 00:37:14 +00:00
|
|
|
{@render children?.()}
|
2024-10-03 18:49:52 +00:00
|
|
|
</div>
|
2025-10-24 16:38:57 +00:00
|
|
|
{#if $relay?.description}
|
|
|
|
|
<p class="ellipsize">{$relay.description}</p>
|
2024-10-03 18:49:52 +00:00
|
|
|
{/if}
|
2024-10-15 19:02:11 +00:00
|
|
|
<span class="flex items-center gap-1 whitespace-nowrap text-sm">
|
2025-10-24 16:38:57 +00:00
|
|
|
{#if $relay?.contact}
|
|
|
|
|
<Link external class="ellipsize underline" href={$relay.contact}
|
|
|
|
|
>{displayUrl($relay.contact)}</Link>
|
2024-10-03 18:49:52 +00:00
|
|
|
•
|
|
|
|
|
{/if}
|
2025-10-24 16:38:57 +00:00
|
|
|
{#if Array.isArray($relay?.supported_nips)}
|
2024-10-08 18:39:16 +00:00
|
|
|
<span
|
2026-06-24 20:56:53 +00:00
|
|
|
class="tip cursor-pointer underline"
|
2025-10-24 16:38:57 +00:00
|
|
|
data-tip="NIPs supported: {$relay.supported_nips.join(', ')}">
|
|
|
|
|
{$relay.supported_nips.length} NIPs
|
2024-10-03 18:49:52 +00:00
|
|
|
</span>
|
|
|
|
|
•
|
|
|
|
|
{/if}
|
2024-10-08 18:39:16 +00:00
|
|
|
Connected {connections}
|
|
|
|
|
{connections === 1 ? "time" : "times"}
|
2024-10-03 18:49:52 +00:00
|
|
|
</span>
|
2026-06-24 20:56:53 +00:00
|
|
|
</Card>
|