From 89c269025481c4510b52fe887efd5da3e03d0b62 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Wed, 4 Jun 2025 13:52:00 -0700 Subject: [PATCH] Add new room dashboard layout --- src/routes/spaces/[relay]/+page.svelte | 308 ++++++++++++++++--------- 1 file changed, 197 insertions(+), 111 deletions(-) diff --git a/src/routes/spaces/[relay]/+page.svelte b/src/routes/spaces/[relay]/+page.svelte index fe546dc7..4f0c383c 100644 --- a/src/routes/spaces/[relay]/+page.svelte +++ b/src/routes/spaces/[relay]/+page.svelte @@ -7,7 +7,6 @@ import Icon from "@lib/components/Icon.svelte" import Link from "@lib/components/Link.svelte" import Button from "@lib/components/Button.svelte" - import Divider from "@lib/components/Divider.svelte" import PageBar from "@lib/components/PageBar.svelte" import PageContent from "@lib/components/PageContent.svelte" import MenuSpaceButton from "@app/components/MenuSpaceButton.svelte" @@ -42,8 +41,22 @@ const addRoom = () => pushModal(RoomCreate, {url}) let relayAdminEvents: TrustedEvent[] = $state([]) + let roomSearchQuery = $state("") const pubkey = $derived($relay?.profile?.pubkey) + + const filteredRooms = $derived(() => { + if (!roomSearchQuery) return [...$userRooms, ...$otherRooms] + + const query = roomSearchQuery.toLowerCase() + const allRooms = [...$userRooms, ...$otherRooms] + + return allRooms.filter(room => { + const channel = $channelsById.get(makeChannelId(url, room)) + const roomName = channel?.name || room + return roomName.toLowerCase().includes(query) + }) + }) @@ -73,129 +86,202 @@ {/snippet} - -
+ +
+ class="center !flex h-16 w-16 min-w-16 rounded-full border-2 border-solid border-base-300 bg-base-300"> {#if $relay?.profile?.icon} {:else} - + {/if}
-
-

+
+

-

-

{displayRelayUrl(url)}

+

+

{displayRelayUrl(url)}

+ {#if $relay?.profile?.pubkey} +

+ + Relay Admin: {$relay.profile.pubkey.slice(0, 8)}...{$relay.profile.pubkey.slice(-8)} +

+ {/if}
- - {#if $relay?.profile} - {@const {software, version, supported_nips, limitation} = $relay.profile} -
- {#if limitation?.auth_required} -

- Authentication Required -

- {/if} - {#if limitation?.payment_required} -

Payment Required

- {/if} - {#if limitation?.min_pow_difficulty} -

- Requires PoW {limitation?.min_pow_difficulty} -

- {/if} - {#if Array.isArray(supported_nips)} -

- NIPs: {supported_nips.join(", ")} -

- {/if} - {#if software} -

Software: {software}

- {/if} - {#if version} -

Version: {version}

- {/if} -
- {/if} -
- Your Rooms -
- -
- - Threads - {#if $notifications.has(threadsPath)} -
-
- {/if} -
- - -
- - Calendar - {#if $notifications.has(calendarPath)} -
-
- {/if} -
- - {#each $userRooms as room (room)} - {@const roomPath = makeRoomPath(url, room)} - {@const channel = $channelsById.get(makeChannelId(url, room))} - -
- {#if channel?.closed || channel?.private} - - {:else} - - {/if} - -
- {#if $notifications.has(roomPath)} -
- {/if} - - {/each} -
- Other Rooms -
- {#each $otherRooms as room (room)} - {@const channel = $channelsById.get(makeChannelId(url, room))} - -
- {#if channel?.closed || channel?.private} - - {:else} - - {/if} - -
- - {/each} - {#if hasNip29($relay)} - - {/if} -
- {#if pubkey} - Recent posts from the relay admin - +
+

+ + Quick Links +

+
+ +
+ + Threads + {#if $notifications.has(threadsPath)} +
+
+ {/if} +
+ + +
+ + Calendar + {#if $notifications.has(calendarPath)} +
+
+ {/if} +
+ + {#if $userRooms.length + $otherRooms.length > 10} +
+ +
+ {/if} + {#each ($userRooms.length + $otherRooms.length > 10 ? filteredRooms() : [...$userRooms, ...$otherRooms]).slice(0, 10) as room (room)} + {@const roomPath = makeRoomPath(url, room)} + {@const channel = $channelsById.get(makeChannelId(url, room))} + +
+ {#if channel?.closed || channel?.private} + + {:else} + + {/if} + +
+ {#if $notifications.has(roomPath)} +
+
+ {/if} + + {/each} + {#if hasNip29($relay)} + + {/if} +
+
+
+
+ {#if pubkey} +
+

+ + Recent Posts from Relay Admin +

+
+ {#if relayAdminEvents.length > 0} + + {:else} +

No recent posts from the relay admin

+ {/if} +
+
+ {/if} +
+

+ + Recent Activity +

+
+ {#if $userRooms.length > 0} + {#each $userRooms.slice(0, 3) as room (room)} + {@const channel = $channelsById.get(makeChannelId(url, room))} +
+
+ {#if channel?.closed || channel?.private} + + {:else} + + {/if} + + + +
+ Active conversations +
+ {/each} + {:else} +

No recent activity

+ {/if} +
+
+
+
+
+

+ + Relay Status +

+
+
+
+ Connected +
+ {#if $relay?.profile} + {@const {software, version, supported_nips, limitation} = $relay.profile} +
+ {#if $relay?.profile?.contact} +
+ Contact: {$relay.profile.contact} +
+ {/if} + {#if software} +
+ Software: {software} +
+ {/if} + {#if version} +
+ Version: {version} +
+ {/if} + {#if Array.isArray(supported_nips)} +

+ Supported NIPs: {supported_nips.join(", ")} +

+ {/if} + {#if limitation?.auth_required} +

+ Auth Required +

+ {/if} + {#if limitation?.payment_required} +

+ Payment Required +

+ {/if} + {#if limitation?.min_pow_difficulty} +

+ Min PoW: {limitation?.min_pow_difficulty} +

+ {/if} +
+ {/if} +
+
+
+