diff --git a/src/app/components/MenuOtherSpaces.svelte b/src/app/components/MenuOtherSpaces.svelte
deleted file mode 100644
index 63a31858..00000000
--- a/src/app/components/MenuOtherSpaces.svelte
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- {#each urls as url (url)}
-
- {/each}
-
diff --git a/src/app/components/MenuSpacesItem.svelte b/src/app/components/MenuSpacesItem.svelte
index 01fe73bb..d342ccfc 100644
--- a/src/app/components/MenuSpacesItem.svelte
+++ b/src/app/components/MenuSpacesItem.svelte
@@ -13,7 +13,7 @@
-
+
{#snippet icon()}
{/snippet}
diff --git a/src/app/components/PrimaryNav.svelte b/src/app/components/PrimaryNav.svelte
index 7d3ff21f..081d9829 100644
--- a/src/app/components/PrimaryNav.svelte
+++ b/src/app/components/PrimaryNav.svelte
@@ -15,7 +15,6 @@
import Divider from "@lib/components/Divider.svelte"
import PrimaryNavItem from "@lib/components/PrimaryNavItem.svelte"
import ChatEnable from "@app/components/ChatEnable.svelte"
- import MenuOtherSpaces from "@app/components/MenuOtherSpaces.svelte"
import MenuSettings from "@app/components/MenuSettings.svelte"
import PrimaryNavItemSpace from "@app/components/PrimaryNavItemSpace.svelte"
import {userSpaceUrls, PLATFORM_RELAYS, PLATFORM_LOGO} from "@app/core/state"
@@ -28,8 +27,6 @@
const {children}: Props = $props()
- const showOtherSpacesMenu = () => pushModal(MenuOtherSpaces, {urls: secondarySpaceUrls})
-
const showSettingsMenu = () => pushModal(MenuSettings)
const openChat = () => ($shouldUnwrap ? goto("/chat") : pushModal(ChatEnable, {next: "/chat"}))
@@ -60,15 +57,13 @@
{#each primarySpaceUrls as url (url)}
{/each}
- {#if secondarySpaceUrls.length > 0}
-
-
-
- {/if}
+
+
+
diff --git a/src/app/core/commands.ts b/src/app/core/commands.ts
index b33ec4d9..2ea604a8 100644
--- a/src/app/core/commands.ts
+++ b/src/app/core/commands.ts
@@ -37,6 +37,7 @@ import {
makeList,
addToListPublicly,
removeFromListByPredicate,
+ updateList,
getTag,
getListTags,
getRelayTagValues,
@@ -148,6 +149,20 @@ export const removeSpaceMembership = async (url: string) => {
return publishThunk({event, relays})
}
+export const setSpaceMembershipOrder = async (urls: string[]) => {
+ const list = get(userGroupList) || makeList({kind: ROOMS})
+ const orderedUrls = uniq(urls.map(normalizeRelayUrl))
+ const relayTags = list.publicTags.filter(t => t[0] === "r")
+ const otherPublicTags = list.publicTags.filter(t => t[0] !== "r")
+ const relayTagByUrl = new Map(relayTags.map(t => [normalizeRelayUrl(t[1]), t]))
+ const orderedRelayTags = orderedUrls.map(url => relayTagByUrl.get(url) || ["r", url])
+ const publicTags = [...orderedRelayTags, ...otherPublicTags]
+ const event = await updateList(list, {publicTags}).reconcile(nip44EncryptToSelf)
+ const relays = uniq([...Router.get().FromUser().getUrls(), ...getRelayTagValues(event.tags)])
+
+ return publishThunk({event, relays})
+}
+
export const addRoomMembership = async (url: string, h: string) => {
const list = get(userGroupList) || makeList({kind: ROOMS})
const newTags = [
diff --git a/src/routes/spaces/+page.svelte b/src/routes/spaces/+page.svelte
index ecf79939..7fbb5084 100644
--- a/src/routes/spaces/+page.svelte
+++ b/src/routes/spaces/+page.svelte
@@ -1,4 +1,5 @@
@@ -43,8 +123,17 @@
Loading your spaces...
{:then}
- {#each $userSpaceUrls as url (url)}
-
+ {#each orderedSpaceUrls as url (url)}
+ onDragStart(e, url)}
+ ondragover={e => onDragOver(e, url)}
+ ondrop={e => onDrop(e, url)}
+ ondragend={onDragEnd}>
+
+
{:else}
You haven't added any spaces yet!