Drag and drop space icons (#17) (#78)

Closes #17

Co-authored-by: Jon Staab <shtaab@gmail.com>
Reviewed-on: coracle/flotilla#78
Co-authored-by: triesap <tyson@radroots.org>
Co-committed-by: triesap <tyson@radroots.org>
This commit is contained in:
2026-02-18 23:03:08 +00:00
committed by Jon Staab
parent 86d99916f7
commit c43544734a
5 changed files with 114 additions and 30 deletions
+15
View File
@@ -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 = [