From e0511edc4dc909bd7415ca464323e70a250a609a Mon Sep 17 00:00:00 2001 From: triesap Date: Wed, 18 Feb 2026 20:56:18 +0000 Subject: [PATCH 1/4] Add drag and drop for space icons --- src/app/components/MenuOtherSpaces.svelte | 69 ++++++++++++++++- src/app/components/PrimaryNav.svelte | 23 +++--- src/routes/spaces/+page.svelte | 92 ++++++++++++++++++++++- 3 files changed, 165 insertions(+), 19 deletions(-) diff --git a/src/app/components/MenuOtherSpaces.svelte b/src/app/components/MenuOtherSpaces.svelte index 63a31858..2f7c3469 100644 --- a/src/app/components/MenuOtherSpaces.svelte +++ b/src/app/components/MenuOtherSpaces.svelte @@ -6,10 +6,73 @@ } const {urls}: Props = $props() + + const reorderUrls = (sourceUrl: string, targetUrl: string, currentUrls: string[]) => { + if (sourceUrl === targetUrl) { + return currentUrls + } + + const sourceIndex = currentUrls.indexOf(sourceUrl) + const targetIndex = currentUrls.indexOf(targetUrl) + + if (sourceIndex === -1 || targetIndex === -1) { + return currentUrls + } + + const nextUrls = currentUrls.filter(url => url !== sourceUrl) + + nextUrls.splice(targetIndex, 0, sourceUrl) + + return nextUrls + } + + const moveDraggedUrl = (targetUrl: string) => { + if (!draggedUrl) { + return + } + + orderedUrls = reorderUrls(draggedUrl, targetUrl, orderedUrls) + } + + const onDragStart = (e: DragEvent, url: string) => { + draggedUrl = url + + if (e.dataTransfer) { + e.dataTransfer.effectAllowed = "move" + e.dataTransfer.setData("text/plain", url) + } + } + + const onDragOver = (e: DragEvent, targetUrl: string) => { + e.preventDefault() + moveDraggedUrl(targetUrl) + } + + const onDrop = (e: DragEvent, targetUrl: string) => { + e.preventDefault() + moveDraggedUrl(targetUrl) + draggedUrl = undefined + } + + const onDragEnd = () => { + draggedUrl = undefined + } + + let orderedUrls = $state([...urls]) + let draggedUrl = $state() - {: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!

-- 2.52.0 From 64a62a72d14909dfdb764bf9317ada9aab5acc43 Mon Sep 17 00:00:00 2001 From: triesap Date: Wed, 18 Feb 2026 21:28:21 +0000 Subject: [PATCH 2/4] Persist space icon order --- src/app/components/MenuOtherSpaces.svelte | 50 +++++++++++++---------- src/app/core/commands.ts | 15 +++++++ src/routes/spaces/+page.svelte | 49 +++++++++++----------- 3 files changed, 69 insertions(+), 45 deletions(-) diff --git a/src/app/components/MenuOtherSpaces.svelte b/src/app/components/MenuOtherSpaces.svelte index 2f7c3469..7159a183 100644 --- a/src/app/components/MenuOtherSpaces.svelte +++ b/src/app/components/MenuOtherSpaces.svelte @@ -1,5 +1,7 @@