From ed9da14fa52ed676762e6e22873abca4e640f26f Mon Sep 17 00:00:00 2001 From: rasmusq Date: Fri, 19 Dec 2025 20:50:06 +0100 Subject: [PATCH 1/3] add: create, update and login dates in database --- drizzle/schema.ts | 3 +++ src/auth.ts | 8 ++++++++ src/lib/components/wishlist/AddItemForm.svelte | 15 +++++++++++---- src/lib/components/wishlist/EditItemForm.svelte | 15 +++++++++++---- src/lib/server/schema.ts | 5 ++++- src/routes/dashboard/+page.server.ts | 6 +++--- src/routes/wishlist/[token]/edit/+page.svelte | 4 +++- 7 files changed, 43 insertions(+), 13 deletions(-) diff --git a/drizzle/schema.ts b/drizzle/schema.ts index ebf2d4b..c70006b 100644 --- a/drizzle/schema.ts +++ b/drizzle/schema.ts @@ -78,6 +78,9 @@ export const user = pgTable("user", { username: text(), dashboardTheme: text("dashboard_theme").default('none'), dashboardColor: text("dashboard_color"), + lastLogin: timestamp("last_login", { mode: 'string' }), + createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(), + updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(), }, (table) => [ unique("user_email_unique").on(table.email), unique("user_username_unique").on(table.username), diff --git a/src/auth.ts b/src/auth.ts index 4fa6d8f..411ece9 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -103,6 +103,14 @@ const authConfig: SvelteKitAuthConfig = { signIn: '/signin' }, callbacks: { + async signIn({ user }) { + if (user?.id) { + await db.update(users) + .set({ lastLogin: new Date() }) + .where(eq(users.id, user.id)); + } + return true; + }, async jwt({ token, user }) { if (user) { token.id = user.id; diff --git a/src/lib/components/wishlist/AddItemForm.svelte b/src/lib/components/wishlist/AddItemForm.svelte index 31e1332..a5a1a20 100644 --- a/src/lib/components/wishlist/AddItemForm.svelte +++ b/src/lib/components/wishlist/AddItemForm.svelte @@ -8,12 +8,18 @@ import ColorPicker from '$lib/components/ui/ColorPicker.svelte'; import { enhance } from '$app/forms'; import { languageStore } from '$lib/stores/language.svelte'; + import ThemeCard from '$lib/components/themes/ThemeCard.svelte'; + import { getCardStyle } from '$lib/utils/colors'; interface Props { onSuccess?: () => void; + wishlistColor?: string | null; + wishlistTheme?: string | null; } - let { onSuccess }: Props = $props(); + let { onSuccess, wishlistColor = null, wishlistTheme = null }: Props = $props(); + + const cardStyle = $derived(getCardStyle(wishlistColor, null)); const t = $derived(languageStore.t); @@ -53,11 +59,12 @@ } - - + + + {t.form.addNewWish} - +
void; + wishlistColor?: string | null; + wishlistTheme?: string | null; } - let { item, onSuccess, onCancel, onColorChange, currentPosition = 1, totalItems = 1, onPositionChange }: Props = $props(); + let { item, onSuccess, onCancel, onColorChange, currentPosition = 1, totalItems = 1, onPositionChange, wishlistColor = null, wishlistTheme = null }: Props = $props(); + + const cardStyle = $derived(getCardStyle(wishlistColor, null)); const t = $derived(languageStore.t); @@ -60,11 +66,12 @@ } - - + + + {t.wishlist.editWish} - + - + {/if} @@ -169,6 +169,8 @@ currentPosition={items.findIndex(item => item.id === editingItem.id) + 1} totalItems={items.length} onPositionChange={handlePositionChange} + wishlistColor={currentColor} + wishlistTheme={currentTheme} /> {/if} From b848477729632b85f8ad514a406b1c1cebed53c7 Mon Sep 17 00:00:00 2001 From: rasmusq Date: Fri, 19 Dec 2025 21:01:17 +0100 Subject: [PATCH 2/3] update: consistent round button sizing --- src/lib/components/layout/DashboardHeader.svelte | 2 +- src/lib/components/ui/ColorPicker.svelte | 2 +- src/lib/components/wishlist/WishlistHeader.svelte | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/components/layout/DashboardHeader.svelte b/src/lib/components/layout/DashboardHeader.svelte index 5852c7d..1ac62e0 100644 --- a/src/lib/components/layout/DashboardHeader.svelte +++ b/src/lib/components/layout/DashboardHeader.svelte @@ -79,7 +79,7 @@ {/if}
- + diff --git a/src/lib/components/ui/ColorPicker.svelte b/src/lib/components/ui/ColorPicker.svelte index b8bddcc..9341b70 100644 --- a/src/lib/components/ui/ColorPicker.svelte +++ b/src/lib/components/ui/ColorPicker.svelte @@ -18,7 +18,7 @@ }; const iconSizeClasses = { - sm: 'w-3 h-3', + sm: 'w-4 h-4', md: 'w-4 h-4', lg: 'w-5 h-5' }; diff --git a/src/lib/components/wishlist/WishlistHeader.svelte b/src/lib/components/wishlist/WishlistHeader.svelte index 63442e6..503f4a2 100644 --- a/src/lib/components/wishlist/WishlistHeader.svelte +++ b/src/lib/components/wishlist/WishlistHeader.svelte @@ -132,6 +132,7 @@ onColorUpdate(wishlistColor)} + size="sm" />
From bdfcdcc15b8c8a1d4505cc636604609f9b952e07 Mon Sep 17 00:00:00 2001 From: rasmusq Date: Fri, 19 Dec 2025 22:34:23 +0100 Subject: [PATCH 3/3] add: snow theme --- .../themes/svgs/BottomPattern.svelte | 10 +- .../components/themes/svgs/CardPattern.svelte | 11 +- .../components/themes/svgs/TopPattern.svelte | 9 +- src/lib/utils/themes.ts | 14 +- static/themes/dots/bgbottom.svg | 1 - static/themes/dots/bgtop.svg | 1 - static/themes/dots/item.svg | 1 - static/themes/geometric/bgbottom.svg | 1 - static/themes/geometric/bgtop.svg | 1 - static/themes/geometric/item.svg | 1 - static/themes/snow/bgbottom.svg | 2782 ++++++++++++++++ static/themes/snow/bgtop.svg | 2783 +++++++++++++++++ static/themes/snow/item.svg | 1695 ++++++++++ static/themes/waves/bgbottom.svg | 1 - static/themes/waves/bgtop.svg | 1 - static/themes/waves/item.svg | 1 - 16 files changed, 7275 insertions(+), 38 deletions(-) delete mode 100644 static/themes/dots/bgbottom.svg delete mode 100644 static/themes/dots/bgtop.svg delete mode 100644 static/themes/dots/item.svg delete mode 100644 static/themes/geometric/bgbottom.svg delete mode 100644 static/themes/geometric/bgtop.svg delete mode 100644 static/themes/geometric/item.svg create mode 100644 static/themes/snow/bgbottom.svg create mode 100644 static/themes/snow/bgtop.svg create mode 100644 static/themes/snow/item.svg delete mode 100644 static/themes/waves/bgbottom.svg delete mode 100644 static/themes/waves/bgtop.svg delete mode 100644 static/themes/waves/item.svg diff --git a/src/lib/components/themes/svgs/BottomPattern.svelte b/src/lib/components/themes/svgs/BottomPattern.svelte index 3459dd3..2a8c5aa 100644 --- a/src/lib/components/themes/svgs/BottomPattern.svelte +++ b/src/lib/components/themes/svgs/BottomPattern.svelte @@ -16,17 +16,15 @@ {#if pattern !== 'none'}
{/if} diff --git a/src/lib/components/themes/svgs/CardPattern.svelte b/src/lib/components/themes/svgs/CardPattern.svelte index 52dc17c..f378160 100644 --- a/src/lib/components/themes/svgs/CardPattern.svelte +++ b/src/lib/components/themes/svgs/CardPattern.svelte @@ -16,18 +16,15 @@ {#if pattern !== 'none'}
{/if} diff --git a/src/lib/components/themes/svgs/TopPattern.svelte b/src/lib/components/themes/svgs/TopPattern.svelte index 87524a2..b42c9f6 100644 --- a/src/lib/components/themes/svgs/TopPattern.svelte +++ b/src/lib/components/themes/svgs/TopPattern.svelte @@ -16,17 +16,16 @@ {#if pattern !== 'none'}
{/if} diff --git a/src/lib/utils/themes.ts b/src/lib/utils/themes.ts index f938f41..5cbe2c5 100644 --- a/src/lib/utils/themes.ts +++ b/src/lib/utils/themes.ts @@ -1,6 +1,6 @@ import { themeStore } from '$lib/stores/theme.svelte'; -export type ThemePattern = 'waves' | 'geometric' | 'dots' | 'none'; +export type ThemePattern = 'snow' | 'none'; export interface Theme { name: string; @@ -13,16 +13,8 @@ export const AVAILABLE_THEMES: Record = { pattern: 'none' }, waves: { - name: 'Waves', - pattern: 'waves' - }, - geometric: { - name: 'Geometric', - pattern: 'geometric' - }, - dots: { - name: 'Dots', - pattern: 'dots' + name: 'Snow', + pattern: 'snow' } }; diff --git a/static/themes/dots/bgbottom.svg b/static/themes/dots/bgbottom.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/dots/bgbottom.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/themes/dots/bgtop.svg b/static/themes/dots/bgtop.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/dots/bgtop.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/themes/dots/item.svg b/static/themes/dots/item.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/dots/item.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/themes/geometric/bgbottom.svg b/static/themes/geometric/bgbottom.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/geometric/bgbottom.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/themes/geometric/bgtop.svg b/static/themes/geometric/bgtop.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/geometric/bgtop.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/themes/geometric/item.svg b/static/themes/geometric/item.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/geometric/item.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/themes/snow/bgbottom.svg b/static/themes/snow/bgbottom.svg new file mode 100644 index 0000000..6fe2abd --- /dev/null +++ b/static/themes/snow/bgbottom.svg @@ -0,0 +1,2782 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/themes/snow/bgtop.svg b/static/themes/snow/bgtop.svg new file mode 100644 index 0000000..450970b --- /dev/null +++ b/static/themes/snow/bgtop.svg @@ -0,0 +1,2783 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/themes/snow/item.svg b/static/themes/snow/item.svg new file mode 100644 index 0000000..41bbeaf --- /dev/null +++ b/static/themes/snow/item.svg @@ -0,0 +1,1695 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/themes/waves/bgbottom.svg b/static/themes/waves/bgbottom.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/waves/bgbottom.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/themes/waves/bgtop.svg b/static/themes/waves/bgtop.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/waves/bgtop.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/themes/waves/item.svg b/static/themes/waves/item.svg deleted file mode 100644 index 455daf8..0000000 --- a/static/themes/waves/item.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file