2024-09-23 20:10:15 +00:00
|
|
|
<script lang="ts">
|
2024-11-14 16:33:11 +00:00
|
|
|
import {onMount} from "svelte"
|
2024-09-23 20:10:15 +00:00
|
|
|
import {page} from "$app/stores"
|
2024-10-31 19:24:40 +00:00
|
|
|
import {deriveRelay} from "@welshman/app"
|
2024-09-23 20:10:15 +00:00
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
2024-10-31 19:24:40 +00:00
|
|
|
import Link from "@lib/components/Link.svelte"
|
2024-09-23 20:10:15 +00:00
|
|
|
import Button from "@lib/components/Button.svelte"
|
2024-10-31 19:24:40 +00:00
|
|
|
import Divider from "@lib/components/Divider.svelte"
|
2024-10-09 23:11:23 +00:00
|
|
|
import PageBar from "@lib/components/PageBar.svelte"
|
2024-10-23 16:45:06 +00:00
|
|
|
import MenuSpace from "@app/components/MenuSpace.svelte"
|
2024-10-31 19:24:40 +00:00
|
|
|
import ProfileFeed from "@app/components/ProfileFeed.svelte"
|
|
|
|
|
import RelayName from "@app/components/RelayName.svelte"
|
|
|
|
|
import RelayDescription from "@app/components/RelayDescription.svelte"
|
2024-11-14 16:33:11 +00:00
|
|
|
import {decodeRelay, setChecked} from "@app/state"
|
2024-10-31 19:24:40 +00:00
|
|
|
import {pushDrawer} from "@app/modal"
|
|
|
|
|
import {makeChatPath} from "@app/routes"
|
2024-09-23 20:10:15 +00:00
|
|
|
|
2024-10-21 17:30:12 +00:00
|
|
|
const url = decodeRelay($page.params.relay)
|
2024-10-31 19:24:40 +00:00
|
|
|
const relay = deriveRelay(url)
|
2024-09-23 20:10:15 +00:00
|
|
|
|
2024-10-23 16:45:06 +00:00
|
|
|
const openMenu = () => pushDrawer(MenuSpace, {url})
|
|
|
|
|
|
2024-10-31 19:24:40 +00:00
|
|
|
$: pubkey = $relay?.profile?.pubkey
|
2024-11-14 16:33:11 +00:00
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
setChecked($page.url.pathname)
|
|
|
|
|
})
|
2024-09-23 20:10:15 +00:00
|
|
|
</script>
|
|
|
|
|
|
2024-10-31 19:24:40 +00:00
|
|
|
<div class="relative flex flex-col">
|
2024-10-09 23:11:23 +00:00
|
|
|
<PageBar>
|
|
|
|
|
<div slot="icon" class="center">
|
2024-10-31 19:24:40 +00:00
|
|
|
<Icon icon="home-smile" />
|
2024-09-23 20:10:15 +00:00
|
|
|
</div>
|
2024-10-31 19:24:40 +00:00
|
|
|
<strong slot="title">Home</strong>
|
2024-10-23 21:20:24 +00:00
|
|
|
<div slot="action" class="row-2">
|
2024-10-31 19:24:40 +00:00
|
|
|
{#if pubkey}
|
|
|
|
|
<Link class="btn btn-primary btn-sm" href={makeChatPath([pubkey])}>
|
|
|
|
|
<Icon icon="letter" />
|
|
|
|
|
Contact Owner
|
|
|
|
|
</Link>
|
|
|
|
|
{/if}
|
2024-10-23 21:20:24 +00:00
|
|
|
<Button on:click={openMenu} class="btn btn-neutral btn-sm md:hidden">
|
2024-10-23 16:45:06 +00:00
|
|
|
<Icon icon="menu-dots" />
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2024-10-09 23:11:23 +00:00
|
|
|
</PageBar>
|
2024-11-01 22:08:27 +00:00
|
|
|
<div class="col-2 p-2">
|
|
|
|
|
<div class="card2 bg-alt col-4 text-left">
|
|
|
|
|
<div class="relative flex gap-4">
|
|
|
|
|
<div class="relative">
|
|
|
|
|
<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} />
|
|
|
|
|
{:else}
|
|
|
|
|
<Icon icon="ghost" size={5} />
|
|
|
|
|
{/if}
|
2024-10-31 19:24:40 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-11-01 22:08:27 +00:00
|
|
|
<div>
|
|
|
|
|
<h2 class="ellipsize whitespace-nowrap text-xl">
|
|
|
|
|
<RelayName {url} />
|
|
|
|
|
</h2>
|
|
|
|
|
<p class="text-sm opacity-75">{url}</p>
|
|
|
|
|
</div>
|
2024-10-31 19:24:40 +00:00
|
|
|
</div>
|
2024-11-01 22:08:27 +00:00
|
|
|
<RelayDescription {url} />
|
|
|
|
|
{#if $relay?.profile}
|
|
|
|
|
{@const {software, version, supported_nips, limitation} = $relay.profile}
|
|
|
|
|
<div class="flex flex-wrap gap-1">
|
|
|
|
|
{#if limitation?.auth_required}
|
|
|
|
|
<p class="badge badge-neutral">Authentication Required</p>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if limitation?.payment_required}
|
|
|
|
|
<p class="badge badge-neutral">Payment Required</p>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if limitation?.min_pow_difficulty}
|
|
|
|
|
<p class="badge badge-neutral">Requires PoW {limitation?.min_pow_difficulty}</p>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if supported_nips}
|
|
|
|
|
<p class="badge badge-neutral">NIPs: {supported_nips.join(", ")}</p>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if software}
|
|
|
|
|
<p class="badge badge-neutral">Software: {software}</p>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if version}
|
|
|
|
|
<p class="badge badge-neutral">Version: {version}</p>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
{#if pubkey}
|
2024-10-31 19:24:40 +00:00
|
|
|
<Divider>Recent posts from the relay admin</Divider>
|
|
|
|
|
<ProfileFeed {url} {pubkey} />
|
2024-11-01 22:08:27 +00:00
|
|
|
{/if}
|
|
|
|
|
</div>
|
2024-09-23 20:10:15 +00:00
|
|
|
</div>
|