2025-11-10 22:59:15 +00:00
|
|
|
<script lang="ts">
|
2026-07-03 16:20:45 +00:00
|
|
|
import {displayRelayUrl} from "@welshman/util"
|
2025-11-10 22:59:15 +00:00
|
|
|
import AltArrowLeft from "@assets/icons/alt-arrow-left.svg?dataurl"
|
2026-07-20 23:35:24 +00:00
|
|
|
import LinkRound from "@assets/icons/link-round.svg?dataurl"
|
2025-11-10 22:59:15 +00:00
|
|
|
import EyeClosed from "@assets/icons/eye-closed.svg?dataurl"
|
2026-02-12 00:44:51 +00:00
|
|
|
import Eye from "@assets/icons/eye.svg?dataurl"
|
2025-11-10 22:59:15 +00:00
|
|
|
import MinusCircle from "@assets/icons/minus-circle.svg?dataurl"
|
|
|
|
|
import Lock from "@assets/icons/lock.svg?dataurl"
|
|
|
|
|
import Microphone from "@assets/icons/microphone.svg?dataurl"
|
2026-01-30 16:41:58 +00:00
|
|
|
import Bookmark from "@assets/icons/bookmark.svg?dataurl"
|
2026-03-16 20:38:05 +00:00
|
|
|
import Bell from "@assets/icons/bell.svg?dataurl"
|
2025-11-10 22:59:15 +00:00
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
|
|
|
import Button from "@lib/components/Button.svelte"
|
2026-07-03 16:20:45 +00:00
|
|
|
import MenuButton from "@lib/components/MenuButton.svelte"
|
2026-04-06 16:14:08 +00:00
|
|
|
import Tooltip from "@lib/components/Tooltip.svelte"
|
2026-01-30 22:14:12 +00:00
|
|
|
import Modal from "@lib/components/Modal.svelte"
|
|
|
|
|
import ModalBody from "@lib/components/ModalBody.svelte"
|
2025-11-10 22:59:15 +00:00
|
|
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
|
|
|
|
import ProfileCircles from "@app/components/ProfileCircles.svelte"
|
2025-11-13 21:25:34 +00:00
|
|
|
import RoomMembers from "@app/components/RoomMembers.svelte"
|
2026-07-03 16:20:45 +00:00
|
|
|
import RoomDetailMenu from "@app/components/RoomDetailMenu.svelte"
|
2026-07-20 23:35:24 +00:00
|
|
|
import RoomInvite from "@app/components/RoomInvite.svelte"
|
2025-11-10 22:59:15 +00:00
|
|
|
import RoomName from "@app/components/RoomName.svelte"
|
|
|
|
|
import RoomImage from "@app/components/RoomImage.svelte"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {deriveRoom, deriveUserRooms, addRoom, removeRoom} from "@app/groups"
|
2026-07-20 23:35:24 +00:00
|
|
|
import {deriveRoomMembers, deriveUserIsRoomAdmin} from "@app/members"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {deriveShouldNotify, toggleRoomNotifications} from "@app/settings"
|
2026-06-08 21:14:40 +00:00
|
|
|
import {pushModal} from "@app/modal"
|
2025-11-10 22:59:15 +00:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
url: string
|
|
|
|
|
h: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {url, h}: Props = $props()
|
|
|
|
|
|
|
|
|
|
const room = deriveRoom(url, h)
|
|
|
|
|
const members = deriveRoomMembers(url, h)
|
2026-01-30 16:41:58 +00:00
|
|
|
const userRooms = deriveUserRooms(url)
|
2026-07-20 23:35:24 +00:00
|
|
|
const userIsAdmin = deriveUserIsRoomAdmin(url, h)
|
2026-01-30 16:41:58 +00:00
|
|
|
|
|
|
|
|
const isFavorite = $derived($userRooms.includes(h))
|
2026-02-02 22:29:12 +00:00
|
|
|
const shouldNotify = deriveShouldNotify(url, h)
|
2025-11-10 22:59:15 +00:00
|
|
|
|
|
|
|
|
const back = () => history.back()
|
|
|
|
|
|
2025-11-13 21:25:34 +00:00
|
|
|
const showMembers = () => pushModal(RoomMembers, {url, h})
|
2025-11-10 22:59:15 +00:00
|
|
|
|
2026-07-20 23:35:24 +00:00
|
|
|
const createInvite = () => pushModal(RoomInvite, {url, h})
|
|
|
|
|
|
2026-01-30 16:41:58 +00:00
|
|
|
const toggleFavorite = () => {
|
|
|
|
|
if (isFavorite) {
|
2026-06-08 22:33:38 +00:00
|
|
|
removeRoom(url, h)
|
2026-01-30 16:41:58 +00:00
|
|
|
} else {
|
2026-06-08 22:33:38 +00:00
|
|
|
addRoom(url, h)
|
2026-01-30 16:41:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-02 22:29:12 +00:00
|
|
|
const toggleShouldNotify = () => {
|
2026-01-30 16:41:58 +00:00
|
|
|
toggleRoomNotifications(url, h)
|
|
|
|
|
}
|
2025-11-10 22:59:15 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-01-30 22:14:12 +00:00
|
|
|
<Modal>
|
|
|
|
|
<ModalBody>
|
|
|
|
|
<div class="flex justify-between">
|
|
|
|
|
<div class="flex gap-3">
|
|
|
|
|
<div class="pt-0.5">
|
|
|
|
|
<RoomImage {url} {h} size={8} />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex min-w-0 flex-col">
|
|
|
|
|
<RoomName {url} {h} class="text-2xl" />
|
|
|
|
|
<span class="text-primary">{displayRelayUrl(url)}</span>
|
|
|
|
|
</div>
|
2026-01-30 16:41:58 +00:00
|
|
|
</div>
|
2026-07-03 16:20:45 +00:00
|
|
|
<MenuButton component={RoomDetailMenu} componentProps={{url, h}} />
|
2026-02-10 19:39:29 +00:00
|
|
|
</div>
|
2026-02-12 00:44:51 +00:00
|
|
|
{#if $room?.about}
|
|
|
|
|
<p>{$room.about}</p>
|
|
|
|
|
{/if}
|
2026-06-24 20:56:53 +00:00
|
|
|
<div class="flex flex-col gap-2 card card-sm">
|
2026-02-10 19:39:29 +00:00
|
|
|
<strong class="text-lg">Room Permissions</strong>
|
|
|
|
|
<div class="flex gap-2 flex-wrap">
|
2026-01-30 22:14:12 +00:00
|
|
|
{#if $room?.isRestricted}
|
2026-04-06 16:14:08 +00:00
|
|
|
<Tooltip content="Only members can send messages.">
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral button-xs button-pill flex gap-2 items-center">
|
2026-04-06 16:14:08 +00:00
|
|
|
<Icon size={4} icon={Microphone} /> Restricted
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
2026-01-30 22:14:12 +00:00
|
|
|
{/if}
|
|
|
|
|
{#if $room?.isPrivate}
|
2026-04-06 16:14:08 +00:00
|
|
|
<Tooltip content="Only members can view messages.">
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral button-xs button-pill flex gap-2 items-center">
|
2026-04-06 16:14:08 +00:00
|
|
|
<Icon size={4} icon={Lock} /> Private
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
2026-01-30 22:14:12 +00:00
|
|
|
{/if}
|
|
|
|
|
{#if $room?.isHidden}
|
2026-04-06 16:14:08 +00:00
|
|
|
<Tooltip content="This room is not visible to non-members.">
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral button-xs button-pill flex gap-2 items-center">
|
2026-04-06 16:14:08 +00:00
|
|
|
<Icon size={4} icon={EyeClosed} /> Hidden
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
2026-01-30 22:14:12 +00:00
|
|
|
{/if}
|
|
|
|
|
{#if $room?.isClosed}
|
2026-04-06 16:14:08 +00:00
|
|
|
<Tooltip content="Requests to join this room will be ignored.">
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral button-xs button-pill flex gap-2 items-center">
|
2026-04-06 16:14:08 +00:00
|
|
|
<Icon size={4} icon={MinusCircle} /> Closed
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
2026-02-10 19:39:29 +00:00
|
|
|
{/if}
|
|
|
|
|
{#if !$room?.isRestricted && !$room?.isPrivate && !$room?.isHidden && !$room?.isClosed}
|
2026-04-06 16:14:08 +00:00
|
|
|
<Tooltip content="This room has no additional access controls.">
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral button-xs button-pill flex gap-2 items-center">
|
2026-04-06 16:14:08 +00:00
|
|
|
<Icon size={4} icon={Eye} /> Public
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
2026-01-30 22:14:12 +00:00
|
|
|
{/if}
|
2025-11-10 22:59:15 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-04-13 21:12:49 +00:00
|
|
|
{#if $members !== undefined && $members.length > 0}
|
2026-07-20 23:35:24 +00:00
|
|
|
<div class="card card-sm flex flex-col gap-3">
|
|
|
|
|
<div class="flex items-center justify-between gap-4">
|
|
|
|
|
<div class="flex min-w-0 items-center gap-4">
|
|
|
|
|
<span class="shrink-0">Members:</span>
|
|
|
|
|
<ProfileCircles pubkeys={$members} class="min-w-0 overflow-hidden" />
|
|
|
|
|
</div>
|
|
|
|
|
<Button class="button button-neutral button-sm shrink-0" onclick={showMembers}
|
|
|
|
|
>View All</Button>
|
2026-01-30 22:14:12 +00:00
|
|
|
</div>
|
2026-07-20 23:35:24 +00:00
|
|
|
{#if $userIsAdmin}
|
|
|
|
|
<Button class="button button-neutral" onclick={createInvite}>
|
|
|
|
|
<Icon icon={LinkRound} />
|
|
|
|
|
Create invite
|
|
|
|
|
</Button>
|
|
|
|
|
{/if}
|
2025-11-13 21:25:34 +00:00
|
|
|
</div>
|
2026-04-13 21:12:49 +00:00
|
|
|
{:else if $members === undefined}
|
2026-06-24 20:56:53 +00:00
|
|
|
<div class="card card-sm bg-surface flex items-center gap-4">
|
2026-04-13 21:12:49 +00:00
|
|
|
<span class="text-error">Member list not available from this relay</span>
|
|
|
|
|
</div>
|
2026-01-30 22:14:12 +00:00
|
|
|
{/if}
|
2026-06-24 20:56:53 +00:00
|
|
|
<div class="card card-sm flex flex-col gap-4">
|
2026-01-30 22:14:12 +00:00
|
|
|
<strong class="text-lg">Room Settings</strong>
|
|
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
|
<div class="flex items-center gap-2">
|
2026-03-16 20:38:05 +00:00
|
|
|
<Icon icon={Bell} />
|
2026-01-30 22:14:12 +00:00
|
|
|
<span>Notifications</span>
|
|
|
|
|
</div>
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
2026-06-24 20:56:53 +00:00
|
|
|
class="toggle"
|
2026-02-02 22:29:12 +00:00
|
|
|
checked={$shouldNotify}
|
|
|
|
|
onchange={toggleShouldNotify} />
|
2026-01-30 16:41:58 +00:00
|
|
|
</div>
|
2026-01-30 22:14:12 +00:00
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
<Icon icon={Bookmark} />
|
|
|
|
|
<span>Favorite</span>
|
|
|
|
|
</div>
|
2026-06-24 20:56:53 +00:00
|
|
|
<input type="checkbox" class="toggle" checked={isFavorite} onchange={toggleFavorite} />
|
2026-01-30 16:41:58 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-01-30 22:14:12 +00:00
|
|
|
</ModalBody>
|
2025-11-10 22:59:15 +00:00
|
|
|
<ModalFooter>
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-link" onclick={back}>
|
2025-11-10 22:59:15 +00:00
|
|
|
<Icon icon={AltArrowLeft} />
|
|
|
|
|
Go back
|
|
|
|
|
</Button>
|
|
|
|
|
</ModalFooter>
|
2026-01-30 22:14:12 +00:00
|
|
|
</Modal>
|