diff --git a/src/lib/components/site/user-nav.svelte b/src/lib/components/site/user-nav.svelte index 1a485ea..b9a8ff8 100644 --- a/src/lib/components/site/user-nav.svelte +++ b/src/lib/components/site/user-nav.svelte @@ -34,8 +34,9 @@ Profile + Account Appearance - Notifications + diff --git a/src/routes/(user)/settings/+layout.svelte b/src/routes/(user)/settings/+layout.svelte index e3b27fb..1503cea 100644 --- a/src/routes/(user)/settings/+layout.svelte +++ b/src/routes/(user)/settings/+layout.svelte @@ -15,10 +15,6 @@ title: "Appearance", href: "/settings/appearance", }, - { - title: "Notifications", - href: "/settings/notifications", - }, ]; diff --git a/src/routes/(user)/settings/account/+page.svelte b/src/routes/(user)/settings/account/+page.svelte index 6918b98..21110f7 100644 --- a/src/routes/(user)/settings/account/+page.svelte +++ b/src/routes/(user)/settings/account/+page.svelte @@ -18,5 +18,5 @@ - + diff --git a/src/routes/(user)/settings/account/email-form.svelte b/src/routes/(user)/settings/account/email-form.svelte index caec4d5..91d6618 100644 --- a/src/routes/(user)/settings/account/email-form.svelte +++ b/src/routes/(user)/settings/account/email-form.svelte @@ -80,7 +80,12 @@ New email - Request token + + {#if isLoading} + + {/if} + Request token + @@ -121,7 +126,7 @@ {#if isLoading} {/if} - Update password + Update email diff --git a/src/routes/(user)/settings/account/username-form.svelte b/src/routes/(user)/settings/account/username-form.svelte index 12ff920..405d4b3 100644 --- a/src/routes/(user)/settings/account/username-form.svelte +++ b/src/routes/(user)/settings/account/username-form.svelte @@ -63,7 +63,7 @@ {#if isLoading} {/if} - Update password + Update username diff --git a/src/routes/(user)/settings/appearance/+page.server.ts b/src/routes/(user)/settings/appearance/+page.server.ts index dc249bc..8d988d0 100644 --- a/src/routes/(user)/settings/appearance/+page.server.ts +++ b/src/routes/(user)/settings/appearance/+page.server.ts @@ -11,13 +11,14 @@ export const load: PageServerLoad = async () => { }; export const actions: Actions = { - default: async (event) => { - const form = await superValidate(event, zod(appearanceFormSchema)); + default: async ({ request, locals }) => { + const form = await superValidate(request, zod(appearanceFormSchema)); if (!form.valid) { return fail(400, { form, }); } + await locals.pocketBase.collection('users').update(locals.id, form.data); return { form, }; diff --git a/src/routes/(user)/settings/appearance/appearance-form.svelte b/src/routes/(user)/settings/appearance/appearance-form.svelte index 43f71d8..d690993 100644 --- a/src/routes/(user)/settings/appearance/appearance-form.svelte +++ b/src/routes/(user)/settings/appearance/appearance-form.svelte @@ -2,7 +2,7 @@ import { z } from 'zod'; export const appearanceFormSchema = z.object({ - theme: z.enum(['system', 'light', 'dark'], { + appearanceMode: z.enum(['system', 'light', 'dark'], { required_error: 'Please select a theme.' }) }); @@ -13,35 +13,86 @@ - - - Theme - Select the theme for the dashboard. - - - - - - + Light + + + + + @@ -78,83 +133,22 @@ - - System - - - - - - - - - - - - - - - - - - - - - - Light - - - - - - - - - - - - - - - - - - - - - - Dark - - - - - - Update preferences - + Dark + + + + + + + {#if isLoading} + + {/if} + Update appearance + + -{#if dev && PUBLIC_DEBUG_FORMS == 'true' && browser} - -{/if} - - + {#if dev && PUBLIC_DEBUG_FORMS == 'true' && browser} + + {/if} + + diff --git a/src/routes/(user)/settings/notifications/+page.server.ts b/src/routes/(user)/settings/notifications/+page.server.ts deleted file mode 100644 index cd07e30..0000000 --- a/src/routes/(user)/settings/notifications/+page.server.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { superValidate } from "sveltekit-superforms"; -import { zod } from "sveltekit-superforms/adapters"; -import type { PageServerLoad } from "../$types"; -import { notificationsFormSchema } from "./notifications-form.svelte"; -import { fail, type Actions } from "@sveltejs/kit"; - -export const load: PageServerLoad = async () => { - return { - form: await superValidate(zod(notificationsFormSchema)), - }; -}; - -export const actions: Actions = { - default: async (event) => { - const form = await superValidate(event, zod(notificationsFormSchema)); - if (!form.valid) { - return fail(400, { - form, - }); - } - return { - form, - }; - }, -}; diff --git a/src/routes/(user)/settings/notifications/+page.svelte b/src/routes/(user)/settings/notifications/+page.svelte deleted file mode 100644 index cf72042..0000000 --- a/src/routes/(user)/settings/notifications/+page.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Notifications - Configure how you receive notifications. - - - - diff --git a/src/routes/(user)/settings/notifications/notifications-form.svelte b/src/routes/(user)/settings/notifications/notifications-form.svelte deleted file mode 100644 index 23972bb..0000000 --- a/src/routes/(user)/settings/notifications/notifications-form.svelte +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - Notify me about... - - - - - - All new messages - - - - - - Direct messages and mentions - - - - - - Nothing - - - - - - - - Email Notifications - - - - - Communication emails - - Receive emails about your account activity. - - - - - - - - - Marketing emails - - Receive emails about new products, features, and more. - - - - - - - - - Social emails - - Receive emails for friend requests, follows, and more. - - - - - - - - - Security emails - - Receive emails about your account activity and security. - - - - - - - - - - - - Use different settings for my mobile devices - - You can manage your mobile notifications in the mobile settings page. - - - - - - Update notifications - - -{#if dev && PUBLIC_DEBUG_FORMS == 'true' && browser} - -{/if} diff --git a/src/routes/(user)/settings/profile-form.svelte b/src/routes/(user)/settings/profile-form.svelte index f77fd3e..a819aa6 100644 --- a/src/routes/(user)/settings/profile-form.svelte +++ b/src/routes/(user)/settings/profile-form.svelte @@ -50,7 +50,7 @@ - + Name @@ -64,7 +64,7 @@ {#if isLoading} {/if} - Update password + Update name diff --git a/src/routes/(user)/settings/profile/+page.server.ts b/src/routes/(user)/settings/profile/+page.server.ts new file mode 100644 index 0000000..25caaaf --- /dev/null +++ b/src/routes/(user)/settings/profile/+page.server.ts @@ -0,0 +1,5 @@ +import { redirect } from '@sveltejs/kit'; + +export const load = async () => { + throw redirect(303, '/settings'); +}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9ed5cec..29326f3 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,17 +1,22 @@ - +
Configure how you receive notifications.