From b620b7e5cc6406e87daa6da6c27ed91dd67d228e Mon Sep 17 00:00:00 2001 From: xarmian Date: Tue, 14 Apr 2026 14:37:45 -0400 Subject: [PATCH] feat: add edit button to collection detail page header (#113) * feat: add edit button to collection detail page header Wire up the existing EditCollectionModal to the collection detail page with a pencil icon button in the header actions bar. Owner-only, responsive (icon-only on mobile), refreshes page data after saves. Closes IDEA-494 * fix: navigate to new slug after collection rename in edit modal When a collection is renamed, the backend regenerates the slug. The onupdated callback now receives the updated Collection object, so the collection page can detect a slug change and navigate to the new URL instead of 404ing on the old slug. Addresses PR review feedback from #113. * fix: refresh collectionStore after edit modal update Ensures the sidebar reflects updated collection name/slug/icon immediately after editing, matching the settings page behavior. Addresses P2 review feedback from #113. --- .../collections/EditCollectionModal.svelte | 6 +- .../[workspace]/[collection]/+page.svelte | 56 +++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/web/src/lib/components/collections/EditCollectionModal.svelte b/web/src/lib/components/collections/EditCollectionModal.svelte index 34d3b014..8fe864cb 100644 --- a/web/src/lib/components/collections/EditCollectionModal.svelte +++ b/web/src/lib/components/collections/EditCollectionModal.svelte @@ -10,7 +10,7 @@ open: boolean; collection: Collection; wsSlug: string; - onupdated: () => void; + onupdated: (updated?: Collection) => void; onclose: () => void; } @@ -336,9 +336,9 @@ data.migrations = migrations; } - await api.collections.update(wsSlug, collection.slug, data); + const updated = await api.collections.update(wsSlug, collection.slug, data); toastStore.show(`Updated ${name.trim()}`, 'success'); - onupdated(); + onupdated(updated); } catch (err) { error = err instanceof Error ? err.message : 'Failed to update collection'; } finally { diff --git a/web/src/routes/[username]/[workspace]/[collection]/+page.svelte b/web/src/routes/[username]/[workspace]/[collection]/+page.svelte index 41dfbb50..3fb8b7b2 100644 --- a/web/src/routes/[username]/[workspace]/[collection]/+page.svelte +++ b/web/src/routes/[username]/[workspace]/[collection]/+page.svelte @@ -14,7 +14,9 @@ import { syncService } from '$lib/services/sync.svelte'; import { toastStore } from '$lib/stores/toast.svelte'; import ShareDialog from '$lib/components/ShareDialog.svelte'; + import EditCollectionModal from '$lib/components/collections/EditCollectionModal.svelte'; import { authStore } from '$lib/stores/auth.svelte'; + import { collectionStore } from '$lib/stores/collections.svelte'; type ViewMode = 'list' | 'board' | 'table'; @@ -38,6 +40,7 @@ let saveViewInput = $state(); let shareDialogOpen = $state(false); + let editCollectionOpen = $state(false); let workspaceMembers = $state<{ user_id: string; role: string }[]>([]); let wsSlug = $derived(page.params.workspace ?? ''); @@ -803,6 +806,17 @@ {/if} + {#if isOwner} + + {/if} + {#if isOwner}