diff --git a/src/lib/components/dashboard/LocalWishlistsSection.svelte b/src/lib/components/dashboard/LocalWishlistsSection.svelte index 023443d..158a270 100644 --- a/src/lib/components/dashboard/LocalWishlistsSection.svelte +++ b/src/lib/components/dashboard/LocalWishlistsSection.svelte @@ -21,11 +21,9 @@ let localWishlists = $state([]); let enrichedWishlists = $state([]); - // Load local wishlists on mount and fetch their data from server onMount(async () => { localWishlists = getLocalWishlists(); - // Fetch full wishlist data for each local wishlist const promises = localWishlists.map(async (local) => { try { const response = await fetch(`/api/wishlist/${local.ownerToken}`); @@ -39,7 +37,6 @@ } catch (error) { console.error('Failed to fetch wishlist data:', error); } - // Fallback to local data if fetch fails return { id: local.ownerToken, title: local.title, diff --git a/src/lib/utils/localWishlists.ts b/src/lib/utils/localWishlists.ts index 72f0ea9..7ee4538 100644 --- a/src/lib/utils/localWishlists.ts +++ b/src/lib/utils/localWishlists.ts @@ -36,7 +36,6 @@ export function addLocalWishlist(wishlist: LocalWishlist): void { try { const wishlists = getLocalWishlists(); - // Check if already exists const exists = wishlists.some(w => w.ownerToken === wishlist.ownerToken); if (exists) return; diff --git a/src/routes/dashboard/+page.server.ts b/src/routes/dashboard/+page.server.ts index 75b9b83..5ed5466 100644 --- a/src/routes/dashboard/+page.server.ts +++ b/src/routes/dashboard/+page.server.ts @@ -147,7 +147,6 @@ export const actions: Actions = { return { success: false, error: 'Wishlist ID is required' }; } - // Verify the user owns this wishlist await db.delete(wishlists) .where(and( eq(wishlists.id, wishlistId), diff --git a/src/routes/dashboard/+page.svelte b/src/routes/dashboard/+page.svelte index 93a51ef..efb7004 100644 --- a/src/routes/dashboard/+page.svelte +++ b/src/routes/dashboard/+page.svelte @@ -11,12 +11,10 @@ let { data }: { data: PageData } = $props(); - // For anonymous users, get theme from localStorage function getInitialTheme() { if (data.isAuthenticated) { return data.user?.dashboardTheme || 'none'; } else { - // Anonymous user - get from localStorage if (typeof window !== 'undefined') { return localStorage.getItem('dashboardTheme') || 'none'; } @@ -24,12 +22,10 @@ } } - // For anonymous users, get color from localStorage function getInitialColor() { if (data.isAuthenticated) { return data.user?.dashboardColor || null; } else { - // Anonymous user - get from localStorage if (typeof window !== 'undefined') { return localStorage.getItem('dashboardColor') || null; } @@ -40,7 +36,6 @@ let currentTheme = $state(getInitialTheme()); let currentColor = $state(getInitialColor()); - // Save to localStorage when theme changes for anonymous users function handleThemeUpdate(theme: string | null) { currentTheme = theme || 'none'; @@ -49,7 +44,6 @@ } } - // Save to localStorage when color changes for anonymous users function handleColorUpdate(color: string | null) { currentColor = color; @@ -64,10 +58,8 @@ const t = $derived(languageStore.t); - // Only owned wishlists for "My Wishlists" const myWishlists = $derived(() => data.wishlists || []); - // Claimed wishlists (those with ownerToken, meaning they were claimed via edit link) const claimedWishlists = $derived(() => { return (data.savedWishlists || []) .filter(saved => saved.wishlist?.ownerToken) @@ -79,7 +71,6 @@ })); }); - // Saved wishlists are those WITHOUT ownerToken (saved from public view only) const savedWishlists = $derived(() => { return (data.savedWishlists || []).filter(saved => !saved.wishlist?.ownerToken); }); @@ -96,15 +87,7 @@ onColorUpdate={handleColorUpdate} /> - - - {#if data.isAuthenticated} - - + + - {#snippet actions(saved, unlocked)}