flotilla/src/app/components/RelaySummary.svelte

56 lines
2 KiB
Svelte
Raw Normal View History

2025-09-06 00:20:12 +00:00
<script lang="ts">
2026-07-03 23:36:52 +00:00
import {remove} from "@welshman/lib"
import {pubkey} from "@welshman/app"
2025-09-10 22:26:39 +00:00
import CheckCircle from "@assets/icons/check-circle.svg?dataurl"
2025-09-06 00:20:12 +00:00
import Icon from "@lib/components/Icon.svelte"
import RelayName from "@app/components/RelayName.svelte"
2025-11-12 01:48:24 +00:00
import RelayIcon from "@app/components/RelayIcon.svelte"
2025-09-06 00:20:12 +00:00
import RelayDescription from "@app/components/RelayDescription.svelte"
import ProfileCircles from "@app/components/ProfileCircles.svelte"
import {deriveGroupListPubkeys, deriveUserRooms} from "@app/groups"
2025-09-06 00:20:12 +00:00
type Props = {
url: string
hideFavorites?: boolean
2025-09-06 00:20:12 +00:00
}
const {url, hideFavorites}: Props = $props()
const rooms = deriveUserRooms(url)
2025-12-01 18:26:43 +00:00
const favorited = deriveGroupListPubkeys(url)
2025-09-06 00:20:12 +00:00
</script>
<div class="flex flex-col gap-4 text-left">
<div class="flex flex-col gap-2">
<div class="relative flex gap-2 sm:gap-4">
2025-09-06 00:20:12 +00:00
<div class="relative">
<div class="relative">
2025-09-06 00:20:12 +00:00
<div
class="flex justify-center items-center h-12 w-12 min-w-12 rounded-full border-2 border-solid bg-surface-more border-line">
<RelayIcon {url} size={10} class="rounded-full" />
2025-09-06 00:20:12 +00:00
</div>
</div>
{#if $rooms.includes(url)}
2025-09-06 00:20:12 +00:00
<div
class="tip absolute -right-1 -top-1 h-5 w-5 rounded-full bg-primary text-primary-content"
2025-09-06 00:20:12 +00:00
data-tip="You are already a member of this space.">
2025-09-10 22:26:39 +00:00
<Icon icon={CheckCircle} class="scale-110" />
2025-09-06 00:20:12 +00:00
</div>
{/if}
</div>
2026-04-02 23:47:32 +00:00
<div class="min-w-0">
2026-07-02 21:22:55 +00:00
<RelayName {url} class="truncate whitespace-nowrap text-lg sm:text-xl" />
<p class="text-xs sm:text-sm opacity-75">{url}</p>
2025-09-06 00:20:12 +00:00
</div>
</div>
<div class="text-sm sm:text-md">
<RelayDescription {url} />
</div>
2025-09-06 00:20:12 +00:00
</div>
{#if !hideFavorites && $favorited.size > 0}
<div class="flex gap-2 card card-sm">
2025-12-01 18:26:43 +00:00
Favorited By:
2026-07-03 23:36:52 +00:00
<ProfileCircles pubkeys={remove($pubkey!, Array.from($favorited))} />
2025-09-06 00:20:12 +00:00
</div>
{/if}
</div>